:root {
    --wine-950: #321018;
    --wine-900: #4a1020;
    --wine-800: #651226;
    --wine-700: #7f1730;
    --crimson: #a30e2d;
    --crimson-bright: #c5163b;
    --gold: #e0aa35;
    --gold-soft: #f5dfaa;
    --ivory: #fffaf1;
    --paper: #fffdf9;
    --sand: #f3ece1;
    --sand-2: #e7ddcf;
    --ink: #211a18;
    --ink-soft: #5e5450;
    --ink-muted: #776b66;
    --line: #e3d8cc;
    --green: #16835b;
    --white: #fff;
    --shadow-sm: 0 2px 8px rgba(50, 16, 24, .07);
    --shadow-md: 0 14px 36px rgba(50, 16, 24, .11);
    --shadow-lg: 0 28px 70px rgba(50, 16, 24, .2);
    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 28px;
    --shell: 1180px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: var(--ivory);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.dialog-open { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, .brand-copy strong, .word-card-title, .detail-title, .entry-title {
    font-family: Georgia, "Times New Roman", serif;
}

h1, h2, h3 { text-wrap: balance; }

.site-shell {
    width: min(var(--shell), calc(100% - 40px));
    margin-inline: auto;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    transform: translateY(-160%);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--white);
    background: var(--wine-950);
    font-weight: 750;
    text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
    outline: 3px solid #1678c2;
    outline-offset: 3px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 19px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.15;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button-primary { color: var(--white); background: var(--crimson); box-shadow: 0 8px 20px rgba(163, 14, 45, .2); }
.button-primary:hover { background: var(--wine-700); box-shadow: 0 10px 24px rgba(163, 14, 45, .28); }
.button-secondary { color: var(--wine-800); background: var(--white); border-color: var(--sand-2); box-shadow: var(--shadow-sm); }
.button-secondary:hover { border-color: var(--wine-700); }
.button-quiet { min-height: 42px; color: var(--wine-800); background: transparent; border-color: var(--sand-2); }
.button-quiet:hover { background: var(--sand); }
.button-dark { color: var(--white); border-color: rgba(255, 255, 255, .3); }
.button-dark:hover { background: rgba(255, 255, 255, .1); }
.button-gold { color: var(--wine-950); background: var(--gold); box-shadow: 0 10px 28px rgba(224, 170, 53, .25); }
.button-gold:hover { background: #efbe52; }

.section-kicker,
.eyebrow,
.search-card-kicker {
    margin-bottom: 8px;
    color: var(--crimson);
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.section-kicker-light { color: var(--gold-soft); }

/* Header */
.site-header {
    position: relative;
    z-index: 20;
    color: var(--white);
    background: var(--wine-950);
    border-top: 5px solid var(--gold);
}

.site-header::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -5px;
    left: 0;
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--crimson) 0 22px, var(--gold) 22px 29px, var(--ivory) 29px 38px, var(--wine-950) 38px 54px);
}

.header-inner {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand img { flex: 0 0 auto; border-radius: 15px; }
.brand-copy { display: grid; line-height: 1.08; }
.brand-copy strong { color: var(--gold-soft); font-size: 1.5rem; letter-spacing: .03em; }
.brand-copy span { margin-top: 4px; color: rgba(255, 255, 255, .74); font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.primary-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.primary-nav a {
    padding: 9px 13px;
    border-radius: 999px;
    color: rgba(255, 255, 255, .82);
    font-size: .91rem;
    font-weight: 700;
    text-decoration: none;
}

.primary-nav a:hover { color: var(--white); background: rgba(255, 255, 255, .08); }
.primary-nav .nav-cta { margin-left: 5px; color: var(--wine-950); background: var(--gold); }
.primary-nav .nav-cta:hover { color: var(--wine-950); background: #efbe52; }

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    color: var(--white);
    background:
        radial-gradient(circle at 8% 20%, rgba(224, 170, 53, .18), transparent 30%),
        radial-gradient(circle at 94% 78%, rgba(197, 22, 59, .28), transparent 33%),
        linear-gradient(135deg, var(--wine-950), var(--wine-800) 62%, #8e1831);
}

.hero-pattern {
    position: absolute;
    inset: 0;
    opacity: .11;
    background-image:
        linear-gradient(45deg, transparent 45%, var(--gold) 45% 55%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, var(--gold) 45% 55%, transparent 55%);
    background-size: 42px 42px;
    mask-image: linear-gradient(90deg, transparent 0, #000 30%, #000 100%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr);
    gap: clamp(40px, 6vw, 82px);
    align-items: center;
    padding-block: clamp(58px, 8vw, 102px) clamp(76px, 9vw, 118px);
}

.eyebrow { color: var(--gold-soft); }
.hero h1 { margin-bottom: 22px; font-size: clamp(3rem, 6.3vw, 5.75rem); line-height: .96; letter-spacing: -.045em; }
.hero h1 span { color: var(--gold); font-style: italic; font-weight: 500; }
.hero-lead { max-width: 660px; margin-bottom: 30px; color: rgba(255, 255, 255, .82); font-size: clamp(1rem, 1.5vw, 1.18rem); }

.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.hero-stats div { display: grid; }
.hero-stats strong { color: var(--white); font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; line-height: 1.1; }
.hero-stats span { color: rgba(255, 255, 255, .65); font-size: .76rem; font-weight: 700; }

.search-card {
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--radius-lg);
    color: var(--ink);
    background: rgba(255, 253, 249, .98);
    box-shadow: var(--shadow-lg);
}

.search-card-kicker { display: block; }
.search-card h2 { margin-bottom: 24px; font-size: clamp(1.6rem, 3vw, 2.15rem); line-height: 1.12; }
.search-form { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-form input {
    width: 100%;
    min-height: 58px;
    padding: 14px 18px 14px 49px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    background: var(--white);
    outline: none;
}
.search-form input:focus { border-color: var(--crimson); box-shadow: 0 0 0 4px rgba(163, 14, 45, .11); }
.search-field-icon { position: absolute; top: 18px; left: 18px; z-index: 1; color: var(--ink-muted); pointer-events: none; }
.search-field-icon svg { fill: none; stroke: currentColor; stroke-width: 2; }
.search-form .button { min-width: 104px; }
.search-hint { margin: 13px 5px 0; color: var(--ink-muted); font-size: .82rem; }

/* Browse */
.browse-section { position: relative; z-index: 3; margin-top: -42px; }
.browse-panel { padding: clamp(24px, 4vw, 36px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-md); }
.browse-heading, .results-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.browse-heading { margin-bottom: 26px; }
.browse-heading h2, .results-heading h2 { margin-bottom: 0; font-size: clamp(1.8rem, 3vw, 2.55rem); line-height: 1.1; }

.connection-status { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); font-size: .83rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(224, 170, 53, .14); }
.status-dot.is-online { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 131, 91, .12); }
.status-dot.is-offline { background: var(--crimson); box-shadow: 0 0 0 4px rgba(163, 14, 45, .12); }

.filter-group + .filter-group { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.filter-label-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.filter-label-row h3 { margin: 0; font-family: inherit; font-size: .82rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.filter-label-row span { display: none; color: var(--ink-muted); font-size: .72rem; }

.chip-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 3px 2px 7px; scrollbar-width: thin; scrollbar-color: var(--sand-2) transparent; }
.filter-chip {
    flex: 0 0 auto;
    min-width: 43px;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
    background: var(--white);
    cursor: pointer;
    font-weight: 720;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}
.filter-chip:hover { color: var(--wine-800); border-color: #c8a7ad; transform: translateY(-1px); }
.filter-chip[aria-pressed="true"] { color: var(--white); border-color: var(--crimson); background: var(--crimson); box-shadow: 0 5px 14px rgba(163, 14, 45, .2); }

/* Results */
.results-section { padding-block: clamp(58px, 8vw, 96px); }
.results-heading { margin-bottom: 28px; }
.results-summary { margin: 10px 0 0; color: var(--ink-muted); }
.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }

.word-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.word-card:hover { transform: translateY(-4px); border-color: #d3bdc1; box-shadow: var(--shadow-md); }
.word-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(145deg, #ede3d5, #f8f3eb); }
.word-image { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.word-card:hover .word-image { transform: scale(1.025); }
.word-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: rgba(101, 18, 38, .62); }
.word-placeholder-mark { display: grid; width: 72px; height: 72px; place-items: center; border: 1px solid rgba(101, 18, 38, .13); border-radius: 50%; background: rgba(255, 255, 255, .45); font-family: Georgia, serif; font-size: 2rem; font-weight: 700; }
.word-badge { position: absolute; top: 14px; left: 14px; padding: 6px 10px; border-radius: 999px; color: var(--white); background: rgba(50, 16, 24, .88); font-size: .66rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(8px); }
.media-pills { position: absolute; right: 13px; bottom: 13px; display: flex; gap: 6px; }
.media-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: var(--wine-950); background: rgba(255, 255, 255, .9); font-size: .68rem; font-weight: 800; box-shadow: var(--shadow-sm); }
.word-card-body { padding: 20px; }
.word-category { margin-bottom: 5px; color: var(--crimson); font-size: .72rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.word-card-title { margin-bottom: 3px; font-size: 1.62rem; line-height: 1.2; }
.word-card-title a { color: var(--ink); text-decoration: none; }
.word-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.word-meaning { margin-bottom: 12px; color: var(--wine-700); font-weight: 780; }
.word-note { display: -webkit-box; min-height: 3.25em; margin-bottom: 16px; overflow: hidden; color: var(--ink-soft); font-size: .9rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.word-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.media-status { color: var(--ink-muted); font-size: .74rem; }
.entry-link { position: relative; z-index: 2; color: var(--crimson); font-size: .78rem; font-weight: 850; text-decoration: none; }
.entry-link:hover { text-decoration: underline; }

.load-more-wrap { display: flex; justify-content: center; margin-top: 34px; }
.empty-state, .error-state { grid-column: 1 / -1; padding: 54px 24px; border: 1px dashed var(--sand-2); border-radius: var(--radius); text-align: center; background: rgba(255, 255, 255, .5); }
.empty-state h3, .error-state h3 { margin-bottom: 8px; font-size: 1.55rem; }
.empty-state p, .error-state p { max-width: 540px; margin: 0 auto; color: var(--ink-muted); }

.skeleton-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.skeleton-media { aspect-ratio: 16 / 10; }
.skeleton-body { padding: 20px; }
.skeleton-line { height: 13px; margin-bottom: 11px; border-radius: 999px; }
.skeleton-line:nth-child(1) { width: 35%; }
.skeleton-line:nth-child(2) { width: 68%; height: 22px; }
.skeleton-line:nth-child(3) { width: 86%; }
.skeleton-media, .skeleton-line { background: linear-gradient(90deg, #eee5da 20%, #f8f3ed 42%, #eee5da 64%); background-size: 300% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -180% 0; } }

/* Story and CTA */
.story-section { padding-block: clamp(58px, 8vw, 98px); border-top: 1px solid var(--line); background: var(--sand); }
.story-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 20px; }
.story-card { min-height: 270px; padding: clamp(24px, 3vw, 34px); border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 253, 249, .72); }
.story-card-main { color: var(--white); background: linear-gradient(145deg, var(--wine-950), var(--wine-700)); border-color: transparent; }
.story-card h2 { margin-bottom: 16px; font-size: clamp(2rem, 3vw, 2.8rem); line-height: 1.05; }
.story-card h3 { margin-top: 36px; margin-bottom: 12px; font-size: 1.5rem; }
.story-card p { color: var(--ink-soft); }
.story-card-main p { color: rgba(255, 255, 255, .77); }
.story-card-main .section-kicker { color: var(--gold-soft); }
.feature-number { color: var(--crimson); font-family: Georgia, serif; font-size: 2.1rem; }
.text-link { display: inline-flex; gap: 8px; margin-top: 8px; color: var(--gold); font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.contribute-callout { padding-block: 50px; color: var(--white); background: var(--crimson); }
.contribute-inner { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.contribute-inner h2 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; }
.contribute-inner p:not(.section-kicker) { max-width: 760px; margin-bottom: 0; color: rgba(255, 255, 255, .82); }
.contribute-inner .button { flex: 0 0 auto; }

/* Dialog and entry detail */
.word-dialog {
    width: min(900px, calc(100% - 28px));
    max-height: calc(100vh - 30px);
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    color: var(--ink);
    background: transparent;
    box-shadow: var(--shadow-lg);
}
.word-dialog::backdrop { background: rgba(31, 13, 18, .72); backdrop-filter: blur(5px); }
.dialog-card { position: relative; overflow: hidden; border-radius: var(--radius-lg); background: var(--paper); }
.dialog-close { position: sticky; top: 14px; left: calc(100% - 58px); z-index: 4; display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: -44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255, 255, 255, .93); cursor: pointer; font-size: 1.7rem; line-height: 1; box-shadow: var(--shadow-sm); }
.detail-content { min-height: 300px; }
.detail-media {
    display: grid;
    min-height: 220px;
    max-height: min(68vh, 720px);
    overflow: hidden;
    place-items: center;
    background: var(--sand);
}
.detail-media img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(68vh, 720px);
    object-fit: contain;
}
.detail-media video {
    width: 100%;
    height: auto;
    max-height: min(68vh, 720px);
    object-fit: contain;
}
.detail-media-switchable {
    position: relative;
    aspect-ratio: 16 / 9;
}
.detail-media-switchable img,
.detail-media-switchable video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}
.detail-media-switchable video { background: #000; }
.detail-media-switchable > [hidden] { display: none !important; }
.detail-media-switch {
    display: flex;
    width: fit-content;
    max-width: calc(100% - 24px);
    gap: 4px;
    margin: 14px auto 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--ivory);
}
.detail-media-switch .button {
    min-width: 86px;
    min-height: 44px;
    padding: 8px 16px;
    border-color: transparent;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
}
.detail-media-switch .button:hover { background: var(--sand); }
.detail-media-switch .button[aria-pressed="true"] {
    background: var(--wine-700);
    color: var(--white);
}
.detail-main { padding: clamp(25px, 5vw, 48px); }
.detail-category { margin-bottom: 10px; color: var(--crimson); font-size: .74rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.detail-title { margin-bottom: 4px; font-size: clamp(2.4rem, 6vw, 4.5rem); line-height: .98; }
.detail-meaning { margin-bottom: 25px; color: var(--wine-700); font-size: 1.2rem; font-weight: 780; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block: 22px; }
.detail-field { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ivory); }
.detail-field dt { margin-bottom: 4px; color: var(--ink-muted); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.detail-field dd { margin: 0; }
.detail-example { margin-block: 22px; padding: 20px 22px; border-left: 4px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--sand); }
.detail-example p:last-child { margin-bottom: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.detail-audio { width: 100%; margin-top: 18px; }
.related-block { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.related-block h3 { margin-bottom: 14px; }
.related-links { display: flex; flex-wrap: wrap; gap: 8px; }
.related-link { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--wine-800); background: var(--white); font-weight: 720; text-decoration: none; }
.related-link:hover { border-color: var(--wine-700); }

/* Content pages */
.page-hero { position: relative; overflow: hidden; padding-block: clamp(54px, 8vw, 92px); color: var(--white); background: linear-gradient(135deg, var(--wine-950), var(--wine-700)); }
.page-hero::after { content: ""; position: absolute; inset: 0; opacity: .1; background-image: linear-gradient(45deg, transparent 45%, var(--gold) 45% 55%, transparent 55%); background-size: 44px 44px; }
.page-hero-inner { position: relative; z-index: 1; max-width: 830px; }
.page-hero h1 { margin-bottom: 18px; font-size: clamp(2.8rem, 7vw, 5.5rem); line-height: .98; letter-spacing: -.035em; }
.page-hero p { max-width: 720px; margin-bottom: 0; color: rgba(255, 255, 255, .8); font-size: 1.1rem; }
.breadcrumb { margin-bottom: 20px; color: var(--gold-soft); font-size: .82rem; font-weight: 750; }
.breadcrumb a { color: inherit; }
.content-page .content-layout { padding-block: clamp(48px, 8vw, 88px); }
.content-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(220px, 1fr); gap: clamp(36px, 7vw, 80px); align-items: start; }
.prose { font-size: 1.02rem; }
.prose h2 { margin: 2.1em 0 .65em; color: var(--wine-900); font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.16; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.7em 0 .55em; font-size: 1.35rem; }
.prose p, .prose ul, .prose ol { color: var(--ink-soft); }
.prose a { color: var(--crimson); text-underline-offset: 3px; }
.prose a.button-primary { color: var(--white); text-decoration: none; }
.prose blockquote { margin: 28px 0; padding: 22px 25px; border-left: 4px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--wine-900); background: var(--sand); font-family: Georgia, serif; font-size: 1.2rem; }
.page-aside { position: sticky; top: 26px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.page-aside h2 { margin-bottom: 12px; font-size: 1.35rem; }
.page-aside p { color: var(--ink-soft); font-size: .9rem; }
.page-aside .button { width: 100%; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-block: 24px; }
.info-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.info-card h3 { margin: 0 0 8px; }
.info-card p:last-child { margin-bottom: 0; }

.form-card { padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.form-grid { display: grid; gap: 18px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: grid; gap: 7px; }
.form-field label { font-weight: 780; }
.form-field small { color: var(--ink-muted); }
.form-field input, .form-field textarea, .form-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: var(--white);
}
.form-field textarea { min-height: 150px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--crimson); outline: 3px solid rgba(163, 14, 45, .1); }
.form-status { min-height: 26px; margin: 0; color: var(--ink-soft); }
.form-status.is-error { color: #a30e2d; }
.form-status.is-success { color: var(--green); }

/* Server-rendered word page */
.entry-page .page-main { padding-block: clamp(44px, 7vw, 84px); }
.entry-shell { max-width: 960px; }
.entry-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-md); }
.entry-media { display: grid; min-height: 240px; max-height: min(75vh, 720px); overflow: hidden; place-items: center; background: var(--sand); }
.entry-media img { width: auto; height: auto; max-width: 100%; max-height: min(75vh, 720px); object-fit: contain; }
.entry-media video { width: 100%; height: auto; max-height: min(75vh, 720px); object-fit: contain; }
.entry-body { padding: clamp(26px, 6vw, 58px); }
.entry-category { margin-bottom: 10px; color: var(--crimson); font-size: .76rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.entry-title { margin-bottom: 5px; font-size: clamp(3rem, 8vw, 6.1rem); line-height: .93; letter-spacing: -.045em; }
.entry-meaning { margin-bottom: 30px; color: var(--wine-700); font-size: clamp(1.2rem, 3vw, 1.55rem); font-weight: 780; }
.entry-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block: 26px; }
.entry-detail { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ivory); }
.entry-detail dt { margin-bottom: 4px; color: var(--ink-muted); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.entry-detail dd { margin: 0; }
.entry-example { margin-block: 22px; padding: 22px 25px; border-left: 4px solid var(--gold); background: var(--sand); }
.entry-example p:last-child { margin-bottom: 0; }
.entry-audio { width: 100%; margin-block: 22px; }
.entry-related { margin-top: 38px; padding-top: 28px; border-top: 1px solid var(--line); }
.entry-related h2 { margin-bottom: 15px; font-size: 1.8rem; }

/* Shared content-page and server-rendered entry components */
.nav-wrap,
.site-header__inner {
    display: flex;
    width: min(var(--shell), calc(100% - 40px));
    min-height: 78px;
    margin-inline: auto;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}
.site-header-compact .brand-copy strong,
.site-header--compact .brand-copy strong { font-size: 1.3rem; }
.brand-copy small { margin-top: 4px; color: rgba(255, 255, 255, .72); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.primary-nav [aria-current="page"] { color: var(--wine-950); background: var(--gold); }
.prose-narrow { position: relative; z-index: 1; max-width: 860px; }
.page-hero > .site-shell { position: relative; z-index: 1; }
.page-lead { max-width: 760px; margin-bottom: 0; color: rgba(255, 255, 255, .82); font-size: clamp(1.02rem, 2vw, 1.2rem); }
.page-meta { margin: 18px 0 0; color: var(--gold-soft); font-size: .86rem; font-weight: 700; }
.content-page .content-layout:not(.content-layout-form) { display: block; max-width: 1020px; }
.content-layout-form { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); }
.content-card { padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.feature-grid { display: grid; gap: 15px; margin-block: 24px; }
.feature-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ivory); }
.mini-card-icon { color: var(--crimson); font-family: Georgia, serif; font-size: 1.7rem; }
.mini-card h3 { margin: 14px 0 6px; }
.mini-card p { margin: 0; font-size: .9rem; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 34px; padding: 26px; border-radius: var(--radius); color: var(--white); background: linear-gradient(135deg, var(--wine-950), var(--wine-700)); }
.callout h2 { margin: 0 0 6px; color: var(--white); }
.callout p { margin: 0; color: rgba(255, 255, 255, .76); }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.split-grid h2 { margin-top: 0; }
.social-link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
.social-link-grid a { display: grid; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--ivory); text-decoration: none; }
.social-link-grid a:hover { border-color: var(--wine-700); transform: translateY(-1px); }
.social-link-grid span { margin-top: 3px; color: var(--ink-muted); font-size: .85rem; }
.notice { margin-block: 24px; padding: 18px 20px; border-left: 4px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--sand); }
.notice p:last-child { margin-bottom: 0; }
.legal-copy code { padding: 2px 5px; border-radius: 4px; background: var(--sand); font-size: .9em; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin-bottom: 8px; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.public-form { display: grid; gap: 19px; }
.form-row { display: grid; gap: 7px; }
.form-row label { font-weight: 780; }
.label-note { color: var(--ink-muted); font-size: .78rem; font-weight: 500; }
.form-row input, .form-row textarea, .form-row select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--white); }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--crimson); outline: 3px solid rgba(163, 14, 45, .1); }
.form-row small { color: var(--ink-muted); text-align: right; }
.form-trust { display: flex; gap: 10px; padding: 14px; border-radius: var(--radius-sm); color: var(--green); background: rgba(22, 131, 91, .08); }
.form-trust p { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.form-actions { display: flex; justify-content: flex-start; }
.contribution-guide { align-self: start; }
.number-list { display: grid; gap: 18px; padding: 0; counter-reset: guide; list-style: none; }
.number-list li { display: grid; padding-left: 0; }
.number-list strong { color: var(--wine-900); }
.number-list span { color: var(--ink-muted); font-size: .9rem; }

.page-shell { width: min(1040px, calc(100% - 40px)); margin-inline: auto; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; color: var(--ink-muted); font-size: .85rem; }
.breadcrumbs a { color: var(--crimson); }
.entry-page .entry-detail { overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow-md); }
.entry-detail__media {
    display: grid;
    min-height: clamp(240px, 45vw, 560px);
    max-height: min(75vh, 720px);
    overflow: hidden;
    place-items: center;
    background: var(--sand);
}
.entry-detail__media img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(75vh, 720px);
    object-fit: contain;
}
.entry-detail__media video {
    width: 100%;
    height: auto;
    max-height: min(75vh, 720px);
    object-fit: contain;
}
.entry-media-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: var(--wine-700); background: linear-gradient(145deg, #eadfce, #f8f2e8); }
.entry-media-placeholder span { display: grid; width: 100px; height: 100px; place-items: center; border: 1px solid rgba(101, 18, 38, .13); border-radius: 50%; background: rgba(255, 255, 255, .5); font-family: Georgia, serif; font-size: 3rem; font-weight: 700; }
.entry-detail__copy { padding: clamp(28px, 6vw, 60px); }
.entry-kicker { display: inline-flex; margin-bottom: 12px; color: var(--crimson); font-size: .75rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.entry-detail__copy > h1 { margin-bottom: 5px; font-size: clamp(3rem, 9vw, 6.4rem); line-height: .92; letter-spacing: -.045em; }
.entry-meaning { margin-bottom: 28px; color: var(--wine-700); font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 780; }
.entry-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block: 25px; }
.entry-facts > div { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ivory); }
.entry-facts dt { margin-bottom: 4px; color: var(--ink-muted); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.entry-facts dd { margin: 0; }
.entry-section { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.entry-section h2 { margin-bottom: 12px; font-size: 1.65rem; }
.entry-example { padding: 18px 20px; border-left: 4px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--sand); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tag-list li { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--ivory); }
.entry-media-controls { display: grid; gap: 18px; }
.entry-media-controls audio { width: 100%; }
.entry-media-controls video { width: 100%; max-height: 540px; border-radius: var(--radius-sm); background: #000; }
.media-label { margin-bottom: 6px; font-weight: 780; }
.section-block { margin-top: 58px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.related-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--paper); text-decoration: none; }
.related-card:hover { border-color: var(--wine-700); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.related-card img, .related-card__placeholder { display: grid; width: 100%; aspect-ratio: 16 / 10; place-items: center; object-fit: cover; color: var(--wine-700); background: var(--sand); font-family: Georgia, serif; font-size: 2rem; }
.related-card > span:last-child { display: grid; padding: 13px; }
.related-card small { color: var(--ink-muted); }
.entry-page .contribute-callout { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-top: 54px; padding: 30px; border-radius: var(--radius); }
.entry-page .contribute-callout h2 { margin-bottom: 5px; }
.entry-page .contribute-callout p { margin-bottom: 0; }
.button--primary { color: var(--white); background: var(--crimson); box-shadow: 0 8px 20px rgba(163, 14, 45, .2); }
.button--secondary { color: var(--wine-800); background: var(--white); border-color: var(--sand-2); }
.site-footer__inner { display: grid; width: min(var(--shell), calc(100% - 40px)); margin-inline: auto; grid-template-columns: 1fr auto; gap: 26px 50px; align-items: start; padding-block: 46px 24px; }
.site-footer__inner nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.site-footer__inner nav a { color: rgba(255,255,255,.74); text-decoration: none; }
.site-footer__legal { grid-column: 1 / -1; margin: 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: .8rem; }
.error-page { display: grid; min-height: 100vh; place-items: center; background: var(--sand); }
.error-shell { width: min(640px, calc(100% - 32px)); text-align: center; }
.brand--centered { justify-content: center; margin-bottom: 22px; color: var(--wine-900); }
.brand--centered small { display: block; color: var(--ink-muted); }
.error-card { padding: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-md); }
.error-card h1 { font-size: clamp(2.4rem, 7vw, 4rem); }

/* Cookie choice */
.cookie-banner,
.consent-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    width: min(560px, calc(100% - 40px));
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--radius);
    color: var(--white);
    background: rgba(33, 19, 23, .97);
    box-shadow: var(--shadow-lg);
}
.cookie-banner strong, .consent-banner strong { display: block; margin-bottom: 4px; }
.cookie-banner p, .consent-banner p { margin-bottom: 14px; color: rgba(255, 255, 255, .76); font-size: .86rem; }
.cookie-banner a, .consent-banner a { color: var(--gold-soft); }
.cookie-actions, .consent-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.cookie-actions .button, .consent-actions .button { min-height: 40px; padding: 9px 16px; }

