/* ==========================================================
   Zackaryaa Ishraq — portfolio
   Every colour, radius and easing curve is a token below.
   ========================================================== */
:root {
  --paper: #F4F3EF;
  --card: #FAF9F6;
  --ink: #0C0D10;
  --ink-2: #53555C;
  --ink-3: #8D8F96;
  --line: rgba(12, 13, 16, .10);
  --line-2: rgba(12, 13, 16, .18);
  --cobalt: #1E3AF0;
  --cobalt-soft: rgba(30, 58, 240, .08);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pad: clamp(20px, 7.5vw, 112px);
  --r-outer: 24px;
  --r-gap: 8px;
  --r-inner: max(0px, calc(var(--r-outer) - var(--r-gap)));

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--sans); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--cobalt); color: #fff; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wrap { max-width: 1480px; margin: 0 auto; padding-inline: var(--pad); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, box-shadow 200ms ease;
}
.btn:active { transform: scale(.97); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink svg { transition: transform 200ms var(--ease-out); }
.btn-ink[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- Header ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: 64px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-inline: var(--pad);
  transition: background-color 300ms ease;
}
.bar::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: var(--line); opacity: 0; transition: opacity 300ms ease; }
.bar.scrolled { background: rgba(244, 243, 239, .82); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
.bar.scrolled::after { opacity: 1; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: -.02em; justify-self: start; }
.links { display: flex; gap: 28px; font-size: 14px; color: var(--ink-2); }
.links a { position: relative; padding: 6px 0; transition: color 200ms ease; }
.links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 300ms var(--ease-out); }
.links a.on { color: var(--ink); }
.links a.on::after { transform: scaleX(1); }
.contact { justify-self: end; position: relative; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--cobalt), var(--crimson)); transform: scaleX(0); transform-origin: left; z-index: 1; }

.pop-label { font-size: 12px; color: var(--ink-3); }
.pop-value { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, border-color 200ms ease; }
.copy:active { transform: scale(.97); }
.copy span { display: block; transition: filter 200ms ease, opacity 200ms ease; }
.copy.swap span { filter: blur(3px); opacity: 0; }
.copy.done { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; padding-top: 104px; padding-bottom: 28px;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-rows: 1fr auto;
  column-gap: 32px; align-items: center;
}
.hello { font-size: clamp(16px, 1.4vw, 20px); color: var(--ink-2); margin-bottom: 18px; }
.id-line { font-size: clamp(46px, 6.5vw, 100px); font-weight: 500; line-height: .96; letter-spacing: -.045em; }
.id-line em { font-style: normal; color: var(--cobalt); }
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line > span { display: block; }
.js .line > span { transform: translateY(110%); transition: transform 900ms var(--ease-out); }
.js .loaded .line > span { transform: none; }
.id-line .line:nth-child(1) > span { transition-delay: 80ms; }
.id-line .line:nth-child(2) > span { transition-delay: 160ms; }
.lede { max-width: 30em; margin-top: 28px; font-size: clamp(17px, 1.45vw, 20px); line-height: 1.5; color: var(--ink-2); }

.dock canvas { display: block; width: 100%; height: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: translateY(3px); } }

