/* ============================================================
   AutoCurious — editorial / atmospheric auto news
   Glass surfaces over a deep aurora field. Dual theme via
   [data-theme="dark"|"light"] on <html>. Bootstrapped pre-paint
   in baseof.html to avoid flash.
   ============================================================ */

:root {
    --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;

    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    --maxw: 1180px;
    --shell-pad: clamp(1rem, 4vw, 2.5rem);
}

/* Dark — default */
:root,
[data-theme="dark"] {
    --bg: #0a0e1a;
    --bg-deep: #060912;
    --aurora-1: hsla(192, 90%, 60%, 0.28);
    --aurora-2: hsla(265, 80%, 65%, 0.25);
    --aurora-3: hsla(330, 80%, 65%, 0.18);

    --text: #e7eaf3;
    --text-strong: #ffffff;
    --text-muted: #8a93ad;
    --text-faint: #5b6280;

    --surface: rgba(255, 255, 255, 0.035);
    --surface-strong: rgba(255, 255, 255, 0.065);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --hairline: rgba(255, 255, 255, 0.08);
    --hairline-strong: rgba(255, 255, 255, 0.16);

    --accent: #7dd3fc;
    --accent-2: #c4b5fd;
    --accent-ink: #0a0e1a;

    --shadow-soft: 0 30px 60px -30px rgba(0, 0, 0, 0.55);
    --glow: 0 0 0 1px rgba(125, 211, 252, 0.18), 0 20px 40px -20px rgba(125, 211, 252, 0.25);
}

/* Light */
[data-theme="light"] {
    --bg: #f4efe6;
    --bg-deep: #ece4d3;
    --aurora-1: hsla(28, 90%, 70%, 0.35);
    --aurora-2: hsla(195, 85%, 65%, 0.28);
    --aurora-3: hsla(310, 70%, 70%, 0.22);

    --text: #1a1d2e;
    --text-strong: #0a0d1a;
    --text-muted: #5b6178;
    --text-faint: #8c92a3;

    --surface: rgba(255, 255, 255, 0.55);
    --surface-strong: rgba(255, 255, 255, 0.7);
    --surface-hover: rgba(255, 255, 255, 0.82);
    --hairline: rgba(20, 24, 40, 0.08);
    --hairline-strong: rgba(20, 24, 40, 0.18);

    --accent: #0f766e;
    --accent-2: #6d28d9;
    --accent-ink: #ffffff;

    --shadow-soft: 0 30px 60px -30px rgba(40, 30, 10, 0.18);
    --glow: 0 0 0 1px rgba(15, 118, 110, 0.18), 0 20px 40px -20px rgba(15, 118, 110, 0.18);
}

/* ============================================================
   Reset
   ============================================================ */

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

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
    font-family: var(--sans);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

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

/* ============================================================
   Aurora atmosphere — lives behind everything
   ============================================================ */

.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, var(--aurora-2), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.9;
    will-change: transform;
}

.aurora-blob--a {
    width: 55vmax; height: 55vmax;
    top: -20vmax; left: -10vmax;
    background: var(--aurora-1);
    animation: drift-a 28s var(--ease) infinite alternate;
}

.aurora-blob--b {
    width: 45vmax; height: 45vmax;
    top: 10vh; right: -15vmax;
    background: var(--aurora-2);
    animation: drift-b 34s var(--ease) infinite alternate;
}

.aurora-blob--c {
    width: 60vmax; height: 60vmax;
    bottom: -25vmax; left: 20vw;
    background: var(--aurora-3);
    animation: drift-c 40s var(--ease) infinite alternate;
}

@keyframes drift-a {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(8vw, 6vh, 0) scale(1.1); }
}
@keyframes drift-b {
    0%   { transform: translate3d(0, 0, 0) scale(1.05); }
    100% { transform: translate3d(-10vw, 4vh, 0) scale(0.95); }
}
@keyframes drift-c {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-6vw, -8vh, 0) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .aurora-blob { animation: none; }
}

/* ============================================================
   Shell
   ============================================================ */

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--shell-pad);
}

/* ============================================================
   Header
   ============================================================ */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in oklab, var(--bg) 65%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid var(--hairline);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 0;
    gap: 1rem;
}

.logo {
    font-family: var(--display);
    font-size: clamp(1.25rem, 1.6vw + 0.6rem, 1.6rem);
    font-weight: 600;
    color: var(--text-strong);
    text-decoration: none;
    letter-spacing: -0.02em;
    font-variation-settings: "opsz" 96;
    transition: opacity 0.2s var(--ease);
}

.logo:hover { opacity: 0.75; }

/* Theme toggle */
.theme-toggle {
    appearance: none;
    border: 1px solid var(--hairline);
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--hairline-strong);
    transform: rotate(-12deg);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   Layout
   ============================================================ */

.main-layout {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 320px);
    gap: clamp(2rem, 4vw, 4rem);
    padding: clamp(1rem, 1.6vw, 1.75rem) 0 6rem;
    align-items: start;
}

.content { min-width: 0; grid-column: 1; grid-row: 1; }
.sidebar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ============================================================
   Hero — left-aligned, editorial
   ============================================================ */

.hero {
    margin-bottom: clamp(2rem, 3.5vw, 3rem);
    padding: 0;
    text-align: left;
}