/* Footer */
.site-footer { color: rgba(255, 255, 255, .76); background: var(--wine-950); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 42px; padding-block: 56px 40px; }
.brand-footer .brand-copy strong { color: var(--gold-soft); }
.footer-brand p { max-width: 360px; margin: 18px 0 0; font-size: .9rem; }
.footer-title { margin-bottom: 14px; color: var(--white); font-family: inherit; font-size: .78rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.footer-links { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.footer-links a, .footer-button { color: rgba(255, 255, 255, .72); background: transparent; border: 0; cursor: pointer; font: inherit; text-decoration: none; }
.footer-links a:hover, .footer-button:hover { color: var(--gold-soft); text-decoration: underline; }
.footer-button { padding: 0; text-align: left; }
.content-page .footer-grid { grid-template-columns: 1fr auto; }
.content-page .footer-grid nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
.content-page .footer-grid nav a, .footer-link-button { color: rgba(255,255,255,.72); background: transparent; border: 0; cursor: pointer; font: inherit; text-decoration: none; }
.content-page .footer-grid nav a:hover, .footer-link-button:hover { color: var(--gold-soft); text-decoration: underline; }
.content-page .footer-brand { color: var(--gold-soft); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.footer-bottom { display: flex; justify-content: space-between; gap: 24px; padding-block: 22px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .78rem; }
.footer-bottom p { margin: 0; }
.noscript-note { padding: 18px; color: var(--white); background: var(--crimson); text-align: center; }

@media (max-width: 980px) {
    .hero-inner { grid-template-columns: 1fr; gap: 38px; }
    .hero-copy { max-width: 780px; }
    .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .story-card-main { grid-column: 1 / -1; }
    .footer-grid { grid-template-columns: 1.5fr repeat(2, 1fr); }
    .footer-grid > :last-child { grid-column: 2; }
    .content-layout { grid-template-columns: 1fr; }
    .page-aside { position: static; }
    .feature-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .site-shell { width: min(100% - 28px, var(--shell)); }
    .nav-wrap, .site-header__inner, .page-shell, .site-footer__inner { width: min(100% - 28px, var(--shell)); }
    .header-inner { min-height: 74px; gap: 14px; }
    .brand img { width: 46px; height: 46px; }
    .brand-copy strong { font-size: 1.28rem; }
    .brand-copy span { font-size: .58rem; }
    .primary-nav { max-width: 52vw; overflow-x: auto; padding-bottom: 4px; }
    .primary-nav a { flex: 0 0 auto; padding: 8px 10px; font-size: .82rem; }
    .primary-nav a:nth-child(2), .primary-nav a:nth-child(3) { display: none; }
    .hero-inner { padding-block: 54px 82px; }
    .hero h1 { font-size: clamp(2.85rem, 14vw, 4.6rem); }
    .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .hero-stats strong { font-size: 1.25rem; }
    .hero-stats span { line-height: 1.25; }
    .search-card { padding: 22px; }
    .search-form { grid-template-columns: 1fr; }
    .search-form .button { width: 100%; }
    .search-field-icon { top: 18px; }
    .browse-section { margin-top: -28px; }
    .browse-panel { padding: 22px 18px; }
    .browse-heading, .results-heading { align-items: flex-start; }
    .connection-status { margin-top: 6px; }
    .filter-label-row span { display: inline; }
    .results-section { padding-block: 52px 68px; }
    .word-grid { grid-template-columns: 1fr; gap: 16px; }
    .word-card { display: grid; grid-template-columns: minmax(118px, 40%) 1fr; }
    .word-media { aspect-ratio: auto; min-height: 200px; }
    .word-card-body { padding: 17px; }
    .word-card-title { font-size: 1.42rem; }
    .word-note { min-height: 0; -webkit-line-clamp: 2; }
    .word-card-footer { display: none; }
    .word-badge { top: 9px; left: 9px; max-width: calc(100% - 18px); overflow: hidden; padding: 5px 7px; text-overflow: ellipsis; white-space: nowrap; }
    .media-pills { right: 8px; bottom: 8px; }
    .media-pill { padding: 4px 6px; font-size: 0; }
    .media-pill span { font-size: .72rem; }
    .story-grid { grid-template-columns: 1fr; }
    .story-card-main { grid-column: auto; }
    .story-card { min-height: 0; }
    .contribute-inner { align-items: flex-start; flex-direction: column; }
    .detail-grid, .entry-details, .field-row, .info-grid { grid-template-columns: 1fr; }
    .entry-facts, .feature-grid-three, .split-grid, .social-link-grid { grid-template-columns: 1fr; }
    .entry-page .contribute-callout, .callout { align-items: flex-start; flex-direction: column; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 32px 20px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-grid > :last-child { grid-column: auto; }
    .footer-bottom { align-items: flex-start; flex-direction: column; gap: 5px; }
    .cookie-banner, .consent-banner { right: 10px; bottom: 10px; width: calc(100% - 20px); padding: 17px; }
    .content-page .footer-grid, .site-footer__inner { grid-template-columns: 1fr; }
    .content-page .footer-grid nav { justify-content: flex-start; }
    .site-footer__legal { grid-column: auto; }
}

@media (max-width: 460px) {
    .brand-copy span { display: none; }
    .primary-nav { max-width: 58vw; }
    .content-page .primary-nav a,
    .home-page .primary-nav a { display: none; }
    .content-page .primary-nav a:first-child,
    .home-page .primary-nav .nav-cta { display: inline-flex; }
    .hero-stats { grid-template-columns: 1fr; }
    .hero-stats div { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; }
    .results-heading { flex-direction: column; }
    .word-card { grid-template-columns: 112px 1fr; }
    .word-media { min-height: 180px; }
    .word-placeholder-mark { width: 58px; height: 58px; }
    .word-card-body { padding: 14px; }
    .word-category { font-size: .63rem; }
    .word-card-title { font-size: 1.25rem; }
    .word-meaning { font-size: .88rem; }
    .word-note { font-size: .78rem; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-brand { grid-column: auto; }
    .related-grid { grid-template-columns: 1fr; }
}

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

@media print {
    .site-header, .hero, .browse-section, .site-footer, .cookie-banner, .contribute-callout, .button { display: none !important; }
    body { background: var(--white); }
    .results-section, .content-page, .entry-page { padding: 0; }
    .word-card, .entry-card { break-inside: avoid; box-shadow: none; }
}