/* ---------- Section head ---------- */
section[id]:not(.hero) { padding-bottom: clamp(72px, 10vw, 144px); }
#work { padding-top: clamp(56px, 8vw, 112px); }
.sec-head { display: grid; grid-template-columns: 56px auto 1fr; align-items: baseline; gap: 0 8px; padding-top: 20px; border-top: 1px solid var(--ink); margin-bottom: clamp(28px, 4vw, 56px); }
.sec-head .idx { font-size: 13px; color: var(--ink-3); }
.sec-head h2 { font-size: clamp(28px, 3.2vw, 44px); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
.sec-head p { justify-self: end; text-align: right; font-size: 14px; color: var(--ink-2); }

.live { width: 7px; height: 7px; border-radius: 50%; background: #18A957; box-shadow: 0 0 0 3px rgba(24,169,87,.16); }
.go { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; font-size: 15px; font-weight: 500; padding-bottom: 3px; border-bottom: 1px solid var(--ink); transition: color 200ms ease, border-color 200ms ease; }
.go svg { transition: transform 240ms var(--ease-out); }

.viz {
  position: relative; aspect-ratio: 16 / 11; overflow: hidden;
  background-color: var(--card);
  background-image: radial-gradient(rgba(12,13,16,.09) 1px, transparent 1px);
  background-size: 22px 22px; background-position: 11px 11px;
  border: 1px solid var(--line); border-radius: var(--r-outer);
  box-shadow: 0 1px 0 #fff inset, 0 24px 48px -32px rgba(12,13,16,.22);
}

/* QuantDrill panel */
.qd { position: absolute; inset: 8%; display: grid; grid-template-rows: auto 1fr auto auto; gap: 14px; padding: clamp(16px, 2.4vw, 28px); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-inner); box-shadow: 0 20px 40px -24px rgba(12,13,16,.25); }
.qd-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.qd-label { font-size: 12px; color: var(--ink-3); }
.qd-timer { height: 3px; border-radius: 3px; background: rgba(12,13,16,.08); overflow: hidden; }
.qd-timer i { display: block; height: 100%; background: var(--ink); transform-origin: left; }
.qd-score { font-size: 15px; font-weight: 500; min-width: 3ch; text-align: right; }
.qd-q { align-self: center; display: flex; justify-content: center; align-items: baseline; gap: .3em; white-space: nowrap; font-size: clamp(22px, 3.3vw, 46px); font-weight: 500; letter-spacing: -.05em; line-height: 1; }
.qd-eq { color: var(--ink-3); }
.qd-a { color: var(--cobalt); min-width: 4.4ch; }
.qd-a::after { content: ""; display: inline-block; width: 2px; height: .8em; margin-left: 3px; background: var(--cobalt); vertical-align: -.05em; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.qd-rank { display: flex; align-items: baseline; justify-content: space-between; }
.qd-rank b { font-size: 16px; font-weight: 500; letter-spacing: -.02em; transition: filter 200ms ease, opacity 200ms ease; }
.qd-rank b.swap { filter: blur(3px); opacity: 0; }
.qd-ladder { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.qd-ladder li { height: 6px; border-radius: 2px; background: rgba(12,13,16,.09); transition: background-color 300ms ease; }
.qd-ladder li.on { background: var(--cobalt); }

/* Courier sim panel */
.viz-sim canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sim-ui { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; background: rgba(250,249,246,.9); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.seg button { position: relative; z-index: 1; height: 30px; padding: 0 12px; font-size: 12px; font-weight: 500; color: var(--ink-2); border-radius: 999px; transition: color 200ms ease, transform 160ms var(--ease-out); white-space: nowrap; }
.seg button:active { transform: scale(.97); }
.seg button[aria-selected="true"] { color: var(--paper); }
.seg-pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--ink); transition: transform 280ms var(--ease-in-out); }
.sim-read { display: flex; gap: 14px; padding: 7px 12px; font-size: 12px; color: var(--ink-2); border-radius: 999px; background: rgba(250,249,246,.9); border: 1px solid var(--line); }
.sim-read b { font-weight: 500; color: var(--ink); display: inline-block; min-width: 3.2ch; text-align: right; }
.sim-note { position: absolute; left: 16px; bottom: 12px; right: 16px; font-size: 12px; color: var(--ink-3); }

/* UMT sheets */
.viz-sheets { display: grid; place-items: center; }
.fan { position: relative; width: 34%; aspect-ratio: 210 / 297; margin-top: 4%; }
.sheet {
  position: absolute; inset: 0; padding: 9% 9%; display: flex; flex-direction: column; gap: 5.2%;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 1px 2px rgba(12,13,16,.05), 0 16px 28px -18px rgba(12,13,16,.3);
  transform-origin: 50% 120%;
  transform: rotate(calc((var(--n) - 1.5) * 2deg));
  transition: transform 420ms var(--ease-out);
  transition-delay: calc(var(--n) * 30ms);
}
.viz-sheets.in .sheet { transform: rotate(calc((var(--n) - 1.5) * 13deg)) translateY(calc(abs(var(--n) - 1.5) * 2%)); }
.sheet header { display: grid; padding-bottom: 6%; border-bottom: 1.5px solid var(--cobalt); }
.sheet header b { font: 600 clamp(9px, 1.15vw, 15px)/1.1 var(--sans); letter-spacing: -.02em; color: var(--cobalt); }
.sheet header span { font-size: clamp(6px, .62vw, 9px); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet p { font-size: clamp(5px, .55vw, 8px); color: var(--ink-3); }
.sheet i { display: block; height: 2px; border-radius: 2px; background: rgba(12,13,16,.14); }
.sheet i.s { width: 62%; }
.sheet em { align-self: flex-end; margin-top: -7%; font: 500 clamp(5px, .55vw, 8px)/1 var(--mono); color: var(--ink-2); }

.badge { font-size: 12px; font-weight: 500; letter-spacing: 0; padding: 3px 9px; border-radius: 999px; background: var(--cobalt-soft); color: var(--cobalt); }

/* ---------- Experience ---------- */
.tl li { display: grid; grid-template-columns: 168px 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; padding-top: 0; }
.when { font-size: 13px; color: var(--ink-3); padding-top: 4px; }
.tl h3 { font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.org { font-size: 14px; color: var(--cobalt); font-weight: 500; margin-top: 2px; }
.tl p:not(.org) { margin-top: 8px; color: var(--ink-2); max-width: 38em; }

/* ---------- Awards index ---------- */
.index li { display: grid; grid-template-columns: 168px 1fr auto; gap: 16px; align-items: baseline; padding: 15px 0; border-top: 1px solid var(--line); transition: background-color 200ms ease; }
.index li:last-child { border-bottom: 1px solid var(--line); }
.cat { font-size: 13px; color: var(--ink-3); }
.what { font-size: clamp(16px, 1.5vw, 20px); font-weight: 500; letter-spacing: -.02em; transition: transform 300ms var(--ease-out); }
.res { font-size: 14px; color: var(--ink-2); text-align: right; transition: color 200ms ease; }

/* ---------- Leadership ---------- */
.lead { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (min-width: 901px) { .lead article:nth-child(n+4) { grid-column: span 3; } }   /* three across, then two wider */
.lead article { grid-column: span 2; padding: 22px; min-height: 168px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-outer); }
.role { align-self: flex-start; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--cobalt-soft); color: var(--cobalt); }
.lead h3 { margin-top: auto; padding-top: 28px; font-size: 21px; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; }
.lead p { margin-top: 6px; font-size: 14px; color: var(--ink-2); }

/* ---------- Footer ---------- */
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 28px 112px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.foot a { color: var(--ink); font-weight: 500; }

/* ---------- Fixed corner pieces ---------- */
.resume { position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40; height: 44px; padding: 0 18px; }
.dock {
  position: fixed; right: 20px; bottom: calc(max(20px, env(safe-area-inset-bottom)) + 56px); z-index: 40;
  width: clamp(48px, calc(var(--pad) - 24px), 88px); height: clamp(48px, calc(var(--pad) - 24px), 88px); right: 12px; border-radius: 50%; overflow: hidden;
  background: var(--card); border: 1px solid var(--line-2);
  box-shadow: 0 12px 32px -12px rgba(12,13,16,.3);
  opacity: 0; transform: scale(.9) translateY(8px); pointer-events: none; visibility: hidden;
  transition: opacity 160ms ease, transform 160ms var(--ease-out), visibility 0s 160ms;
}
.dock[data-on] { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 240ms ease, transform 400ms var(--ease-out), visibility 0s; }
.dock[data-on]:active { transform: scale(.97); }
.no-gl .dock { display: none; }

/* ---------- Scroll reveals ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 700ms ease, transform 800ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-reveal].in { opacity: 1; transform: none; }
.js .index [data-reveal] { transition-duration: 500ms, 600ms; }

/* ---------- Hover (real pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .links a:hover { color: var(--ink); }
  .links a:hover::after { transform: scaleX(1); }
  .btn-ink:hover { background: #23252b; }
  .copy:hover { border-color: var(--ink); }
  .copy.done:hover { border-color: var(--cobalt); }
  .go:hover { color: var(--cobalt); border-color: var(--cobalt); }
  .go:hover svg { transform: translate(2px, -2px); }
  .index li:hover .what { transform: translateX(8px); }
  .index li:hover .res { color: var(--cobalt); }
  .viz-sheets:hover .sheet { transform: rotate(calc((var(--n) - 1.5) * 17deg)) translateY(calc(abs(var(--n) - 1.5) * 3%)); transition-duration: 500ms; transition-delay: 0ms; }
}

/* ---------- Tablet and phone ---------- */
@media (max-width: 900px) {
  .links { display: none; }
  .dock { width: 72px; height: 72px; }
  .bar { grid-template-columns: 1fr auto; }
  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto auto; row-gap: 8px; padding-top: 88px; align-items: start; }
  .lead article { grid-column: span 3; }
  .lead article:last-child { grid-column: span 6; }
}
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  .sec-head { grid-template-columns: 36px 1fr; }
  .sec-head p { grid-column: 2; justify-self: start; text-align: left; margin-top: 6px; }
  .tl li { grid-template-columns: 1fr; gap: 6px; }
  .index li { grid-template-columns: 1fr auto; }
  .index .cat { grid-column: 1 / -1; }
  .index .cat:empty { display: none; }
  .lead { grid-template-columns: 1fr; }
  .lead article, .lead article:last-child { grid-column: auto; min-height: 0; }
  .viz { aspect-ratio: 4 / 3.6; }
  .fan { width: 40%; }
  .sim-ui { left: 10px; right: 10px; top: 10px; }
  .seg button { padding: 0 10px; font-size: 11px; }
  .sim-read { font-size: 11px; gap: 10px; }
  .dock { right: 14px; width: 60px; height: 60px; }
  .resume { right: 14px; }
}

/* ---------- Reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal], .js .line > span { transform: none !important; }
  .js .line > span { opacity: 0; transition: opacity 400ms ease; }
  .js .loaded .line > span { opacity: 1; }
  .sheet, .seg-pill, .what { transition-duration: 0ms; }
}
