/* ============================================================
   Icarus Cybernetics
   One typeface (Fustat). Light, quiet, spacious.
   No em dashes anywhere by policy.
   ============================================================ */

:root {
    --bg:      #fbfaf7;
    --bg-soft: #f3f1ea;
    --ink:     #17150f;
    --body:    #3a352d;
    --muted:   #837b6e;
    --rule:    rgba(23, 21, 15, 0.12);
    --rule-2:  rgba(23, 21, 15, 0.07);
    --dark:    #131009;

    --font: 'Fustat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

    --maxw: 1080px;
    --readw: 680px;
    --pad: 32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--body);
    line-height: 1.62;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
::selection { background: rgba(23, 21, 15, 0.14); color: inherit; }

a { color: var(--ink); text-decoration: none; }

/* ─── Layout ─── */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.read { max-width: var(--readw); margin: 0 auto; padding: 0 var(--pad); }
.section { padding: 76px 0; }
.section--tight { padding: 48px 0; }
hr.rule { height: 1px; background: var(--rule-2); border: 0; margin: 0; }

/* ─── Nav ─── */

.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px var(--pad);
    background: rgba(251, 250, 247, 0.8);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: background .4s ease, border-color .4s ease;
}
.nav.scrolled { border-bottom-color: var(--rule-2); }
.nav--over { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nav--over .logo img { filter: brightness(0) invert(1); }
.nav--over .nav-links a { color: rgba(251,250,247,.92); }
.nav--over.scrolled { background: rgba(251, 250, 247, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.nav--over.scrolled .logo img { filter: none; }
.nav--over.scrolled .nav-links a { color: var(--muted); }

.logo { line-height: 0; }
.logo img { height: 24px; width: auto; transition: opacity .2s ease, filter .4s ease; }
.logo:hover img { opacity: .65; }

.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a {
    font-size: .82rem; font-weight: 500; color: var(--muted);
    transition: color .15s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav--over .nav-links a.active { color: #fff; }
.nav--over.scrolled .nav-links a.active { color: var(--ink); }
.nav--over .nav-links a.active::after { background: rgba(255,255,255,.75); }
.nav--over.scrolled .nav-links a.active::after { background: var(--accent); }
.nav-toggle { display: none; }

/* Nav dropdown (Solutions) */
.nav-item { position: relative; display: inline-flex; align-items: center; }
.nav-item::after { content: ""; position: absolute; top: 100%; left: -8px; right: -8px; height: 14px; }
.nav-menu {
  position: absolute; top: 100%; left: 50%; min-width: 152px; padding: 7px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--bg); border: 1px solid var(--rule-2); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(23,21,15,.12);
  opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(2px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s; z-index: 120;
}
.nav-item:hover .nav-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(10px); }
.nav-menu a { font-size: .84rem; font-weight: 500; color: var(--muted); padding: 8px 12px; border-radius: 7px; white-space: nowrap; }
.nav-menu a:hover { background: var(--bg-soft); color: var(--ink); }
.nav--over .nav-menu a { color: var(--muted); }
.nav--over .nav-menu a:hover { color: var(--ink); }

/* ─── Hero ─── */

.hero {
    position: relative; min-height: 86vh; width: 100%; overflow: hidden;
    color: #fff; display: flex; align-items: flex-end;
}
.hero-image {
    position: absolute; inset: 0;
    background: url('imgs/hero.png') center 42% / cover no-repeat;
    transform: scale(1.03); animation: drift 30s ease-out forwards;
}
.hero-veil {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.38) 0%, rgba(0,0,0,.16) 30%, rgba(0,0,0,.34) 60%, rgba(0,0,0,.82) 100%);
}
.hero-inner { position: relative; z-index: 2; width: 100%; padding-bottom: 68px; }
.hero-title {
    font-weight: 500; font-size: clamp(2.1rem, 4.8vw, 3.6rem); line-height: 1.08;
    letter-spacing: -.018em; color: #fff; max-width: 18ch;
    text-shadow: 0 2px 40px rgba(0,0,0,.34);
}
.hero-sub {
    margin-top: 12px; max-width: 42ch; font-size: clamp(1.18rem, 1.8vw, 1.5rem);
    line-height: 1.45; letter-spacing: -.005em; color: rgba(255,255,255,.92); font-weight: 400;
    text-shadow: 0 1px 22px rgba(0,0,0,.5);
}

/* ─── Type ─── */

h1, h2, h3 { font-family: var(--font); color: var(--ink); font-weight: 500; letter-spacing: -.015em; }

.eyebrow {
    font-size: .72rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 44px;
}
.page-title { font-size: clamp(1.7rem, 2.9vw, 2.3rem); line-height: 1.14; letter-spacing: -.012em; font-weight: 500; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.5; color: var(--ink); font-weight: 400; }

p { font-size: 1.04rem; line-height: 1.66; color: var(--body); margin-bottom: 18px; }
.read p:last-child, .prose p:last-child { margin-bottom: 0; }

.prose h2 { font-size: 1.18rem; font-weight: 600; line-height: 1.3; margin: 48px 0 14px; padding-top: 26px; border-top: 1px solid var(--rule-2); position: relative; letter-spacing: 0; }
.prose h2 .num { color: var(--muted); font-weight: 500; margin-right: 12px; font-size: .94em; }
.prose h3 { font-size: 1.08rem; margin: 28px 0 10px; }
.prose strong { font-weight: 600; color: var(--ink); }

.prose a, .lead a, .links a, .meta a, p a {
    color: var(--ink); border-bottom: 1px solid var(--rule);
    transition: border-color .2s ease, opacity .2s ease;
}
.prose a:hover, .lead a:hover, p a:hover { border-bottom-color: var(--ink); }

.muted { color: var(--muted); }
.center { text-align: center; }

/* Home manifesto */
#maincontent { padding: 84px 0; }
.tagline { font-size: clamp(1.25rem, 2.1vw, 1.6rem); line-height: 1.34; color: var(--ink); font-weight: 500; letter-spacing: -.012em; margin-bottom: 34px; }
.links { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule-2); display: flex; gap: 28px; font-size: .92rem; font-weight: 500; }
.links a { color: var(--muted); border: 0; }
.links a:hover { color: var(--ink); }
#maincontent .colophon { margin-top: 36px; font-size: .82rem; color: var(--muted); }

/* ─── Page header ─── */

.pagehead { padding: 120px 0 64px; border-bottom: 1px solid var(--rule-2); }
.pagehead + main > section:first-child,
.pagehead + main > section.section--tight:first-child { padding-top: 60px; }
.pagehead .page-title { margin-bottom: 16px; }
.pagehead p { max-width: 58ch; margin-bottom: 0; }

/* ─── Papers ─── */

.paper { padding: 30px 0; border-top: 1px solid var(--rule-2); display: flex; justify-content: space-between; gap: 28px; align-items: baseline; }
.paper:first-child { border-top: 0; }
.paper h3 { font-size: 1.12rem; font-weight: 600; margin-bottom: 7px; letter-spacing: -.005em; }
.paper .meta { font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.paper p { font-size: .98rem; line-height: 1.55; margin-bottom: 0; }
.paper .actions { flex: none; }
.pdf {
    font-size: .82rem; font-weight: 600; letter-spacing: .04em; color: var(--ink);
    border: 1px solid var(--rule); border-radius: 999px; padding: 8px 18px; white-space: nowrap;
    transition: background .2s ease, color .2s ease;
}
.pdf:hover { background: var(--ink); color: var(--bg); }

/* ─── Table ─── */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 14px 16px; font-size: .96rem; }
table.data th { font-weight: 600; color: var(--muted); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--rule); }
table.data td { color: var(--body); border-bottom: 1px solid var(--rule-2); }
table.data td:first-child { color: var(--ink); }
table.data td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.data td.win { color: var(--ink); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }

/* ─── Demo ─── */

.demo-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.toggle { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; background: var(--bg); }
.toggle button { font-family: var(--font); font-size: .85rem; font-weight: 500; cursor: pointer; border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px; transition: background .2s, color .2s; }
.toggle button.on { background: var(--ink); color: var(--bg); }
.replay { font-family: var(--font); font-size: .85rem; font-weight: 500; cursor: pointer; color: var(--muted); background: none; border: 0; padding: 7px 4px; }
.replay:hover { color: var(--ink); }

.terminal { background: #fff; border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(23,21,15,.06); }
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--rule-2); }
.terminal-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.terminal-bar .ttl { margin-left: 8px; font-size: .8rem; color: var(--muted); }
.terminal-bar .ttl b { color: var(--ink); font-weight: 600; }
.terminal-body { padding: 24px; min-height: 250px; max-height: 460px; overflow-y: auto; font-size: .98rem; line-height: 1.62; }
.line { margin-bottom: 16px; white-space: pre-wrap; word-break: break-word; }
.line .who { display: inline-block; min-width: 58px; font-weight: 600; font-size: .82rem; letter-spacing: .02em; }
.line.you { color: var(--muted); } .line.you .who { color: var(--ink); }
.line.bot { color: var(--ink); } .line.bot .who { color: var(--muted); }
.line.sys { color: var(--muted); font-style: italic; font-size: .9rem; }
.cursor { display: inline-block; width: 7px; height: 1.05em; background: var(--ink); vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }

/* ─── Imagery (one consistent treatment for all artwork) ─── */

.plate { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-soft); }
.plate img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.9) contrast(1.02); }
.plate::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(19,16,9,.03), rgba(19,16,9,.20)); }
.band { aspect-ratio: 21 / 8; }

/* Vintage figure (early-days photo) */
.vintage { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 12 / 5; }
.vintage img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 56% 40%;
  opacity: .8; filter: sepia(.4) saturate(.86) contrast(.93) brightness(1.1); }
.vintage::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply;
  background: linear-gradient(180deg, rgba(216,188,124,.05), rgba(196,166,104,.1)); }
.figcap { margin-top: 11px; font-size: .82rem; color: var(--muted); text-align: center; }

.figrow { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; }
.figrow + .figrow { margin-top: 56px; }
.figrow .plate { aspect-ratio: 5 / 4; }
.figrow .kick { font-size: .72rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.figrow h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -.01em; margin-bottom: 12px; }
.figrow p { font-size: 1.04rem; margin-bottom: 0; }
.figrow:nth-child(even) .fig-media { order: 2; }

/* ─── Metrics (performance, shown not told) ─── */

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.metric .big { font-size: clamp(2.6rem, 5.4vw, 3.9rem); font-weight: 600; letter-spacing: -.03em; line-height: 1; color: var(--ink); }
.metric .lbl { margin-top: 8px; font-size: 1.02rem; color: var(--body); }
.metric .bars { margin-top: 18px; display: grid; gap: 8px; }
.metric .bar { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; }
.metric .bar .name { font-size: .7rem; letter-spacing: .04em; color: var(--muted); }
.metric .bar .track { height: 6px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.metric .bar .fill { display: block; height: 100%; width: 0; border-radius: 99px; min-width: 3px; transition: width 1.1s cubic-bezier(.2,.7,.2,1); }
.metric .bar.apex .fill { background: var(--ink); }
.metric .bar.h100 .fill { background: rgba(23,21,15,.18); }
.metrics.in .bar .fill { width: var(--w); }
.metrics-cap { margin-top: 24px; font-size: .86rem; color: var(--muted); }

@media (max-width: 720px) {
  .metrics { grid-template-columns: 1fr; gap: 30px; }
}

/* ─── Capability matrix (what Apex can do, against a frozen model) ─── */

.cmatrix { margin-top: 8px; }
.cm-head, .cm-row { display: grid; grid-template-columns: 1fr 96px 96px; align-items: center; gap: 18px; }
.cm-head { padding-bottom: 4px; }
.cm-head span { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; }
.cm-head span:first-child { text-align: left; }
.cm-row { padding: 16px 0; border-top: 1px solid var(--rule-2); }
.cm-row:last-child { border-bottom: 1px solid var(--rule-2); }
.cm-row .cap { font-size: 1rem; color: var(--ink); }
.mark { justify-self: center; width: 13px; height: 13px; border-radius: 50%; }
.mark.tf { border: 1.5px solid rgba(23,21,15,.3); background: transparent; }
.mark.tf.half { background: linear-gradient(90deg, rgba(23,21,15,.32) 0 50%, transparent 50% 100%); }
.mark.ax { background: var(--ink); transform-origin: center; }
.cmatrix.in .mark.ax { transform: scale(0); animation: cmpop .5s cubic-bezier(.3,.8,.3,1.35) forwards; }
.cmatrix.in .cm-row:nth-child(2) .mark.ax { animation-delay: .04s; }
.cmatrix.in .cm-row:nth-child(3) .mark.ax { animation-delay: .12s; }
.cmatrix.in .cm-row:nth-child(4) .mark.ax { animation-delay: .20s; }
.cmatrix.in .cm-row:nth-child(5) .mark.ax { animation-delay: .28s; }
.cmatrix.in .cm-row:nth-child(6) .mark.ax { animation-delay: .36s; }
.cmatrix.in .cm-row:nth-child(7) .mark.ax { animation-delay: .44s; }
.cmatrix.in .cm-row:nth-child(8) .mark.ax { animation-delay: .52s; }
@keyframes cmpop { to { transform: scale(1); } }

/* ─── Research timeline ─── */

.timeline { list-style: none; position: relative; margin: 0; padding: 0; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--rule); }
.tl-item { position: relative; padding: 0 0 42px 40px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 0; top: 4px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); box-sizing: border-box; }
.tl-item:last-child::before { background: var(--ink); border-color: var(--ink); }
.tl-date { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.tl-item h3 { font-size: 1.14rem; font-weight: 600; letter-spacing: -.005em; margin-bottom: 5px; }
.tl-item .meta { font-size: .82rem; color: var(--muted); margin-bottom: 9px; }
.tl-item p { font-size: .98rem; line-height: 1.55; color: var(--body); margin: 0; }

/* ─── Research focus areas ─── */

.focus { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 44px; }
.focus h4 { font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; letter-spacing: -.005em; }
.focus p { font-size: .94rem; line-height: 1.5; color: var(--muted); margin: 0; }

@media (max-width: 720px) {
  .cm-head, .cm-row { grid-template-columns: 1fr 78px 56px; gap: 8px; }
  .cm-head span { font-size: .55rem; letter-spacing: .02em; }
  .cm-row .cap { font-size: .95rem; }
  .focus { grid-template-columns: 1fr; gap: 22px; }
  .tl-item { padding-left: 32px; }
}

/* ─── Footer ─── */

.footer { border-top: 1px solid var(--rule-2); padding: 34px 0; margin-top: 24px; }
.footer-base { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-base small { font-size: .82rem; color: var(--muted); }
.footer-base nav { display: flex; gap: 22px; }
.footer-base nav a { font-size: .85rem; color: var(--muted); }
.footer-base nav a:hover { color: var(--ink); }

/* ─── Motion ─── */

@keyframes drift { from { transform: scale(1.07); } to { transform: scale(1.0); } }
@keyframes blink { 0%,50%{opacity:1;} 51%,100%{opacity:0;} }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.reveal-seq > * { animation: fadeUp .7s cubic-bezier(.2,.7,.2,1) both; }
.reveal-seq > *:nth-child(1){animation-delay:.04s}
.reveal-seq > *:nth-child(2){animation-delay:.10s}
.reveal-seq > *:nth-child(3){animation-delay:.16s}
.reveal-seq > *:nth-child(4){animation-delay:.22s}
.reveal-seq > *:nth-child(5){animation-delay:.28s}
.reveal-seq > *:nth-child(6){animation-delay:.34s}
.reveal-seq > *:nth-child(7){animation-delay:.40s}
.reveal-seq > *:nth-child(n+8){animation-delay:.46s}

a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  .hero-image { animation: none; }
  .cursor { animation: none; }
  .reveal-seq > * { animation: none; }
  * { scroll-behavior: auto; }
}

/* ─── Responsive ─── */

@media (max-width: 720px) {
  html { font-size: 16px; }
  :root { --pad: 22px; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; position: fixed; top: 60px; left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 6px; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 18px 22px; }
  .nav-links.open a { padding: 8px 0; color: var(--ink); }
  .nav-item { display: block; width: 100%; }
  .nav-item::after { display: none; }
  .nav-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; background: transparent; padding: 2px 0 6px 14px; min-width: 0; }
  .nav-menu a { color: var(--muted); }
  .nav-toggle { display: inline-flex; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; }
  .nav-toggle span { width: 22px; height: 2px; background: var(--ink); }
  .nav--over .nav-toggle span { background: #fff; }
  .nav--over.scrolled .nav-toggle span { background: var(--ink); }
  .section { padding: 64px 0; }
  .paper { flex-direction: column; gap: 14px; }
  .footer-base { flex-direction: column; align-items: flex-start; }
  .figrow { grid-template-columns: 1fr; gap: 20px; }
  .figrow + .figrow { margin-top: 40px; }
  .figrow:nth-child(even) .fig-media { order: 0; }
  .figrow .plate { aspect-ratio: 16 / 10; }
  .band { aspect-ratio: 16 / 9; }
}
