/* ==========================================================
   BIONIAN — bionian.ink
   Palette drawn from the veranda image:
     Abyss        #060F1E  page ground
     Deep Tide    #0B2A4A  panels, cards
     Tide Line    #143C66  borders, dividers
     Moon Silver  #C9D3DF  secondary text, rules
     Bioluminous  #35C8FF  links, glyph markings, accents
     Ember        #E88A2B  lantern light: the single warm accent
     Foam         #EEF4FA  primary text
   Type
     Marcellus         display (inscriptional, stone-cut)
     EB Garamond       body
     JetBrains Mono    reconstructed roots and glyph notation
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Marcellus&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --abyss: #060F1E;
  --tide: #0B2A4A;
  --tide-2: #0E3358;
  --tide-line: #143C66;
  --moon: #C9D3DF;
  --moon-dim: #8FA1B5;
  --bio: #35C8FF;
  --bio-dim: rgba(53, 200, 255, 0.28);
  --ember: #E88A2B;
  --foam: #EEF4FA;

  --display: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  --body: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --measure: 66ch;
  --wrap: 1180px;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--abyss);
  color: var(--foam);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--bio); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.55rem); }
p { margin: 0 0 1em; }
code, .root { font-family: var(--mono); font-size: .9em; color: var(--bio); }
.root::before { content: '*'; opacity: .7; margin-right: 1px; }
.mono { font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--moon-dim); }
hr.rule { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--tide-line), transparent); margin: 3rem 0; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--pad)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose h2, .prose h3 { margin-top: 2em; }
.prose blockquote { border-left: 2px solid var(--bio-dim); margin: 1.5em 0; padding: .25em 0 .25em 1.25em; color: var(--moon); font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose img { border-radius: var(--radius); margin: 1.5em 0; }
.prose pre { background: var(--tide); padding: 1rem; border-radius: var(--radius); overflow: auto; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
.prose td, .prose th { border-bottom: 1px solid var(--tide-line); padding: .5em .6em; text-align: left; vertical-align: top; }
.prose th { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--moon-dim); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 15, 30, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--tide-line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .85rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--foam); font-family: var(--display); font-size: 1.35rem; letter-spacing: .12em; text-transform: uppercase; }
.brand:hover { text-decoration: none; color: var(--bio); }
.dyad { width: 30px; height: 20px; flex: 0 0 auto; }
.dyad circle { fill: none; stroke: var(--bio); stroke-width: 1.4; }
.dyad circle:last-child { stroke: var(--moon); }
.nav { display: flex; gap: clamp(.9rem, 2.4vw, 2rem); }
.nav a { color: var(--moon); font-family: var(--display); font-size: .95rem; letter-spacing: .14em; text-transform: uppercase; padding: .35rem 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--foam); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--bio); border-bottom-color: var(--bio); }
.nav-toggle { display: none; background: none; border: 1px solid var(--tide-line); color: var(--moon); padding: .4rem .6rem; border-radius: var(--radius); font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; }
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; background: var(--abyss); border-bottom: 1px solid var(--tide-line); padding: .5rem var(--pad) 1rem; }
  .nav.open { display: flex; }
  .nav a { padding: .8rem 0; border-bottom: 1px solid var(--tide-line); }
  .nav a[aria-current="page"] { border-bottom-color: var(--tide-line); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(88vh, 820px);
  display: grid; align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--tide-line);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 42% 40%; }
.hero::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6,15,30,.15) 0%, rgba(6,15,30,0) 35%, rgba(6,15,30,.55) 70%, var(--abyss) 100%),
    linear-gradient(90deg, rgba(6,15,30,.55), rgba(6,15,30,0) 55%);
}
.hero-content { position: relative; z-index: 2; padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 5rem); max-width: 560px; }
.hero .eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--bio); margin-bottom: 1.2rem; }
.hero h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); margin-bottom: .6rem; text-shadow: 0 2px 30px rgba(6,15,30,.8); }
.hero .lede { font-size: clamp(1.15rem, 2vw, 1.35rem); color: var(--moon); max-width: 44ch; text-shadow: 0 1px 20px rgba(6,15,30,.9); }
.hero .actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }

/* Bioluminous motes: the ambient signature. Static under reduced motion. */
.motes { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.motes span {
  position: absolute; bottom: -10px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--bio); box-shadow: 0 0 8px 2px var(--bio-dim);
  opacity: 0;
  animation: rise 14s linear infinite;
}
@keyframes rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: .9; }
  90%  { opacity: .3; }
  100% { transform: translateY(-70vh) translateX(var(--drift, 20px)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motes span { animation: none; opacity: .5; bottom: auto; top: var(--top, 50%); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-family: var(--display); letter-spacing: .12em; text-transform: uppercase; font-size: .9rem;
  padding: .75rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--bio); color: var(--bio);
  background: rgba(6,15,30,.55); transition: background .2s, color .2s;
}
.btn:hover { background: var(--bio); color: var(--abyss); text-decoration: none; }
.btn.ember { border-color: var(--ember); color: var(--ember); }
.btn.ember:hover { background: var(--ember); color: var(--abyss); }
.btn.quiet { border-color: var(--tide-line); color: var(--moon); }
.btn.quiet:hover { background: var(--tide); color: var(--foam); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section + .section { border-top: 1px solid var(--tide-line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.section-head .mono { margin-bottom: .4rem; display: block; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.card {
  background: linear-gradient(180deg, var(--tide-2), var(--tide));
  border: 1px solid var(--tide-line); border-radius: var(--radius);
  padding: 1.6rem; display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--bio-dim); transform: translateY(-2px); }
.card h3 { margin: .2rem 0 .3rem; }
.card p { color: var(--moon); margin: 0; }
.card .mono { color: var(--bio); }
.card a.stretch::after { content: ''; position: absolute; inset: 0; }
.card { position: relative; }

/* Page hero (interior pages) */
.page-head { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--tide-line); background: radial-gradient(900px 300px at 20% 0%, rgba(53,200,255,.08), transparent 70%); }
.page-head .mono { color: var(--bio); display: block; margin-bottom: .8rem; }
.page-head p { color: var(--moon); font-size: 1.2rem; max-width: 60ch; }

/* ---------- Glossary entry (house style) ---------- */
.entry { border-top: 1px solid var(--tide-line); padding: 2.5rem 0; display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 1.5rem 3rem; }
.entry:last-child { border-bottom: 1px solid var(--tide-line); }
.entry .term h3 { font-size: 1.9rem; margin: 0 0 .3rem; }
.entry .term .pos { font-style: italic; color: var(--moon-dim); }
.entry .term .root { display: block; margin-top: .6rem; }
.entry .parts h4 { font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--bio); margin: 1.4em 0 .4em; }
.entry .parts h4:first-child { margin-top: 0; }
.entry .parts p:last-child { margin-bottom: 0; }
@media (max-width: 720px) { .entry { grid-template-columns: 1fr; gap: .5rem; } }

/* Timeline (Lore) */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--tide-line); }
.timeline li { position: relative; padding: 0 0 2rem 1.75rem; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: .55em; width: 9px; height: 9px; border-radius: 50%; background: var(--abyss); border: 1px solid var(--bio); box-shadow: 0 0 10px var(--bio-dim); }
.timeline .when { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--bio); }
.timeline h3 { margin: .3rem 0 .3rem; }
.timeline p { color: var(--moon); margin: 0; }

