/*
 * iotc-desc — IoTCrazy product description stylesheet (standalone, shared by the storefront and the admin panel).
 *
 *   Usage:  <link rel="stylesheet" href=".../description.css">
 *           <div class="iotc-desc"> ...HTML from the Description editor... </div>
 *
 * Self-contained: no framework, no site fonts, no images. Every selector is scoped under .iotc-desc and every custom
 * property starts with --iotc-, so it cannot clash with the host page (and the host page's CSS reset cannot flatten it).
 * Safe to host on a CDN; the admin preview and the storefront load the very same file, so what you preview is what
 * customers see. To retheme, override the --iotc-* variables on .iotc-desc (or on a parent element).
 *
 * Repo copies (must stay byte-identical): storefront public/assets/css/description.css,
 * admin public/assets/css/description.css — check with `php scripts/check-description-css.php` in the admin repo.
 */
.iotc-desc {
    --iotc-text: #3b3f4a;
    --iotc-strong: #14162b;
    --iotc-muted: #7a7f91;
    --iotc-accent: #6d5efc;          /* violet */
    --iotc-accent-2: #ff5fa2;        /* pink  */
    --iotc-accent-3: #18c4b0;        /* teal  */
    --iotc-accent-soft: #f1efff;
    --iotc-line: #e7e8f2;
    --iotc-code-bg: #f6f5ff;
    --iotc-code-text: #d6307f;
    --iotc-radius: 12px;

    box-sizing: border-box;
    display: block;
    /* fixed on purpose: the admin preview has no site font to inherit, and both sides must render the same */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--iotc-text);
    text-align: left;
    overflow-wrap: anywhere;
    -webkit-text-size-adjust: 100%;
}
.iotc-desc *, .iotc-desc *::before, .iotc-desc *::after { box-sizing: border-box; }

.iotc-desc > :first-child { margin-top: 0 !important; }
.iotc-desc > :last-child { margin-bottom: 0 !important; }

