:root {
  --ink: #17201c;
  --paper: #f3f0e8;
  --paper-deep: #e7e2d5;
  --accent: #e4572e;
  --acid: #c9ef5b;
  --muted: #6f756f;
  --line: rgba(23, 32, 28, 0.17);
  --card: rgba(255, 255, 255, 0.42);
  --shadow: 0 28px 80px rgba(35, 39, 30, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Manrope", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E"); z-index: 10; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.bot-field { position: fixed !important; left: -10000px; top: -10000px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.page-shell { width: min(1320px, calc(100% - 40px)); margin: 0 auto; }

.topbar { height: 92px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; font-weight: 800; letter-spacing: -.04em; text-decoration: none; font-size: 18px; }
.brand > span:last-child span { color: var(--accent); }
.brand-mark { width: 31px; height: 31px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(45deg); }
.brand-mark i { display: block; background: var(--ink); border-radius: 1px 8px 1px 8px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--accent); }
nav { display: flex; align-items: center; gap: 30px; font-size: 13px; font-weight: 600; }
nav a { text-decoration: none; }
.theme-button, .language-button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.language-button { width: auto; min-width: 42px; border-radius: 99px; font: 500 10px "DM Mono"; letter-spacing: .08em; }

.hero { min-height: 640px; padding: 110px 6% 70px; position: relative; overflow: hidden; }
.hero::after { content: "ETYMOLOGIE"; position: absolute; right: -3%; top: 45%; font-family: "DM Mono"; font-size: clamp(70px, 11vw, 160px); color: transparent; -webkit-text-stroke: 1px rgba(23,32,28,.08); transform: rotate(90deg) translateX(30%); transform-origin: right top; letter-spacing: .08em; }
.eyebrow, .section-label { font-family: "DM Mono"; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; font-weight: 500; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.eyebrow > span:first-child { flex: 0 0 34px; width: 34px; height: 2px; background: var(--accent); }
.hero h1 { max-width: 900px; margin: 20px 0; font: 600 clamp(58px, 8vw, 124px)/.86 "Newsreader", serif; letter-spacing: -.065em; }
.hero h1::first-letter { color: var(--accent); }
.hero-copy { max-width: 610px; font-size: clamp(18px, 2vw, 24px); line-height: 1.55; color: #4d554f; }
.search { max-width: 890px; margin-top: 52px; position: relative; z-index: 1; }
.search > label { display: block; font: 500 11px "DM Mono"; letter-spacing: .13em; text-transform: uppercase; margin-bottom: 11px; }
.search-control { padding: 7px; background: #fff; border-radius: 4px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; box-shadow: var(--shadow); border: 1px solid rgba(23,32,28,.09); }
.search-icon { width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; margin-left: 12px; position: relative; }
.search-icon::after { content: ""; width: 8px; height: 2px; background: var(--ink); position: absolute; right: -6px; bottom: -3px; transform: rotate(45deg); }
.search-control input { border: 0; outline: 0; min-width: 0; padding: 15px 10px; color: var(--ink); font: 500 23px "Newsreader"; background: transparent; }
.search-control button { border: 0; background: var(--ink); color: white; padding: 17px 22px; display: flex; align-items: center; gap: 24px; cursor: pointer; font-weight: 700; border-radius: 2px; }
.search-control button:hover { background: var(--accent); }
.search-control button:disabled { cursor: wait; opacity: .72; }

.loading-panel { margin: 0 6% 80px; padding: 50px; text-align: center; border: 1px solid var(--line); background: var(--card); }
.scanner { width: 170px; height: 2px; background: var(--line); margin: 0 auto 30px; overflow: hidden; }
.scanner span { display: block; width: 40%; height: 100%; background: var(--accent); animation: scan 1.2s ease-in-out infinite alternate; }
@keyframes scan { to { transform: translateX(150%); } }
.loading-panel p { font: 600 28px "Newsreader"; margin: 0 0 8px; }
.loading-panel small { color: var(--muted); }

.result { border-top: 1px solid var(--line); padding: 85px 6% 120px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; }
.result-kicker { display: flex; gap: 8px; }
.result-kicker span { border: 1px solid var(--line); border-radius: 99px; padding: 5px 9px; font: 500 10px "DM Mono"; text-transform: uppercase; letter-spacing: .1em; }
.result h2 { font: 600 clamp(64px, 9vw, 130px)/.8 "Newsreader"; letter-spacing: -.06em; margin: 25px 0 18px; }
.pronunciation { font: 400 14px "DM Mono"; letter-spacing: .18em; color: var(--muted); }
.lede { max-width: 850px; font: 500 clamp(24px, 3vw, 38px)/1.3 "Newsreader"; margin: 60px 0 80px; }

.dna-band { padding: 32px 0 45px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.morpheme-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; align-items: stretch; }
.morpheme { flex: 1 1 220px; padding: 22px; background: var(--ink); color: white; position: relative; }
.morpheme:nth-child(even) { background: var(--accent); }
.morpheme .form { font: 600 36px "Newsreader"; }
.morpheme .role { font: 500 9px "DM Mono"; text-transform: uppercase; letter-spacing: .12em; opacity: .6; }
.morpheme p { margin: 14px 0 0; font-size: 13px; line-height: 1.55; opacity: .85; }
.morpheme .sync { position: absolute; top: 12px; right: 12px; font-size: 9px; border: 1px solid rgba(255,255,255,.4); padding: 3px 5px; }

.story-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-top: 16px; }
.story-card { min-height: 370px; padding: 42px; position: relative; border: 1px solid var(--line); background: var(--card); }
.story-card h3 { font: 600 clamp(27px, 3vw, 43px)/1.08 "Newsreader"; margin: 55px 0 20px; max-width: 600px; }
.story-card p { line-height: 1.65; color: #515953; }
.card-number { position: absolute; right: 24px; top: 20px; font: 400 12px "DM Mono"; color: var(--muted); }
.origin-card { background: var(--acid); border-color: transparent; }
.route { margin-top: 30px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font: 500 11px "DM Mono"; }
.route span:not(:last-child)::after { content: "→"; margin-left: 8px; opacity: .5; }
.family { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 30px; }
.family span { border-bottom: 1px solid var(--ink); padding: 5px 0; margin-right: 12px; font-size: 12px; }

.timeline-section { margin-top: 90px; }
.timeline { position: relative; margin-top: 35px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 9px; bottom: 20px; width: 1px; background: var(--line); }
.timeline-item { display: grid; grid-template-columns: 26px 160px 1fr; gap: 22px; padding-bottom: 34px; position: relative; }
.timeline-dot { width: 17px; height: 17px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); z-index: 1; }
.timeline-period { font: 500 11px "DM Mono"; color: var(--muted); padding-top: 2px; }
.timeline-copy strong { font: 600 22px "Newsreader"; }
.timeline-copy p { margin: 6px 0 0; color: #535b55; line-height: 1.55; }
.caveat { display: flex; gap: 20px; margin: 50px 0; padding: 25px; border: 1px solid rgba(228,87,46,.45); background: rgba(228,87,46,.06); }
.caveat > span { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--accent); color: white; border-radius: 50%; font-weight: 800; }
.caveat p { margin: 7px 0 0; line-height: 1.55; color: #565d58; }
.sources { margin-top: 80px; padding-top: 35px; border-top: 1px solid var(--line); }
.sources-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.sources h3 { font: 600 34px "Newsreader"; margin: 10px 0 0; }
.sources-head > span { font: 400 10px "DM Mono"; color: var(--muted); }
.source-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 15px; padding: 19px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.source-row:hover strong { color: var(--accent); }
.source-row > span:first-child { font: 400 10px "DM Mono"; color: var(--muted); }
.source-row strong { display: block; font-size: 14px; }
.source-row small { color: var(--muted); }
.source-row b { font-size: 18px; }

.principle { margin: 0 -20px; padding: 110px calc(6% + 20px); background: var(--ink); color: white; }
.principle h2 { max-width: 1050px; font: 600 clamp(48px, 6vw, 86px)/.95 "Newsreader"; letter-spacing: -.045em; margin: 25px 0 0; }
.principle h2 em { color: var(--accent); font-weight: 500; }
.principle-quote { max-width: 760px; margin: 70px 0 0 auto; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.2); font: 500 clamp(22px, 3vw, 36px)/1.25 "Newsreader"; color: #cad0ca; }

footer { min-height: 120px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
footer span { font-weight: 800; color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: white; padding: 14px 20px; z-index: 30; box-shadow: var(--shadow); font-size: 13px; }

body.dark { --ink: #eeeadd; --paper: #111512; --paper-deep: #1b211d; --muted: #9ca39d; --line: rgba(238,234,221,.16); --card: rgba(255,255,255,.035); --shadow: 0 30px 80px rgba(0,0,0,.3); }
body.dark .search-control { background: #202721; }
body.dark .search-control input { color: var(--ink); }
body.dark .story-card p, body.dark .timeline-copy p, body.dark .caveat p { color: #b6bdb7; }
body.dark .timeline-dot { background: var(--paper); }
body.dark .principle { background: #e5e1d5; color: #17201c; }
body.dark .principle-quote { color: #4e5650; border-color: rgba(23,32,28,.18); }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 1320px); }
  .topbar { height: 72px; }
  nav a { display: none; }
  .hero { padding: 75px 3% 50px; min-height: auto; }
  .hero h1 { font-size: 64px; }
  .hero::after { display: none; }
  .search-control { grid-template-columns: 42px 1fr; }
  .search-control button { grid-column: 1 / -1; justify-content: space-between; }
  .result { padding: 60px 3% 80px; }
  .result-head, .sources-head { display: block; }
  .story-grid { grid-template-columns: 1fr; }
  .story-card { padding: 30px; min-height: 320px; }
  .timeline-item { grid-template-columns: 24px 1fr; gap: 15px; }
  .timeline-period { grid-column: 2; }
  .timeline-copy { grid-column: 2; }
  .source-row { grid-template-columns: 28px 1fr; }
  .source-row b { display: none; }
  footer { display: block; padding: 35px 0; }
}
