/* adamant3.dev hub. Dark-first; light theme follows the system setting. */
:root {
  --bg: #0f1a1f;
  --surface: #14232a;
  --raise: #1a2c34;
  --line: #26393f;
  --ink: #e7ecea;
  --mute: #8fa29f;
  --amber: #f0a640;
  --teal: #6fc3b8;
  --on-amber: #1a1205;
  --grid: rgba(143, 162, 159, .09);
  --max: 72rem;
  --gut: clamp(1rem, 4.5vw, 2.75rem);
  --display: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1ee; --surface: #ffffff; --raise: #f6f8f6; --line: #cfd8d4; --ink: #12202a; --mute: #536560;
    --amber: #a85f00; --teal: #1e7a6e; --on-amber: #ffffff; --grid: rgba(18, 32, 42, .07);
    color-scheme: light;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg); color: var(--ink);
  font: 400 1rem/1.6 var(--display); font-optical-sizing: auto;
  min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--amber); color: var(--on-amber); padding: .5rem 1rem; z-index: 50; border-radius: 4px; }
.skip:focus { left: .5rem; }

.bar, main, .foot { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }

/* ── Top bar */
.bar {
  position: sticky; top: 0; z-index: 20; max-width: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-block: .85rem; padding-inline: max(var(--gut), calc((100% - var(--max)) / 2 + var(--gut)));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.home { font: 600 1rem var(--mono); text-decoration: none; }
.caret { color: var(--amber); }
.bar nav { display: flex; gap: clamp(.9rem, 3vw, 1.75rem); }
.bar nav a { font-size: .95rem; text-decoration: none; color: var(--mute); padding-block: .35rem; border-bottom: 2px solid transparent; }
.bar nav a:hover { color: var(--ink); }
.bar nav a[aria-current] { color: var(--ink); border-color: var(--amber); }

main { flex: 1; }

/* ── Hero */
.hero {
  position: relative; isolation: isolate;
  padding-block: clamp(3rem, 11vh, 7rem) clamp(3rem, 9vh, 5.5rem);
}
.hero::before {
  content: ''; position: absolute; z-index: -1; inset: 0 calc(var(--gut) * -1);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 30% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 80% at 30% 45%, #000 30%, transparent 75%);
}
.prompt { font: .9rem var(--mono); color: var(--mute); margin-bottom: 1rem; }
.prompt .sigil { color: var(--amber); }
.hero h1 {
  font: 800 clamp(4.25rem, 19vw, 12.5rem)/.86 var(--display);
  letter-spacing: -.045em; margin-left: -.05em;
  font-variation-settings: 'opsz' 96;
}
.realname { margin-top: 1.1rem; font-size: clamp(1.25rem, 3.4vw, 1.6rem); font-weight: 600; letter-spacing: -.01em; }
.loc { color: var(--mute); font-weight: 400; font-size: .7em; margin-left: .5rem; }
.tagline { max-width: 36rem; margin-top: .9rem; font-size: clamp(1.05rem, 2.4vw, 1.2rem); line-height: 1.5; color: var(--mute); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; }
.now { margin-top: 2.25rem; font: .85rem var(--mono); color: var(--mute); display: flex; align-items: center; gap: .55rem; }
.now-k { color: var(--ink); }
.now-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent); }

/* ── Buttons */
.btn {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.15rem;
  border-radius: 6px; border: 1px solid var(--amber); background: var(--amber); color: var(--on-amber);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: color-mix(in srgb, var(--amber) 85%, var(--ink)); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--mute); background: var(--surface); }

/* ── Section scaffolding */
.block { padding-block: clamp(2.5rem, 7vh, 4.5rem); border-top: 1px solid var(--line); }
.block-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; margin-bottom: 1.75rem; }
.block-head h2 { font: 800 clamp(2.25rem, 6vw, 3.5rem)/1 var(--display); letter-spacing: -.035em; }
.aside { color: var(--mute); max-width: 26rem; }
.head-actions { display: flex; gap: .5rem; }

/* ── Filters */
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 2.5rem; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--mute); cursor: pointer; font-size: .9rem; display: inline-flex; align-items: center; gap: .45rem;
}
.chip:hover { color: var(--ink); border-color: var(--mute); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font: .75rem var(--mono); opacity: .7; }