/* ---- headings -------------------------------------------------------------------------------------------- */
.iotc-desc h1, .iotc-desc h2, .iotc-desc h3, .iotc-desc h4, .iotc-desc h5, .iotc-desc h6 {
    margin: 1.9em 0 0.7em;
    color: var(--iotc-strong);
    font-weight: 750;
    line-height: 1.28;
    letter-spacing: -0.01em;
}
.iotc-desc h1 { font-size: 2em; }
.iotc-desc h2 {
    position: relative;
    font-size: 1.55em;
    padding: 0.05em 0 0.45em;
}
/* a short gradient bar under every H2 */
.iotc-desc h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--iotc-accent), var(--iotc-accent-2));
}
.iotc-desc h3 {
    font-size: 1.25em;
    padding-left: 0.7em;
    border-left: 5px solid var(--iotc-accent);
    border-image: linear-gradient(180deg, var(--iotc-accent), var(--iotc-accent-2)) 1;
}
.iotc-desc h4 { font-size: 1.08em; color: var(--iotc-accent); }
.iotc-desc h5, .iotc-desc h6 {
    font-size: 0.95em;
    color: var(--iotc-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---- text ------------------------------------------------------------------------------------------------ */
.iotc-desc p { margin: 1em 0; }
.iotc-desc strong, .iotc-desc b {
    color: var(--iotc-strong);
    font-weight: 750;
    background: linear-gradient(transparent 62%, rgba(109, 94, 252, 0.18) 62%);   /* soft highlighter underline */
}
.iotc-desc em, .iotc-desc i { font-style: italic; }
.iotc-desc u { text-decoration-color: var(--iotc-accent-2); text-underline-offset: 3px; }
.iotc-desc s, .iotc-desc del { color: var(--iotc-muted); }
.iotc-desc small { font-size: 0.875em; color: var(--iotc-muted); }
.iotc-desc mark { padding: 0.05em 0.3em; border-radius: 4px; background: #fff0a6; color: inherit; }
.iotc-desc a {
    color: var(--iotc-accent);
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(var(--iotc-accent-2), var(--iotc-accent-2)) no-repeat 0 100% / 0 2px;
    border-bottom: 2px solid rgba(109, 94, 252, 0.28);
    transition: background-size 0.25s ease, color 0.2s ease;
}
.iotc-desc a:hover { color: var(--iotc-accent-2); background-size: 100% 2px; border-bottom-color: transparent; }

/* spacer paragraphs (<p><br></p>) left by the old rich-text editor: keep a small gap, not a whole blank line */
.iotc-desc p:has(> br:only-child) { margin: 0; height: 0.6em; line-height: 0; }

/* alignment classes from the old rich-text editor */
.iotc-desc .ql-align-center { text-align: center; }
.iotc-desc .ql-align-right { text-align: right; }
.iotc-desc .ql-align-justify { text-align: justify; }

/* ---- lists: coloured markers ----------------------------------------------------------------------------- */
.iotc-desc ul, .iotc-desc ol { margin: 1em 0; padding-left: 1.7em; }
.iotc-desc ul { list-style: disc; }
.iotc-desc ol { list-style: decimal; }
.iotc-desc li { margin: 0.45em 0; padding-left: 0.25em; }
.iotc-desc ul > li::marker { color: var(--iotc-accent-2); font-size: 1.15em; }
.iotc-desc ol > li::marker { color: var(--iotc-accent); font-weight: 750; }
.iotc-desc li > ul, .iotc-desc li > ol { margin: 0.4em 0; }
.iotc-desc li > ul { list-style: circle; }
.iotc-desc li > p { margin: 0.35em 0; }

/* ---- quote / callout ------------------------------------------------------------------------------------- */
.iotc-desc blockquote {
    margin: 1.5em 0;
    padding: 0.9em 1.2em;
    border-left: 5px solid var(--iotc-accent);
    border-radius: 0 var(--iotc-radius) var(--iotc-radius) 0;
    background: linear-gradient(100deg, var(--iotc-accent-soft), rgba(255, 95, 162, 0.07));
    color: var(--iotc-strong);
}
.iotc-desc blockquote > :first-child { margin-top: 0; }
.iotc-desc blockquote > :last-child { margin-bottom: 0; }

/* ---- code ------------------------------------------------------------------------------------------------ */
.iotc-desc code, .iotc-desc pre, .iotc-desc kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.iotc-desc code {
    font-size: 0.88em;
    padding: 0.15em 0.45em;
    border-radius: 6px;
    background: var(--iotc-code-bg);
    color: var(--iotc-code-text);
}
.iotc-desc kbd {
    font-size: 0.85em;
    padding: 0.1em 0.5em;
    border: 1px solid var(--iotc-line);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fff;
    color: var(--iotc-strong);
}
.iotc-desc pre {
    margin: 1.4em 0;
    padding: 1em 1.2em;
    overflow-x: auto;
    border-radius: var(--iotc-radius);
    background: #1c1b33;
    color: #e9e7ff;
    font-size: 0.9em;
    line-height: 1.65;
}
.iotc-desc pre code { padding: 0; background: none; color: inherit; font-size: inherit; }

/* ---- media ----------------------------------------------------------------------------------------------- */
.iotc-desc img, .iotc-desc video, .iotc-desc iframe { max-width: 100%; border-radius: var(--iotc-radius); }
.iotc-desc img, .iotc-desc video { height: auto; }
.iotc-desc img {
    display: block;
    margin: 1.5em auto;
    box-shadow: 0 10px 30px -12px rgba(30, 27, 75, 0.35);
}
.iotc-desc figure { margin: 1.5em 0; }
.iotc-desc figcaption { margin-top: 0.5em; text-align: center; font-size: 0.875em; color: var(--iotc-muted); }

/* ---- tables ---------------------------------------------------------------------------------------------- */
.iotc-desc table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--iotc-line);
    border-radius: var(--iotc-radius);
    font-size: 0.95em;
}
.iotc-desc th, .iotc-desc td { padding: 0.65em 0.9em; text-align: left; vertical-align: top; border-bottom: 1px solid var(--iotc-line); }
.iotc-desc tr:last-child > td, .iotc-desc tr:last-child > th { border-bottom: 0; }
.iotc-desc th {
    background: linear-gradient(100deg, var(--iotc-accent-soft), rgba(24, 196, 176, 0.1));
    color: var(--iotc-strong);
    font-weight: 700;
}
.iotc-desc tbody tr:nth-child(even) > td { background: #fafaff; }

/* ---- divider --------------------------------------------------------------------------------------------- */
.iotc-desc hr {
    height: 3px;
    margin: 2.2em 0;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--iotc-accent), var(--iotc-accent-2), var(--iotc-accent-3));
    opacity: 0.55;
}

@media (max-width: 640px) {
    .iotc-desc { font-size: 15px; }
    .iotc-desc h1 { font-size: 1.7em; }
    .iotc-desc h2 { font-size: 1.35em; }
}
@media (prefers-reduced-motion: reduce) {
    .iotc-desc a { transition: none; }
}
