/* =========================================================================
   Synths — Design System (shell foundation)
   Dark-first. Editorial typography. Cinematic sensibility.
   Referências estéticas: Apple, Linear, Stripe, Vercel.
   ========================================================================= */

/* Self-hosted variable fonts (subset: latin + latin-ext, weight axis only).
   Files in wwwroot/fonts/, immutable cache via service worker. */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/fraunces-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Fraunces";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Fraunces";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/fraunces-latin-ext-wght-italic.woff2") format("woff2-variations");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: dark;

    /* Surfaces */
    --surface-0: #0a0a0c;
    --surface-1: #111114;
    --surface-2: #17171c;
    --surface-raised: #1c1c22;

    /* Borders (alpha on primary text for theme-parity) */
    --border-faint: rgba(244, 241, 234, 0.06);
    --border-subtle: rgba(244, 241, 234, 0.10);
    --border: rgba(244, 241, 234, 0.16);
    --border-strong: rgba(244, 241, 234, 0.24);

    /* Text */
    --text-primary: #f4f1ea;
    --text-secondary: rgba(244, 241, 234, 0.70);
    --text-tertiary: rgba(244, 241, 234, 0.48);
    --text-muted: rgba(244, 241, 234, 0.32);

    /* Signature */
    --accent: #c8b6ff;
    --accent-dim: rgba(200, 182, 255, 0.14);
    --danger: #ff7b7b;
    --success: #86efac;

    /* Typography */
    --font-sans: "Inter", "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Fraunces", "Inter", ui-serif, Georgia, serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

    /* Type scale (1.250 — minor third) */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    --text-4xl: 3rem;
    --text-5xl: 4.25rem;
    --text-6xl: 6rem;

    /* Line-heights */
    --leading-tight: 1.08;
    --leading-snug: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    /* Space */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-24: 6rem;

    /* Radii */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Motion */
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 120ms;
    --duration: 200ms;
    --duration-slow: 360ms;
}

/* Reset -------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--surface-0);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-feature-settings: "ss01", "cv11", "liga";
    letter-spacing: -0.005em;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 500;
    letter-spacing: -0.022em;
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

p { margin: 0; }

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--duration) var(--ease-out);
}

a:hover { color: var(--accent); }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

::selection {
    background: var(--accent);
    color: var(--surface-0);
}

/* Ambient background: subtle radial vignette behind everything ------------- */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200, 182, 255, 0.055), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(200, 182, 255, 0.03), transparent 60%);
}

/* Blazor error UI — override template defaults ---------------------------- */

#blazor-error-ui {
    color-scheme: dark;
    background: var(--surface-raised);
    color: var(--text-primary);
    border-top: 1px solid var(--border);
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: none;
    padding: var(--space-4) var(--space-6);
    position: fixed;
    z-index: 1000;
    font-size: var(--text-sm);
    box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.6);
}

#blazor-error-ui .reload {
    color: var(--accent);
    margin-left: var(--space-4);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    transition: color var(--duration) var(--ease-out);
}

#blazor-error-ui .dismiss:hover { color: var(--text-primary); }

.blazor-error-boundary {
    background: var(--surface-raised);
    color: var(--danger);
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

.blazor-error-boundary::after { content: "Ocorreu um erro neste bloco."; }

/* Initial loading splash (before Blazor boots) ---------------------------- */

#app-loader {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--surface-0);
    z-index: 9999;
    animation: app-loader-in 240ms var(--ease-out) both;
}

#app-loader .wordmark {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: var(--text-3xl);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    opacity: 0;
    animation: app-loader-wordmark 900ms var(--ease-out) 120ms forwards;
}

#app-loader .wordmark::after {
    content: "·";
    display: inline-block;
    margin-left: 0.25em;
    color: var(--accent);
    animation: app-loader-pulse 1.4s var(--ease-in-out) infinite;
}

@keyframes app-loader-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes app-loader-wordmark {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes app-loader-pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* Accessibility ----------------------------------------------------------- */

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

@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;
    }
}

/* Print — used by the report PDF export ("Save as PDF" via the system dialog).
   Strips the chrome and forces a light theme so the output prints cleanly on
   paper or PDF. Only the .report-prose article and its trailing meta survive. */

@media print {
    :root {
        color-scheme: light;
    }

    body {
        background: #ffffff !important;
        color: #1a1a1a !important;
        overflow: visible !important;
        font-family: "Fraunces", "Georgia", "Times New Roman", serif !important;
        font-size: 11pt !important;
        line-height: 1.55 !important;
    }

    body::before { display: none !important; }

    .app-shell {
        display: block !important;
        min-height: 0 !important;
    }

    .sidebar,
    .app-shell-topbar,
    .toast-host,
    .dialog-scrim,
    .report-head,
    .report-toolbar,
    .report-empty,
    .report-progress,
    .report-error,
    .report-initial,
    .report-foot,
    #blazor-error-ui,
    #app-loader {
        display: none !important;
    }

    .app-shell-content,
    .app-shell-main,
    .report-page {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
    }

    .report-prose {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #1a1a1a !important;
        font-family: "Fraunces", "Georgia", "Times New Roman", serif !important;
        font-size: 11.5pt !important;
        line-height: 1.55 !important;
    }

    .report-prose h1,
    .report-prose h2,
    .report-prose h3,
    .report-prose h4 {
        color: #111 !important;
        page-break-after: avoid;
    }

    .report-prose h1 {
        font-size: 24pt !important;
        font-weight: 400 !important;
        margin: 0 0 14pt !important;
        padding-bottom: 8pt !important;
        border-bottom: 0.5pt solid #d0d0d0 !important;
    }

    .report-prose h2 {
        font-size: 16pt !important;
        font-weight: 500 !important;
        margin: 22pt 0 10pt !important;
        border-bottom: 0.5pt solid #e0e0e0 !important;
        padding-bottom: 4pt !important;
    }

    .report-prose h3 {
        font-size: 13pt !important;
        font-weight: 600 !important;
        margin: 18pt 0 8pt !important;
    }

    .report-prose h4 {
        font-size: 10.5pt !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.06em !important;
        color: #555 !important;
        margin: 14pt 0 6pt !important;
    }

    .report-prose p {
        orphans: 2;
        widows: 2;
        page-break-inside: avoid;
    }

    .report-prose blockquote {
        border-left: 2pt solid #888 !important;
        color: #333 !important;
        font-style: italic !important;
        font-family: "Fraunces", "Georgia", serif !important;
        font-size: 11pt !important;
        page-break-inside: avoid;
        margin: 12pt 0 !important;
        padding: 4pt 14pt !important;
    }

    .report-prose code {
        background: #f4f4f4 !important;
        color: #1a1a1a !important;
        font-size: 10pt !important;
    }

    .report-prose pre {
        background: #f4f4f4 !important;
        border: 0.5pt solid #d0d0d0 !important;
        page-break-inside: avoid;
    }

    .report-prose ul,
    .report-prose ol {
        page-break-inside: avoid;
    }

    .report-prose table {
        page-break-inside: avoid;
    }

    .report-prose a {
        color: #1a1a1a !important;
        text-decoration: underline !important;
    }

    @page {
        size: A4;
        margin: 2.5cm 2.2cm 2.5cm 2.2cm;
    }
}