/* ── Project cards */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 1rem; }
.card {
  display: flex; flex-direction: column; gap: .8rem;
  padding: 1.35rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.card.feature { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.card.feature h3 { font-size: clamp(1.75rem, 4.5vw, 2.5rem); }
.card.feature .sum { font-size: 1.08rem; max-width: 46rem; }
.card-top { display: flex; justify-content: space-between; gap: 1rem; font: .75rem var(--mono); color: var(--mute); }
.status::before { content: ''; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--mute); margin-right: .45rem; vertical-align: .05em; }
.status[data-s="live"], .status[data-s="running"] { color: var(--teal); }
.status[data-s="live"]::before, .status[data-s="running"]::before { background: var(--teal); }
.status[data-s="in progress"]::before { background: var(--amber); }
.card h3 { font: 700 1.4rem/1.15 var(--display); letter-spacing: -.02em; }
.sum { color: var(--mute); }
.arch summary { cursor: pointer; font-size: .9rem; font-weight: 600; width: fit-content; list-style: none; display: flex; align-items: center; gap: .4rem; min-height: 2rem; }
.arch summary::-webkit-details-marker { display: none; }
.arch summary::before { content: '+'; font-family: var(--mono); color: var(--amber); width: 1ch; }
.arch[open] summary::before { content: '−'; }
.arch p { font-size: .93rem; color: var(--mute); border-left: 2px solid var(--line); padding-left: .85rem; margin-top: .35rem; max-width: 46rem; }
.stack { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.stack li { font: .75rem/1 var(--mono); padding: .4rem .55rem; border-radius: 4px; background: var(--raise); border: 1px solid var(--line); color: var(--ink); }
.plinks { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; padding-top: .35rem; }
.plink { font-weight: 600; font-size: .95rem; text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: .25em; text-decoration-thickness: 2px; min-height: 2rem; display: inline-flex; align-items: center; }
.plink:hover { color: var(--amber); }
.empty { color: var(--mute); }

/* ── CV summary */
.cv-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem 3.5rem; }
.sub { font: 600 .8rem var(--mono); color: var(--mute); margin: 0 0 .75rem; }
.cv-col > .sub ~ .sub { margin-top: 2rem; }
.entry { padding-block: .9rem; border-top: 1px solid var(--line); }
.entry-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.entry h4 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.when { font: .75rem var(--mono); color: var(--mute); white-space: nowrap; }
.org { color: var(--ink); opacity: .85; font-size: .95rem; }
.detail { color: var(--mute); font-size: .95rem; margin-top: .3rem; }
.skill-row { padding-block: .9rem; border-top: 1px solid var(--line); }
.skill-row h4 { font-size: .95rem; font-weight: 600; margin-bottom: .55rem; }

/* ── Lab bento */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tile { padding: 1.35rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.tile.wide { grid-column: span 2; }
.tile h3 { font: 700 1.2rem var(--display); letter-spacing: -.01em; margin-bottom: .9rem; }
.tile dl div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding-block: .55rem; border-top: 1px dashed var(--line); }
.tile dt { font: .75rem/1.9 var(--mono); color: var(--mute); }
.tile dd { font-size: .98rem; }

/* ── Footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding-block: 2rem 2.5rem; border-top: 1px solid var(--line); color: var(--mute); font-size: .9rem; }
#foot-links { display: flex; gap: 1.25rem; }
#foot-links a:hover { color: var(--ink); }

/* ── Full CV dialog */
dialog#cv-dialog {
  width: min(100% - 1.5rem, 50rem); max-height: calc(100dvh - 1.5rem); margin: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0;
}
dialog#cv-dialog::backdrop { background: rgba(5, 10, 12, .7); backdrop-filter: blur(3px); }
.cvd-tools { position: sticky; top: 0; display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 1; }
.cvd { padding: clamp(1.25rem, 5vw, 2.75rem); }
.cvd-head { padding-bottom: 1.25rem; margin-bottom: .5rem; }
.cvd-head h2 { font: 800 clamp(2rem, 7vw, 2.75rem)/1 var(--display); letter-spacing: -.03em; }
.cvd-role { margin-top: .6rem; color: var(--mute); max-width: 38rem; }
.cvd-contact { margin-top: .6rem; font: .8rem var(--mono); color: var(--mute); }
.cvd section { margin-top: 1.5rem; }
.cvd h3 { font: 600 .8rem var(--mono); color: var(--amber); margin-bottom: .25rem; }
.noscript { padding: 2rem var(--gut); }

/* ── Small screens */
@media (max-width: 48rem) {
  .cv-grid { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .tile.wide { grid-column: auto; }
}
@media (max-width: 30rem) {
  .tile dl div { grid-template-columns: 1fr; gap: 0; }
  .loc { display: block; margin: .2rem 0 0; }
  .entry-top { flex-direction: column; gap: .1rem; }
}

/* ── One load moment: the name settles in */
@media (prefers-reduced-motion: no-preference) {
  .hero h1 { animation: settle .8s cubic-bezier(.2, .75, .2, 1) both; }
  @keyframes settle { from { opacity: 0; letter-spacing: -.02em; transform: translateY(.4rem); } }
}

/* ── Print: only the CV, black on white */
@media print {
  @page { margin: 14mm; }
  :root { --ink: #000; --mute: #333; --line: #bbb; --surface: #fff; --raise: #fff; --amber: #000; }
  body { background: #fff; display: block; }
  body > *:not(dialog) { display: none !important; }
  dialog#cv-dialog { display: block; position: absolute !important; inset: 0 auto auto 0; margin: 0; width: 100%; max-width: none; height: auto; max-height: none; border: 0; border-radius: 0; overflow: visible; }
  dialog#cv-dialog::backdrop { display: none; }
  dialog#cv-dialog:not([open]) { display: block; }
  .cvd-tools { display: none; }
  .cvd { padding: 0; }
  .entry, .skill-row { break-inside: avoid; }
  .stack li { border-color: #999; }
}