.hero::before {
    content: "01 / Field notes";
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    margin-bottom: 1rem;
    background: var(--surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hero-title {
    font-family: var(--display);
    font-size: clamp(2rem, 4.2vw, 3.5rem);
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.1;
    padding-bottom: 0.08em;
    letter-spacing: -0.028em;
    font-variation-settings: "opsz" 144;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--text-strong) 0%, var(--text-strong) 55%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-description {
    font-size: clamp(1rem, 0.4vw + 0.95rem, 1.15rem);
    color: var(--text-muted);
    max-width: 52ch;
    line-height: 1.55;
}

/* ============================================================
   Article cards — frosted glass, asymmetric
   ============================================================ */

.articles-grid {
    display: grid;
    gap: 1.25rem;
}

.article-card {
    position: relative;
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: clamp(1.5rem, 2.5vw, 2.25rem);
    transition: background 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease);
    overflow: hidden;
}

.article-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, var(--hairline-strong), transparent 40%, transparent 70%, var(--hairline-strong));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.35s var(--ease);
}

.article-card:hover {
    background: var(--surface-strong);
    border-color: var(--hairline-strong);
    transform: translateY(-3px);
}

.article-card:hover::before { opacity: 1; }

.article-card-title {
    margin-bottom: 0.6rem;
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: -0.018em;
    line-height: 1.15;
    font-variation-settings: "opsz" 36;
}

.article-card-title a {
    color: var(--text-strong);
    text-decoration: none;
    font-size: clamp(1.35rem, 1.2vw + 1rem, 1.7rem);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    padding-bottom: 2px;
    transition: background-size 0.4s var(--ease), color 0.25s var(--ease);
}

.article-card-title a:hover {
    color: var(--accent);
    background-size: 100% 1px;
}

.article-card-meta {
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.article-card-excerpt {
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 1.25rem;
    font-size: 0.97rem;
}

.article-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ============================================================
   Tags — hairline pills, no solid blue
   ============================================================ */

.tag,
.article-card-tags .tag {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--hairline);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.tag::before { content: "#"; opacity: 0.55; margin-right: 1px; }

.tag:hover,
.article-card-tags .tag:hover {
    color: var(--text-strong);
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 10%, transparent);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ============================================================
   Sidebar widgets — quieter glass
   ============================================================ */

.sidebar h3 {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 1rem;
    font-weight: 500;
}

.widget {
    padding: 1.25rem;
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
}

.recent-posts { list-style: none; }

.recent-posts li {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.recent-posts li:first-child { padding-top: 0; }
.recent-posts li:last-child { border-bottom: none; padding-bottom: 0; }

.recent-posts a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    flex: 1;
    transition: color 0.2s var(--ease);
}

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

.recent-posts small {
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.72rem;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

/* Ad placeholders — translucent dashed glass */
.ad-placeholder {
    background: transparent;
    border: 1px dashed var(--hairline-strong);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-faint);
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.ad-placeholder strong {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
}

.ad-placeholder:hover { border-color: var(--accent); color: var(--text-muted); }

.ad-space {
    min-height: 250px;
    contain: layout style paint;
}

/* ============================================================
   Single article
   ============================================================ */

.content > .article {
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: clamp(1.75rem, 4vw, 3.5rem);
    max-width: 760px;
}

.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--hairline);
}

.article-title {
    font-family: var(--display);
    font-size: clamp(2rem, 3vw + 1rem, 3.25rem);
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 1.25rem;
    line-height: 1.08;
    letter-spacing: -0.022em;
    font-variation-settings: "opsz" 144;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.article-excerpt {
    font-size: clamp(1.05rem, 0.4vw + 0.95rem, 1.2rem);
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.55;
    font-style: italic;
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

.article-content h2 {
    font-family: var(--display);
    font-size: clamp(1.5rem, 1.5vw + 1rem, 2rem);
    margin: 3rem 0 1rem;
    color: var(--text-strong);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.article-content h3 {
    font-family: var(--display);
    font-size: clamp(1.2rem, 0.8vw + 1rem, 1.45rem);
    margin: 2.25rem 0 0.85rem;
    color: var(--text-strong);
    font-weight: 600;
    letter-spacing: -0.012em;
}

.article-content p { margin-bottom: 1.5rem; }

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.article-content li { margin-bottom: 0.5rem; }
.article-content li::marker { color: var(--accent); }

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in oklab, var(--accent) 50%, transparent);
    transition: text-decoration-color 0.2s var(--ease);
}

.article-content a:hover { text-decoration-color: var(--accent); }

.article-content code {
    background: var(--surface-strong);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.88em;
    border: 1px solid var(--hairline);
    color: var(--text-strong);
}

.article-content pre {
    background: var(--bg-deep);
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--hairline);
    font-size: 0.92rem;
    line-height: 1.6;
}

.article-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text);
}

.article-content blockquote {
    border-left: 2px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-muted);
    font-family: var(--display);
    font-size: 1.15rem;
    line-height: 1.5;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
    border-top: 1px solid var(--hairline);
    padding: 3rem 0;
    margin-top: 5rem;
    text-align: center;
    background: transparent;
}

.footer-content p {
    color: var(--text-faint);
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
}

.footer-content p:first-child {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .sidebar {
        grid-column: 1;
        position: static;
        order: 2;
    }
}

@media (max-width: 720px) {
    .hero-title {
        white-space: normal;
        font-size: clamp(2rem, 7vw, 2.6rem);
    }
}

@media (max-width: 560px) {
    .header-content { padding: 0.85rem 0; }
    .hero::before { font-size: 0.7rem; }
    .article-card { padding: 1.25rem; }
    .content > .article { padding: 1.5rem; border-radius: var(--radius); }
}

/* ============================================================
   Performance / containment
   ============================================================ */

.article-card { contain: layout style paint; }
