/* ============================================================
   Nguyen K. Phan — Portfolio / Interview Presentation
   Editorial academic · UH Scarlet · Newsreader + IBM Plex
   ============================================================ */

:root {
  /* palette */
  --paper:      #FBFAF7;
  --paper-2:    #F4F1EA;
  --ink:        #1A1714;
  --ink-soft:   #2E2A24;
  --muted:      #6B645C;
  --muted-2:    #948C81;
  --hair:       #E4DED5;
  --hair-2:     #D8D0C3;
  --scarlet:    #C8102E;
  --scarlet-d:  #9E0B23;
  --dark:       #1F1B14;
  --dark-2:     #2C271F;
  --on-dark:    #F2EDE4;
  --on-dark-mut:#A89F92;

  /* type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, monospace;

  --scale: 1;             /* tweakable global type scale */
  --t-display: calc(104px * var(--scale));
  --t-h1:      calc(72px  * var(--scale));
  --t-h2:      calc(48px  * var(--scale));
  --t-h3:      calc(30px  * var(--scale));
  --t-lead:    calc(25px  * var(--scale));
  --t-body:    calc(19px  * var(--scale));
  --t-small:   calc(16px  * var(--scale));
  --t-label:   calc(13px  * var(--scale));

  --mx: clamp(28px, 7vw, 132px);   /* section horizontal padding */
  --maxw: 1320px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.snap { scroll-snap-type: y proximity; }

/* ---------- scroll container ---------- */
.panel {
  position: relative;
  min-height: 100vh;
  padding: clamp(64px, 9vh, 116px) var(--mx);
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
  border-bottom: 1px solid var(--hair);
}
.panel > .inner { width: 100%; max-width: var(--maxw); margin: 0 auto; }

.panel.dark { background: var(--dark); color: var(--on-dark); border-bottom-color: #2c2720; }
.panel.dark .muted { color: var(--on-dark-mut); }
.panel.alt  { background: var(--paper-2); }

/* ---------- typography ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.02; letter-spacing: -0.015em; }
.display { font-size: var(--t-display); line-height: 0.96; letter-spacing: -0.03em; }
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); line-height: 1.12; }
em, .italic { font-style: italic; }

p { margin: 0 0 1em; }
.lead { font-size: var(--t-lead); line-height: 1.5; color: var(--ink-soft); }
.body { font-size: var(--t-body); }
.small { font-size: var(--t-small); }
.muted { color: var(--muted); }
.scarlet { color: var(--scarlet); }
strong, b { font-weight: 600; color: var(--ink); }
.dark strong { color: #fff; }

/* eyebrow / section index */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--scarlet);
  font-weight: 500;
  display: flex; align-items: center; gap: 14px;
}
.eyebrow .idx { color: var(--muted-2); }
.eyebrow .rule { flex: 1; height: 1px; background: var(--hair-2); max-width: 220px; }
.dark .eyebrow .rule { background: #3a342c; }

.kicker {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* links */
a { color: inherit; }
.link {
  color: var(--scarlet); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--scarlet) 35%, transparent);
  padding-bottom: 1px; transition: border-color .2s, color .2s;
}
.link:hover { border-bottom-color: var(--scarlet); }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: clamp(28px, 4vw, 64px); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-12 { grid-template-columns: repeat(12, 1fr); }
.flex { display: flex; }
.stack { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center-y { align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-s { gap: 12px; }
.gap-m { gap: 24px; }
.gap-l { gap: 48px; }

.mt-s { margin-top: 16px; } .mt-m { margin-top: 32px; } .mt-l { margin-top: 56px; }
.measure { max-width: 62ch; } .measure-s { max-width: 46ch; }

hr.hair { border: 0; border-top: 1px solid var(--hair); margin: 0; }
.dark hr.hair { border-top-color: #2c2720; }

/* ---------- header / section title block ---------- */
.section-head { margin-bottom: clamp(36px, 5vh, 64px); }
.section-head h2 { margin-top: 22px; max-width: 18ch; }
.section-head .lead { margin-top: 22px; }

/* ---------- stat figures ---------- */
.fig { font-family: var(--serif); font-size: clamp(46px, 5.4vw, 92px); line-height: 0.9; letter-spacing: -0.03em; }
.fig .unit { font-size: 0.42em; letter-spacing: 0; }
.fig.scarlet { color: var(--scarlet); }
.stat-label { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 14px; }

/* ---------- thrust / numbered cards ---------- */
.thrust { padding-top: 30px; border-top: 2px solid var(--ink); }
.dark .thrust { border-top-color: var(--on-dark); }
.thrust .num { font-family: var(--mono); font-size: var(--t-label); color: var(--scarlet); letter-spacing: 0.1em; }
.thrust h3 { margin: 18px 0 14px; }

/* ---------- browser frame for iframes/screenshots ---------- */
.browser {
  border: 1px solid var(--hair-2);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 30px 60px -34px rgba(40,30,20,.34);
}
.dark .browser { border-color: #342f28; box-shadow: 0 30px 70px -30px rgba(0,0,0,.6); }
.browser .bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--paper-2); border-bottom: 1px solid var(--hair-2);
}
.browser .dots { display: flex; gap: 7px; }
.browser .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--hair-2); display: block; }
.browser .url {
  flex: 1; font-family: var(--mono); font-size: 13px; color: var(--muted);
  background: #fff; border: 1px solid var(--hair); border-radius: 6px;
  padding: 5px 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; display: block; transition: background .15s, color .15s;
}
a.url:hover { background: var(--paper); color: var(--ink); cursor: pointer; }
.browser .url b { color: var(--ink); font-weight: 500; }
.browser .frame { width: 100%; display: block; border: 0; background: #fafafa; }
.browser iframe.frame { aspect-ratio: 16/9; height: auto; }
.browser img.frame { object-fit: cover; object-position: top center; }

.demo-cap { font-size: var(--t-small); color: var(--muted); margin-top: 16px; }

/* tag chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em;
  color: var(--ink-soft); background: transparent;
  border: 1px solid var(--hair-2); border-radius: 999px; padding: 5px 12px;
}
.dark .chip { color: var(--on-dark-mut); border-color: #3a342c; }
.chip.scarlet { color: var(--scarlet); border-color: color-mix(in srgb, var(--scarlet) 40%, transparent); }

/* ---------- publication list ---------- */
.pub { display: grid; grid-template-columns: 92px 1fr auto; gap: 28px; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--hair); }
.pub .year { font-family: var(--mono); font-size: var(--t-small); color: var(--muted); }
.pub .title { font-family: var(--serif); font-size: calc(23px * var(--scale)); line-height: 1.22; }
.pub .venue { font-size: var(--t-small); color: var(--muted); margin-top: 6px; }
.pub .venue .authors { font-style: italic; }
.pub .badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--scarlet); border: 1px solid color-mix(in srgb, var(--scarlet) 40%, transparent); border-radius: 4px; padding: 4px 8px; white-space: nowrap; }
.pub.flag .title { color: var(--ink); }