/* ---------- Blog ---------- */
.post-list { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.post-card { background: var(--tide); border: 1px solid var(--tide-line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: border-color .2s; }
.post-card:hover { border-color: var(--bio-dim); }
.post-card .cover { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.post-card .cover.placeholder { background: radial-gradient(circle at 30% 30%, var(--tide-2), var(--abyss)); }
.post-card .body { padding: 1.25rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.post-card h3 { margin: .2rem 0; }
.post-card h3 a { color: var(--foam); }
.post-card h3 a::after { content: ''; position: absolute; inset: 0; }
.post-card p { color: var(--moon); margin: 0; flex: 1; }
.meta { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--moon-dim); display: flex; gap: .8rem; flex-wrap: wrap; }
.meta .cat { color: var(--bio); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.filters a { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; padding: .4rem .8rem; border: 1px solid var(--tide-line); border-radius: 999px; color: var(--moon); }
.filters a:hover, .filters a.active { border-color: var(--bio); color: var(--bio); text-decoration: none; }
.tags { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 1.5rem; }
.tags a { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; padding: .25rem .6rem; border: 1px solid var(--tide-line); border-radius: 999px; color: var(--moon-dim); }
.tags a:hover { border-color: var(--bio); color: var(--bio); text-decoration: none; }
.post-hero { aspect-ratio: 21/9; object-fit: cover; width: 100%; border-radius: var(--radius); margin: 2rem 0; }
.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--tide-line); flex-wrap: wrap; }
.empty { border: 1px dashed var(--tide-line); border-radius: var(--radius); padding: 3rem 1.5rem; text-align: center; color: var(--moon); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--tide-line); padding: 2.5rem 0 3rem; color: var(--moon-dim); font-size: .95rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--moon); }
.site-footer .lantern { color: var(--ember); }

/* ---------- Footer links & cookie banner ---------- */
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60; margin-inline: auto; max-width: 640px; background: var(--tide); border: 1px solid var(--tide-line); border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.cookie-banner p { margin: 0 0 .8rem; color: var(--moon); font-size: 1rem; }
.cookie-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.cookie-actions .btn { font-size: .78rem; padding: .5rem 1rem; }

/* ---------- Legal pages ---------- */
.legal { max-width: var(--measure); }
.legal .updated { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--moon-dim); margin-bottom: 2rem; display: block; }
.legal h2 { font-size: 1.35rem; margin-top: 2em; }
.legal ul { padding-left: 1.3em; color: var(--moon); }
.legal .see-also { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--tide-line); font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.legal mark { background: rgba(232,138,43,.18); color: var(--ember); padding: 0 .25em; }

/* ---------- Author page ---------- */
.author-hero { display: grid; grid-template-columns: 200px 1fr; gap: 2.5rem; align-items: start; }
.author-hero .portrait { width: 200px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 1px solid var(--tide-line); background: radial-gradient(circle at 40% 35%, var(--tide-2), var(--abyss)); display: grid; place-items: center; font-family: var(--display); font-size: 3.5rem; color: var(--bio); }
@media (max-width: 720px) { .author-hero { grid-template-columns: 1fr; } }

/* Mobile hero: keep the figures clear of the text */
@media (max-width: 720px) {
  .hero { min-height: 100svh; }
  .hero-img { height: 64%; object-position: 50% 30%; }
  .hero::after { background: linear-gradient(180deg, rgba(6,15,30,.1) 0%, rgba(6,15,30,0) 40%, rgba(6,15,30,.85) 58%, var(--abyss) 64%); }
  .hero-content { padding-top: 1rem; }
}
