/* ==========================================================================
   base.css — structural skeleton shared by every layout.
   Themes own color, texture, and voice through CSS custom properties;
   this file owns rhythm, scale, and anatomy. Loaded after reset.css,
   before the active theme, so themes can override anything here.
   ========================================================================== */

:root {
    --font-mono: ui-monospace, 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
    --measure: 62ch;
}

body {
    font-family: var(--font-main, system-ui, sans-serif);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    font-family: var(--font-heading, var(--font-main, inherit));
    line-height: 1.08;
}

p {
    max-width: var(--measure);
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--accent-color, currentColor);
    outline-offset: 2px;
}

/* --- Page frame ----------------------------------------------------------- */
.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 3.5rem);
}

/* --- Masthead -------------------------------------------------------------- */
.masthead {
    padding-bottom: clamp(1.5rem, 3vw, 3rem);
    margin-bottom: clamp(1.5rem, 3vw, 3rem);
    border-bottom: 1px solid currentColor;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 1.75rem;
}

.masthead h1 {
    font-size: clamp(2.8rem, 8.5vw, 6.5rem);
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    text-wrap: balance;
    max-width: 14ch;
}

.masthead-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.standfirst {
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    max-width: 52ch;
    opacity: 0.88;
}

/* --- Specimen plate: the museum label for the current combo ---------------- */
.specimen-plate {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    padding: 1rem 1.2rem;
    display: grid;
    gap: 0.45rem;
    min-width: 16rem;
    align-self: flex-end;
}

.plate-row {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.plate-row> :first-child {
    opacity: 0.55;
}

.swatch {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.4em;
    background: var(--accent-color, currentColor);
    border: 1px solid currentColor;
    vertical-align: baseline;
}

/* --- Trend card anatomy ---------------------------------------------------- */
.trend-card {
    position: relative;
}

.trend-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.trend-index {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    opacity: 0.55;
    white-space: nowrap;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.trend-card h2 {
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    margin-bottom: 0.35rem;
}

.trend-card p {
    margin-top: 0.75rem;
}

/* --- Grid layout: 12-column editorial rhythm ------------------------------- */
.trend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1.25rem, 2.5vw, 2rem);
    align-items: stretch;
}

.trend-grid .card {
    margin-bottom: 0;
    /* the grid gap owns vertical rhythm here */
}

@media (min-width: 1000px) {
    .trend-grid {
        grid-template-columns: repeat(12, 1fr);
    }

    .trend-grid>.trend-card {
        grid-column: span 4;
    }

    /* Rhythm: 8+4 / 4+4+4 / 6+6 / 4+4+4 / 12 */
    .trend-grid>.trend-card:nth-child(1) {
        grid-column: span 8;
    }

    .trend-grid>.trend-card:nth-child(6),
    .trend-grid>.trend-card:nth-child(7) {
        grid-column: span 6;
    }

    .trend-grid>.trend-card:nth-child(11) {
        grid-column: span 12;
    }

    .trend-grid>.trend-card:nth-child(1) .trend-demo,
    .trend-grid>.trend-card:nth-child(6) .trend-demo,
    .trend-grid>.trend-card:nth-child(7) .trend-demo {
        aspect-ratio: 21 / 9;
    }

    .trend-grid>.trend-card:nth-child(11) .trend-demo {
        aspect-ratio: 5 / 1;
    }
}

/* --- Sidebar layout: table of contents ------------------------------------- */
.toc {
    list-style: none;
    display: grid;
    gap: 0.7rem;
    margin-top: 2rem;
    padding: 0;
}

.toc a {
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
}

.toc-num {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    opacity: 0.5;
}

.sidebar .eyebrow {
    margin-bottom: 1rem;
}

.sidebar h1 {
    font-size: clamp(1.5rem, 2vw, 1.9rem);
}

.sidebar .specimen-plate {
    margin-top: 2.5rem;
    min-width: 0;
    align-self: auto;
}

/* --- Magazine layout: cover ------------------------------------------------- */
.cover {
    min-height: 78vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 1.5rem;
    padding: clamp(1.5rem, 4vw, 4rem);
    border-bottom: 4px solid currentColor;
}

.cover .cover-title {
    font-size: clamp(4rem, 17vw, 13rem);
    letter-spacing: -0.03em;
    line-height: 0.85;
    margin: 0;
    max-width: none;
}

.cover .cover-sub {
    font-size: clamp(1.05rem, 1.8vw, 1.4rem);
    max-width: 46ch;
}

.cover .masthead-row {
    align-items: flex-end;
}