/* ---------- people / mentees ---------- */
.people { display: flex; flex-wrap: wrap; gap: 14px 30px; }
.person { display: flex; align-items: baseline; gap: 12px; }
.person .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--scarlet); flex: none; transform: translateY(-2px); }
.person .name { font-family: var(--serif); font-size: calc(26px * var(--scale)); }

/* ---------- list with scarlet markers ---------- */
ul.marks { list-style: none; padding: 0; margin: 0; }
ul.marks li { position: relative; padding-left: 30px; margin-bottom: 18px; }
ul.marks li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 14px; height: 1px; background: var(--scarlet); }

/* ---------- vision course pills ---------- */
.course { padding: 18px 0; border-top: 1px solid var(--hair); display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.dark .course { border-top-color: #2c2720; }
.course .c-name { font-family: var(--serif); font-size: calc(26px * var(--scale)); }
.course .c-tag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--scarlet); white-space: nowrap; }

/* ============================================================
   Presenter chrome
   ============================================================ */
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--scarlet); width: 0; z-index: 60; transition: width .12s linear; }

.sidenav { display: none; }
.sidenav button {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px; padding: 0; color: var(--muted);
}
.sidenav .tick { width: 26px; height: 2px; background: var(--hair-2); transition: background .2s, width .2s; }
.sidenav .tlabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0; transform: translateX(6px); transition: opacity .2s, transform .2s; white-space: nowrap; }
.sidenav button:hover .tlabel { opacity: 1; transform: translateX(0); }
.sidenav button:hover .tick { background: var(--muted); }
.sidenav button.active .tick { background: var(--scarlet); width: 38px; }
.sidenav button.active .tlabel { opacity: 1; transform: translateX(0); color: var(--ink); }
/* hide side labels over dark panels handled in JS via body theme not needed; keep subtle */

.foot { position: fixed; left: clamp(20px, 4vw, 48px); bottom: 20px; z-index: 55; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); pointer-events: none; opacity: 0; transition: opacity .3s; }
.scrollcue { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); display: flex; flex-direction: column; align-items: center; gap: 8px; transition: opacity .3s; }

/* FAB nav button + popover */
.fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--scarlet); border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18), 0 6px 24px rgba(200,16,46,.28);
  transition: background .2s, transform .15s;
}
.fab:hover { background: var(--scarlet-d); transform: translateY(-2px); }
.fab svg { display: block; }

.nav-popover {
  position: fixed; bottom: 90px; right: 28px; z-index: 59;
  background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.12), 0 8px 32px rgba(0,0,0,.18);
  border: 1px solid var(--hair); overflow: hidden;
  max-height: 60vh; overflow-y: auto;
}
.popover-content { padding: 0; }
.nav-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 18px; border: 0; background: none;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  cursor: pointer; transition: background .15s, color .15s;
  border-bottom: 1px solid var(--hair);
}
.nav-item:last-child { border-bottom: none; }
.nav-item:hover { background: var(--paper-2); color: var(--scarlet); }
.nav-item.current { background: color-mix(in srgb, var(--scarlet) 8%, transparent); color: var(--scarlet); font-weight: 600; }
.scrollcue .arr { width: 1px; height: 26px; background: var(--hair-2); position: relative; overflow: hidden; }
.scrollcue .arr::after { content: ""; position: absolute; left: 0; top: -50%; width: 1px; height: 50%; background: var(--scarlet); animation: cue 1.8s infinite; }
@keyframes cue { 0% { top: -50%; } 60%,100% { top: 100%; } }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .08s; } .reveal.d2 { transition-delay: .16s; } .reveal.d3 { transition-delay: .24s; } .reveal.d4 { transition-delay: .32s; } .reveal.d5 { transition-delay: .40s; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .cols-3 { grid-template-columns: 1fr; }
  .sidenav { display: none; }
}
@media (max-width: 860px) {
  :root { --scale: 0.82; }
  .cols-2 { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .pub .badge { justify-self: start; }
}

@media print {
  body { height: auto; overflow: visible; }
  .panel { min-height: auto; page-break-inside: avoid; }
  .progress, .sidenav, .foot, .scrollcue { display: none; }
}
