/* ============================================================
   Design system — "Trust & Enterprise"
   Security-forward, structured, polished. Indigo/blue brand on
   slate neutrals. Fully realized in both light and dark mode
   (Tailwind's default `media` strategy follows the OS).
   ============================================================ */
:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --surface-3: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --brand: #4f46e5;          /* indigo-600 */
    --brand-hover: #4338ca;    /* indigo-700 */
    --brand-soft: #eef2ff;     /* indigo-50  */
    --brand-text: #4338ca;     /* readable indigo on light */
    --accent-2: #2563eb;       /* supporting blue */
    --success: #16a34a;
    --success-soft: #f0fdf4;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --ring: rgba(79, 70, 229, 0.16);
    --hero-grad: linear-gradient(135deg, #eef2ff 0%, #f8fafc 45%, #eff6ff 100%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #131c31;
        --surface-2: #1b263f;
        --surface-3: #243049;
        --text: #f1f5f9;
        --text-secondary: #a3b0c2;
        --text-tertiary: #6b7a90;
        --border: #243049;
        --border-strong: #33415c;

        --brand: #6366f1;
        --brand-hover: #818cf8;
        --brand-soft: #1e2545;
        --brand-text: #c7d2fe;
        --accent-2: #60a5fa;
        --success: #4ade80;
        --success-soft: #11271c;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
        --ring: rgba(99, 102, 241, 0.30);
        --hero-grad: linear-gradient(135deg, #131c31 0%, #0b1120 50%, #111a30 100%);
    }
}

/* ---- Semantic helpers (token-driven, dark-mode automatic) ---------- */
.text-body { color: var(--text); }
.text-muted { color: var(--text-secondary); }
.text-faint { color: var(--text-tertiary); }
.text-brand { color: var(--brand-text); }
.bg-app { background: var(--bg); }
.bg-surface { background: var(--surface); }
.bg-surface-2 { background: var(--surface-2); }
.border-base { border: 1px solid var(--border); }
.border-t-base { border-top: 1px solid var(--border); }
.border-b-base { border-bottom: 1px solid var(--border); }
.divide-base > * + * { border-top: 1px solid var(--border); }

.link-muted { color: var(--text-secondary); transition: color 0.2s ease; }
.link-muted:hover { color: var(--text); }
.nav-link { color: var(--text-secondary); transition: color 0.2s ease; }
.nav-link:hover { color: var(--text); }

/* ---- Inline SVG icons (sprite via <use href="#i-NAME">) ------------- */
.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
    color: var(--text);
    scroll-behavior: smooth;
    letter-spacing: -0.011em;
}

h1, h2, h3, h4 {
    letter-spacing: -0.022em;
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Brand surfaces -------------------------------------------------- */

/* Soft enterprise hero / section wash. */
.hero-surface {
    background: var(--hero-grad);
}

/* Solid brand fill (icon tiles, CTA band, primary chips). */
.gradient-bg {
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent-2) 100%);
}

/* Faint translucent panel kept for incidental use. */
.glass-effect {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: saturate(140%) blur(10px);
}

/* ---- Cards ---------------------------------------------------------- */

.surface-card,
.glass-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.glass-card:hover,
.grow-on-hover:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}

.grow-on-hover {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Featured converter card — slightly elevated, brand-tinted edge. */
.card-elevated {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
}

/* ---- Buttons -------------------------------------------------------- */

.btn-gradient,
.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent-2) 100%);
    color: #fff;
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    box-shadow: 0 6px 16px var(--ring);
}

.btn-gradient:hover,
.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 22px var(--ring);
}

.btn-gradient:active,
.btn-primary:active {
    transform: scale(0.99);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--text-tertiary);
}

/* ---- Trust badges / pills ------------------------------------------ */

.trust-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.trust-pill i {
    color: var(--success);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-text);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
}

/* Brand-tinted icon tile. */
.icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-text);
}

/* ---- Form upload area ---------------------------------------------- */

.custom-file-input {
    position: relative;
    overflow: hidden;
    display: block;
    cursor: pointer;
}

.custom-file-input input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#dropzone {
    background: var(--surface-2);
    border: 2px dashed var(--border-strong);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

#dropzone.is-dragover {
    border-color: var(--brand);
    background-color: var(--brand-soft);
}

/* ---- Perf: skip offscreen work below the fold ---------------------- */
.cv-section {
    content-visibility: auto;
    contain-intrinsic-size: 0 600px;
}

/* ---- View Transitions: one subtle cross-fade on MPA navigation ------
   Opts every same-origin navigation (home <-> blog articles) into the
   browser's default root cross-fade. Capped under ~200ms so it reads as
   "this is a navigation" without ever feeling slow. Browsers without the
   API simply navigate instantly — progressive enhancement, no JS, no CSP
   impact. Fully disabled under reduced-motion (the global *, ::before,
   ::after rule does NOT match ::view-transition-* pseudo-elements, so the
   transition is killed explicitly below). */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 180ms;
        animation-timing-function: ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}

/* ---- FAQ accordion (JS toggles inline max-height) ------------------ */
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* ---- Blog / article pages ------------------------------------------
   One reusable typography system so every guide matches the homepage's
   "Trust & Enterprise" tokens without per-page utility classes. */
.article-hero {
    background: var(--hero-grad);
    border-bottom: 1px solid var(--border);
}

.article-prose {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.article-prose > * + * { margin-top: 1.2rem; }

.article-prose section + section { margin-top: 2.5rem; }

.article-prose h2,
.article-prose h3 {
    color: var(--text);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.022em;
    margin-top: 2.25rem;
    margin-bottom: 0.5rem;
}

.article-prose h2 { font-size: 1.65rem; }
.article-prose h3 { font-size: 1.3rem; }

.article-prose h4 {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 1.75rem;
    margin-bottom: 0.4rem;
}

.article-prose p { color: var(--text-secondary); }

.article-prose a {
    color: var(--brand-text);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.article-prose a:hover { color: var(--brand-hover); }

.article-prose strong { color: var(--text); font-weight: 600; }

.article-prose ul,
.article-prose ol { padding-left: 1.4rem; }
.article-prose ul { list-style: disc; }
.article-prose ol { list-style: decimal; }
.article-prose li { margin-top: 0.5rem; padding-left: 0.25rem; }
.article-prose li::marker { color: var(--text-tertiary); }

/* Inline code (within paragraphs / list items). */
.article-prose code,
.article-prose kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.1em 0.4em;
    color: var(--text);
}

/* Standalone command lines: a <code> placed directly in a <section> /
   <article> renders as a full code block. */
.article-prose > code,
.article-prose section > code,
.article-prose article > code {
    display: block;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
    /* Commands use <br> for line breaks, so collapse source indentation. */
    white-space: normal;
    word-break: break-word;
}

.article-prose pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}
.article-prose pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
}

.article-prose blockquote {
    border-left: 3px solid var(--brand);
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Warning / security callout inside an article. */
.article-note {
    display: flex;
    gap: 0.65rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.article-note .icon { color: var(--brand); margin-top: 0.15rem; }

/* ---- Result page: monospace PEM blocks ----------------------------- */
.pem-block {
    margin: 0;
    max-height: 14rem;
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}
