/* Alatomy - minimal, technical. Three themes, chosen per page with <body data-theme>:
     alatomy  black + flame orange/red   (Home, About)
     alani    black + orange, no red     (Alani Home, Discord, Voice)
     emotion  white + orange             (Alani Emotion)
   No inline styles are used anywhere (the CSP forbids them): everything is a class. */

:root {
  --orange: #da8552;
  --orange-bright: #ffa05c;
  --red: #d8321f;
  --radius: 4px;
  --header-h: 72px;
  --sub-h: 46px;
  --max: 1180px;
}

body[data-theme="alatomy"] {
  --bg: #050505; --fg: #f4efe9; --muted: #a39a91; --accent: #da8552; --accent-ink: #ff9a5c;
  --line: rgba(255, 255, 255, .16); --panel: rgba(255, 255, 255, .04); --on-accent: #120a05;
  --header-bg: rgba(5, 5, 5, .72); --glow: rgba(216, 50, 31, .22);
}
body[data-theme="alani"] {
  --bg: #060504; --fg: #f6f0e8; --muted: #a8998b; --accent: #da8552; --accent-ink: #ffa05c;
  --line: rgba(218, 133, 82, .28); --panel: rgba(218, 133, 82, .06); --on-accent: #120a05;
  --header-bg: rgba(6, 5, 4, .74); --glow: rgba(218, 133, 82, .2);
}
body[data-theme="emotion"] {
  --bg: #ffffff; --fg: #1a130d; --muted: #6d6055; --accent: #da8552; --accent-ink: #a8541f;
  --line: #eadfd6; --panel: #fff7f1; --on-accent: #1a0d05;
  --header-bg: rgba(255, 255, 255, .86); --glow: rgba(218, 133, 82, .2);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); min-height: 100vh;
  font: 400 17px/1.65 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  /* no-JS fallback for the animated edge waves */
  background-image: linear-gradient(90deg, var(--glow), transparent 14%, transparent 86%, var(--glow));
  background-attachment: fixed;
}
#waves { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main, .site-footer, .site-header { position: relative; z-index: 2; }
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: clamp(2.6rem, 8vw, 7rem); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.5rem); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
h3 { font-size: 1.05rem; letter-spacing: .04em; }
p { margin: 0 0 1em; }
code { font: .88em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--panel); padding: .1em .4em; border-radius: 3px; border: 1px solid var(--line); }
.skip { position: absolute; left: -999px; top: 0; z-index: 10; background: var(--accent); color: var(--on-accent); padding: .5rem 1rem; }
.skip:focus { left: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.container { width: min(var(--max), 100% - 3rem); margin-inline: auto; }

/* ---------- header ---------- */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 20; transition: background .3s, backdrop-filter .3s; }
.site-header.scrolled { background: var(--header-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bar { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 3vw, 2.5rem); }
.logo { font-size: 1.35rem; font-weight: 700; letter-spacing: .04em; color: var(--orange); text-decoration: none; }
.logo:hover { color: var(--orange-bright); }
.logo img { display: block; height: 2.75rem; width: auto; }
.primary ul, .secondary ul { list-style: none; display: flex; margin: 0; padding: 0; gap: clamp(1rem, 3vw, 2.4rem); }
.primary a, .secondary a { color: var(--fg); text-decoration: none; text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 600; padding: .4rem 0; border-bottom: 2px solid transparent; }
.primary a:hover, .secondary a:hover { color: var(--accent-ink); }
.primary a.active, .secondary a[aria-current="page"] { border-bottom-color: var(--accent); }
.secondary { height: var(--sub-h); display: flex; align-items: center; padding: 0 clamp(1rem, 3vw, 2.5rem); border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.secondary::-webkit-scrollbar { display: none; }
.secondary a { font-size: .72rem; color: var(--muted); }
.secondary a[aria-current="page"] { color: var(--fg); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--fg); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; padding: .5rem .9rem; cursor: pointer; border-radius: var(--radius); }

/* ---------- hero ---------- */
.hero { min-height: 100vh; display: flex; align-items: flex-end; padding: calc(var(--header-h) + var(--sub-h) + 2rem) 0 clamp(3rem, 9vh, 6rem); }
.hero-inner { width: min(var(--max), 100% - 3rem); margin-inline: auto; }
.hero .lede { max-width: 38rem; font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--muted); }
.hero.short { min-height: 70vh; }
.hero.center { align-items: center; text-align: center; }
.hero.center .lede { margin-inline: auto; }
.hero.center .actions { justify-content: center; }
.hero.center .eyebrow { justify-content: center; }
h1.name { font-size: clamp(2.2rem, 5.4vw, 4.6rem); }
.hero .split { align-items: end; }
.hero .portrait { margin: 0; max-width: 460px; justify-self: end; width: 100%; }
.eyebrow { display: flex; align-items: center; gap: .8rem; text-transform: uppercase; letter-spacing: .28em; font-size: .72rem; font-weight: 600; color: var(--accent-ink); margin-bottom: 1.2rem; }
.eyebrow::before { content: ""; width: 2.5rem; height: 1px; background: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.btn { display: inline-block; text-decoration: none; color: var(--fg); border: 1px solid var(--fg); padding: .95rem 1.7rem; text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; font-weight: 700; border-radius: var(--radius); transition: background .2s, color .2s, border-color .2s; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.btn { background: transparent; cursor: pointer; font-family: inherit; line-height: 1.2; }
.btn.solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.solid:hover { background: var(--orange-bright); border-color: var(--orange-bright); color: var(--on-accent); }
.btn.big { font-size: clamp(.85rem, 2.2vw, 1.15rem); padding: 1.4rem 2.6rem; letter-spacing: .24em; }

/* ---------- sections, cards ---------- */
.section { padding: clamp(3.5rem, 9vw, 7rem) 0; border-top: 1px solid var(--line); }
.section.plain { border-top: 0; }
.section > .container > h2 { margin-bottom: 1.4rem; }
.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 2rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--bg); padding: clamp(1.4rem, 3vw, 2.2rem); position: relative; }
body[data-theme="emotion"] .card { background: #fff; }
.icon { width: 52px; height: 52px; fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 1rem; transition: transform .3s; }
.interest:hover .icon { transform: translateY(-3px) scale(1.06); }
.interest p { color: var(--muted); font-size: .92rem; }
.card h3 { text-transform: uppercase; letter-spacing: .14em; font-size: .85rem; color: var(--accent-ink); margin-bottom: .8rem; }
.card p:last-child { margin-bottom: 0; }
a.card { text-decoration: none; color: var(--fg); display: block; transition: background .25s; }
a.card:hover { background: var(--panel); color: var(--fg); }
a.card .go { display: inline-block; margin-top: 1rem; text-transform: uppercase; letter-spacing: .2em; font-size: .7rem; font-weight: 700; color: var(--accent-ink); }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .7rem 0 .7rem 1.6rem; border-top: 1px solid var(--line); position: relative; }
.list li::before { content: ""; position: absolute; left: 0; top: 1.3rem; width: .7rem; height: 1px; background: var(--accent); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3.4rem 1fr; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(step, decimal-leading-zero); font-weight: 700; color: var(--accent-ink); letter-spacing: .1em; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel); padding: 1rem 1.3rem; margin: 1.5rem 0; border-radius: var(--radius); }
.credit { font-size: .75rem; color: var(--muted); }
.stat-row { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 1.5rem; }
.stat b { display: block; font-size: 1.6rem; color: var(--accent-ink); font-weight: 600; }
.stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }

/* ---------- command reference ---------- */
.acc { border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; background: var(--panel); }
.acc > summary { cursor: pointer; padding: 1.1rem 1.4rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: "+"; color: var(--accent-ink); font-size: 1.2rem; line-height: 1; }
.acc[open] > summary::after { content: "\2212"; }
.acc .body { padding: 0 1.4rem 1.4rem; }
pre.code { background: #0b0907; color: #f1e8de; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; overflow-x: auto; font: .84rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; margin: .8rem 0 1.2rem; }
body[data-theme="emotion"] pre.code { background: #fff7f1; color: #3a2616; }
.toc { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.toc a { border: 1px solid var(--line); padding: .45rem 1rem; text-decoration: none; color: var(--fg); text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; font-weight: 600; border-radius: 999px; }
.toc a:hover { border-color: var(--accent); color: var(--accent-ink); }
table.ref { width: 100%; border-collapse: collapse; font-size: .92rem; margin: .8rem 0 1.2rem; }
table.ref th, table.ref td { text-align: left; padding: .6rem .8rem; border-top: 1px solid var(--line); vertical-align: top; }
table.ref th { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }

/* ---------- founder (CV) ---------- */
.portrait { position: relative; border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; box-shadow: 0 0 60px var(--glow); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.links { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 11rem 1fr; gap: 1.5rem; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.timeline .when { color: var(--accent-ink); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 600; padding-top: .3rem; }
.timeline h3 { margin-bottom: .2rem; font-size: 1.15rem; text-transform: none; letter-spacing: 0; color: var(--fg); }
.timeline .where { color: var(--muted); margin-bottom: .8rem; }
.timeline ul { margin: .6rem 0 0; padding-left: 1.1rem; }
.timeline ul li { margin-bottom: .45rem; }
.photo-card { margin: 1.2rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo-card img { width: 100%; height: 220px; object-fit: cover; }
.photo-card figcaption { padding: .6rem .9rem; }
.seal { width: 92px; height: 92px; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.chips li { border: 1px solid var(--line); padding: .3rem .8rem; font-size: .82rem; border-radius: 999px; }

/* ---------- voice demo orb ---------- */
.stage { display: grid; place-items: center; text-align: center; padding: 2rem 0; }
.orb { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.orb-a { font-size: 5.2rem; font-weight: 800; line-height: 1; background: linear-gradient(90deg, #f7c9ac, #da8552); -webkit-background-clip: text; background-clip: text; color: transparent; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: .6; }
.orb[data-state="idle"] .orb-ring { animation: breathe 3.6s ease-in-out infinite; }
.orb[data-state="listening"] .orb-ring { animation: ripple 1.1s ease-out infinite; }
.orb[data-state="loading"] .orb-ring { border-color: transparent; border-top-color: var(--accent-ink); animation: spin .9s linear infinite; opacity: 1; }
.orb[data-state="speaking"] .orb-ring { animation: ripple .65s ease-out infinite; border-width: 3px; }
.orb[data-state="searching"] .orb-ring { border-style: dashed; animation: spin 2.2s linear infinite; opacity: 1; }
.orb-label { margin: 1.4rem 0 .3rem; text-transform: uppercase; letter-spacing: .3em; font-size: .8rem; color: var(--accent-ink); font-weight: 700; min-height: 1.4em; }
.orb-caption { color: var(--muted); min-height: 3.2em; max-width: 32rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2.2rem 1.5rem 2.6rem; text-align: center; color: var(--muted); font-size: .85rem; background: var(--bg); }
.site-footer p { margin: 0; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
/* safety net: if the script never reveals a block (it should), show it anyway after a few seconds instead of leaving a blank gap */
.reveal:not(.in) { animation: reveal-failsafe .6s ease 5s forwards; }
@keyframes reveal-failsafe { to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(.94); opacity: .35; } 50% { transform: scale(1.04); opacity: .85; } }
@keyframes ripple { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .orb-ring { animation: none !important; }
}
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .primary { position: fixed; inset: var(--header-h) 0 auto 0; background: var(--header-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); display: none; padding: 1rem 1.5rem 1.5rem; }
  .primary.open { display: block; }
  .primary ul { flex-direction: column; gap: .6rem; }
  .primary a { display: inline-block; font-size: .9rem; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3, .grid.cols-2, .split { grid-template-columns: 1fr; }
  .timeline > li { grid-template-columns: 1fr; gap: .4rem; }
  .hero { min-height: 92vh; }
}
@media (max-width: 480px) { .grid.cols-4 { grid-template-columns: 1fr; } }
@media print { #waves, .site-header, .menu-btn { display: none; } body { background: #fff; color: #000; } }

/* keep headline text readable where a wave passes behind it (dark themes) */
body:not([data-theme="emotion"]) .hero h1,
body:not([data-theme="emotion"]) .hero .lede,
body:not([data-theme="emotion"]) .hero .eyebrow { text-shadow: 0 2px 22px rgba(0, 0, 0, .85), 0 0 4px rgba(0, 0, 0, .6); }

/* ---------- account pages ---------- */
.container.narrow { width: min(640px, 100% - 3rem); }
.prose h2 { margin-top: 2.4rem; font-size: 1.1rem; }
.prose p, .prose .list { max-width: 62ch; }
.provider-buttons { display: grid; gap: 1rem; margin: 0 0 1.5rem; }
.btn.wide { text-align: center; width: 100%; }
.btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: auto; }
.btn.small-btn { padding: .55rem 1.1rem; font-size: .68rem; }
.btn.danger { border-color: #e5483c; color: #ff8f86; }
.btn.danger:hover { background: #e5483c; color: #fff; }
.form { display: grid; gap: 1rem; margin-top: 1rem; }
.field { display: grid; gap: .35rem; }
.field > span { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 600; }
.field input, .field select, .card input, .card select { font: inherit; color: var(--fg); background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; width: 100%; }
.field input:focus, .field select:focus, .card input:focus, .card select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field select option { color: #111; }
.notice.error { border-left-color: #e5483c; }
.notice.ok { border-left-color: #3fae6a; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.avatar { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--accent); margin-bottom: 1rem; object-fit: cover; }
.pill { display: inline-block; padding: .1rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--line); }
.pill.done { color: #7bd69b; border-color: rgba(123, 214, 155, .5); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.hero.short .actions { margin-top: 1.4rem; }