/* Contact sheet: all eleven trends as cover art */
.cover-strip {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.cover-strip a {
    display: block;
}

.cover-strip .trend-demo {
    aspect-ratio: 1;
    margin: 0;
    border-radius: 4px;
}

.cover-strip .trend-demo b {
    display: none;
    /* graphics only at thumbnail size */
}

@media (max-width: 700px) {
    .cover-strip {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Vertical colophon rail */
.rail {
    writing-mode: vertical-rl;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.7;
}

/* --- UI kit ----------------------------------------------------------------- */
.ui-kit {
    margin-top: clamp(2rem, 4vw, 3.5rem);
}

.ui-kit h2 {
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    margin-bottom: 0.3rem;
}

.ui-kit-intro {
    opacity: 0.75;
    margin-bottom: 2rem;
}

.ui-kit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.ui-group h3 {
    font-size: 0.95rem;
    margin-bottom: 1.1rem;
}

.ui-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.ui-stack {
    display: grid;
    gap: 1.1rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field>label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.field input,
.field select {
    width: 100%;
}

.choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Footer ------------------------------------------------------------------ */
.site-footer {
    margin-top: clamp(2.5rem, 5vw, 4.5rem);
    padding-top: 1.75rem;
    border-top: 1px solid currentColor;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.65;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   Trend layer — the layouts practice what the site preaches.
   Everything below keys off currentColor / theme variables, so every
   theme inherits it in its own voice.
   ========================================================================== */

html {
    scroll-behavior: smooth;
    scrollbar-color: var(--accent-color, #888) transparent;
}

::selection {
    background: var(--accent-color, #000);
    color: var(--bg-color, #fff);
}

/* Film grain over everything (under the controls panel) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Display type: mix filled, outlined, and accent words in one headline */
.w-outline {
    /* stroke can't use currentColor here: the fill is transparent, and
       currentColor would resolve to that same transparent */
    -webkit-text-stroke: 0.035em var(--text-color, #888);
    color: transparent;
}

.w-accent {
    color: var(--accent-color, currentColor);
}

.w-italic {
    font-style: italic;
}

/* Marquee ticker */
.ticker {
    overflow: hidden;
    border-block: 1px solid currentColor;
    padding: 0.8rem 0;
    margin-bottom: clamp(1.5rem, 3vw, 3rem);
}

.ticker-track {
    display: flex;
    width: max-content;
    animation: ticker-scroll 30s linear infinite;
}

.ticker-group {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    padding-right: 2.5rem;
    flex: none;
    font-family: var(--font-heading, inherit);
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.ticker-group i {
    font-style: normal;
    color: var(--accent-color, currentColor);
}

@keyframes ticker-scroll {
    to {
        transform: translateX(-50%);
    }
}

.ticker:hover .ticker-track {
    animation-play-state: paused;
}

/* Ghost index numbers behind grid cards */
.ghost-index {
    position: absolute;
    top: 2.4rem;
    right: 1.2rem;
    z-index: 0;
    font-family: var(--font-heading, inherit);
    font-size: clamp(3.5rem, 6vw, 6rem);
    line-height: 1;
    -webkit-text-stroke: 2px var(--text-color, #888);
    color: transparent;
    opacity: 0.18;
    pointer-events: none;
    user-select: none;
}

.trend-grid .trend-meta {
    justify-content: flex-start;
}

.trend-grid .tag-row {
    justify-content: flex-start;
}

.trend-grid .trend-card h2 {
    max-width: 85%;
    position: relative;
    z-index: 1;
}

/* Rotating orbit badge */
.orbit-badge {
    position: absolute;
    top: clamp(0.5rem, 2vw, 2rem);
    right: 0;
    width: clamp(84px, 10vw, 128px);
    aspect-ratio: 1;
    pointer-events: none;
}

.orbit-badge .ring {
    width: 100%;
    height: 100%;
    animation: orbit-spin 18s linear infinite;
}

.orbit-badge .ring text {
    fill: currentColor;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.orbit-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--accent-color, currentColor);
}

@keyframes orbit-spin {
    to {
        transform: rotate(1turn);
    }
}

.masthead {
    position: relative;
}

@media (max-width: 700px) {
    .orbit-badge {
        display: none;
    }
}

/* Scroll reveals (JS adds .js to <html>, observer adds .in) */
.js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.in {
    opacity: 1;
    transform: none;
}

/* Hover lift on cards (themes may override with their own hover voice) */
.trend-card {
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.trend-card:hover {
    transform: translateY(-4px);
}

/* --- Accessibility ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }

    html {
        scroll-behavior: auto;
    }
}
