@charset "UTF-8";

/* ==========================================================================
   Junwen Rao — résumé · content blocks, motion, responsive, print
   Loaded last. Depends on tokens from style.css.

     1. Experience timeline
     2. Education
     3. Skills
     4. Closing & footer
     5. Reveal — scroll-triggered entrances
     6. Responsive
     7. Print — A4, static charts, no motion
   ========================================================================== */

/* ==========================================================================
   1. Experience timeline
   ========================================================================== */

.timeline {
  display: flex;
  flex-direction: column;
}

.role {
  position: relative;
  padding-block: clamp(var(--s-6), 5vw, var(--s-8));
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

.role + .role {
  border-top: 1px solid var(--rule-soft);
}

/* --- Left rail: period, kind, and the timeline dot -------------------- */

.role__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.role__period {
  font-size: var(--t-small);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--blue);
  white-space: nowrap;
}

.role__kind {
  font-size: var(--t-eyebrow);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--warm);
}

/* --- Right column ----------------------------------------------------- */

.role__body {
  min-width: 0;
}

.role__org {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.2rem + 0.9vw, 2rem);
  font-weight: 400;
  line-height: var(--lh-snug);
  letter-spacing: -0.018em;
  color: var(--deep);
  text-wrap: balance;
}

html[lang^='zh'] .role__org {
  letter-spacing: 0.015em;
}

.role__title {
  margin-top: var(--s-1);
  font-size: var(--t-body);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--blue);
}

.role__bullets {
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-width: var(--measure);
}

.role__bullets li {
  position: relative;
  padding-left: var(--s-5);
  line-height: var(--lh-body);
}

html[lang^='zh'] .role__bullets li {
  line-height: 1.9;
}

/* A short rule rather than a bullet glyph — quieter, and it aligns to the
   first line's optical centre at every type size. */
.role__bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 0.75rem;
  height: 1px;
  background: var(--rule);
}

.role__figure {
  margin-top: clamp(var(--s-6), 4vw, var(--s-7));
  padding: clamp(var(--s-5), 3vw, var(--s-6));
  background: var(--paper);
  border: 1px solid var(--rule-soft);
}

/* ==========================================================================
   2. Education
   ========================================================================== */

.edu {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(var(--s-5), 4vw, var(--s-8));
  align-items: start;
}

.edu__school {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2.25rem);
  font-weight: 400;
  line-height: var(--lh-snug);
  letter-spacing: -0.018em;
  color: var(--deep);
}

html[lang^='zh'] .edu__school {
  letter-spacing: 0.015em;
}

.edu__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-2);
}

.edu__degree {
  font-size: var(--t-lead);
  color: var(--blue);
  font-family: var(--font-display);
}

.edu__period {
  font-size: var(--t-small);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--warm);
}

.edu__courses {
  margin-top: clamp(var(--s-5), 3vw, var(--s-6));
}

.edu__courses-label {
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: var(--s-3);
}

.edu__courses-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* The scholarship figure, set as a standalone stat. */
.honour {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: clamp(var(--s-5), 3vw, var(--s-6));
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  text-align: right;
  white-space: nowrap;
}

.honour__value {
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem);
  font-weight: 600;
  color: var(--deep);
  letter-spacing: -0.025em;
  line-height: 1;
  font-variant-numeric: proportional-nums;
}

.honour__label {
  font-size: var(--t-eyebrow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
}

/* ==========================================================================
   3. Skills
   --------------------------------------------------------------------------
   No proficiency bars or radar charts. Self-assigned scores ("Product ops
   85%") have no source, and a reader can tell — so this is a labelled matrix.
   ========================================================================== */

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
}

.skillgroup {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: clamp(var(--s-5), 3vw, var(--s-6));
  background: var(--cream);
}

.skillgroup__label {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--deep);
}

html[lang^='zh'] .skillgroup__label {
  letter-spacing: 0.02em;
}

.skillgroup__items {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--t-small);
  color: var(--ink);
}

.skillgroup__items li {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  line-height: 1.5;
}

.skillgroup__items li::before {
  content: '';
  flex: none;
  width: 3px;
  height: 3px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--blue);
}

/* ==========================================================================
   4. Closing & footer
   ========================================================================== */

.closing {
  background: var(--deep);
  color: var(--cream);
}

.closing__headline {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: 400;
  line-height: var(--lh-snug);
  letter-spacing: -0.02em;
  color: var(--cream);
  max-width: 34ch;
  text-wrap: balance;
}

html[lang^='zh'] .closing__headline {
  letter-spacing: 0.02em;
}

/* Secondary text on the deep-blue panel uses pre-composited opaque tones rather
   than a transparent cream. Alpha would leave the real contrast dependent on
   whatever is painted behind, which makes it unverifiable; these are measured:
   --cream-dim  8.9:1  and  --cream-dimmer  5.5:1  against #002F66. */
.closing {
  --cream-dim: #d1d8bd;
  --cream-dimmer: #99aba6;
}

.closing__body {
  max-width: 48ch;
  margin-top: var(--s-5);
  font-size: var(--t-lead);
  line-height: 1.65;
  color: var(--cream-dim);
}

html[lang^='zh'] .closing__body {
  line-height: 1.9;
}

.closing__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  margin-top: clamp(var(--s-6), 4vw, var(--s-7));
}

.closing__link {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.closing__link-label {
  font-size: var(--t-eyebrow);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cream-dimmer);
}

.closing__link a,
.closing__link span {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  color: var(--cream);
  letter-spacing: 0.01em;
  border-bottom: 1px solid color-mix(in srgb, var(--cream) 35%, transparent);
  padding-bottom: 2px;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.closing__link a:hover {
  border-bottom-color: var(--cream);
  text-decoration: none;
}

.footer {
  padding-block: var(--s-6);
  border-top: 1px solid color-mix(in srgb, var(--cream) 20%, transparent);
  margin-top: clamp(var(--s-7), 6vw, var(--s-9));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--t-micro);
  color: var(--cream-dimmer);
}

/* Padding brings the link to the 24×24px WCAG 2.2 target minimum; the negative
   inline margin keeps it optically flush with the footer edge. */
.footer a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding-inline: var(--s-2);
  margin-inline: calc(var(--s-2) * -1);
  color: var(--cream-dim);
}

.footer a:hover {
  color: var(--cream);
}

/* ==========================================================================
   5. Reveal
   --------------------------------------------------------------------------
   Entrances are opt-in per element via `data-reveal`, toggled by an
   IntersectionObserver that unobserves after firing — so elements animate
   once and never flicker when scrolling back up.

   The no-JS and reduced-motion paths both leave content fully visible: the
   animation is decoration on top of a complete page, never a gate on it.
   ========================================================================== */

/* Only hide content when JS is present to reveal it again. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-shift, 1.25rem));
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

html.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* Staggered children: each step delays by its index, set inline by the build
   as --i, so a list resolves in sequence rather than all at once. */
html.js [data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(0.875rem);
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

html.js [data-reveal-stagger].is-revealed > * {
  opacity: 1;
  transform: none;
}

/* Section headings get a slightly longer travel for a more deliberate entrance. */
.section__head[data-reveal] {
  --reveal-shift: 1.75rem;
}

/* --- Reduced motion ---------------------------------------------------
   Everything resolves to its final state instantly. Chart fills are shown
   at full extent rather than mid-transition. */
@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal],
  html.js [data-reveal-stagger] > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__line > span,
  .hero::before,
  .hero__eyebrow::after,
  .hero__hint {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .hero__hint-line::after {
    animation: none;
  }

  .delta__bar,
  .funnel__fill,
  .propbar__fill {
    transform: none;
    transition: none;
  }

  .ring__value {
    stroke-dashoffset: 0;
    transition: none;
  }

  .progress__fill,
  .langtoggle__thumb {
    transition: none;
  }

  * {
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   6. Responsive
   ========================================================================== */

/* --- Tablet and below: collapse the two-column editorial grid ---------- */
@media (max-width: 900px) {
  .grid,
  .role {
    grid-template-columns: minmax(0, 1fr);
  }

  .role__aside {
    flex-direction: row;
    align-items: baseline;
    gap: var(--s-4);
  }

  .edu {
    grid-template-columns: minmax(0, 1fr);
  }

  .honour {
    text-align: left;
    align-items: flex-start;
  }

  .tagmatrix__group {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-2);
  }
}

/* --- Phones ----------------------------------------------------------- */
@media (max-width: 600px) {
  .hero {
    min-height: auto;
    padding-block: 8rem var(--s-8);
  }

  .hero__hint {
    display: none;
  }

  .delta {
    gap: var(--s-5);
  }

  .delta__lift {
    padding-bottom: 0;
  }

  .topbar {
    padding-inline: var(--s-4);
  }

  /* The PDF button loses its label but keeps its accessible name. */
  .btn-ghost__text {
    display: none;
  }
}

/* --- Very narrow: keep the funnel readable ---------------------------- */
@media (max-width: 420px) {
  .funnel__row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-2);
  }

  .stats,
  .skills {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Coarse pointers: bigger hit targets ------------------------------ */
@media (pointer: coarse) {
  .langtoggle__btn {
    padding: 0.5rem 0.8rem;
  }

  .btn-ghost {
    padding: 0.55rem 1rem;
  }
}

/* ==========================================================================
   7. Print
   --------------------------------------------------------------------------
   Many recruiters download and forward a résumé, so the printed form matters
   as much as the screen one. Charts survive as static marks (their transforms
   are reset to full extent) and all values remain as text.
   ========================================================================== */

@page {
  size: A4;
  margin: 14mm 15mm;
}

@media print {
  :root {
    /* Ink on white prints legibly and cheaply; the cream field does not. */
    --cream: #ffffff;
    --cream-deep: #ffffff;
    --paper: #ffffff;
    --rule-soft: #b9c4d8;
    --gutter: 0;
    /* Section rhythm collapses hard: on screen the whitespace is the design,
       on paper it is wasted pages. */
    --s-section: 5mm;
    --s-5: 0.5rem;
    --s-6: 0.7rem;
    --s-7: 0.9rem;
    --s-8: 1rem;
    --s-9: 1.2rem;
    --t-body: 9pt;
    --t-small: 8pt;
    --t-micro: 7pt;
    --t-eyebrow: 6.5pt;
    --t-lead: 10pt;
    --t-h2: 14pt;
    --t-h3: 10.5pt;
    --t-display: 26pt;
    --t-figure: 15pt;
    --measure: none;
    --maxw: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: var(--t-body);
    line-height: 1.42;
  }

  html[lang^='zh'] body {
    font-size: var(--t-body);
    line-height: 1.5;
  }

  html[lang^='zh'] .role__bullets li,
  html[lang^='zh'] .hero__tagline,
  html[lang^='zh'] .closing__body {
    line-height: 1.5;
  }

  /* Screen-only chrome. */
  .topbar,
  .progress,
  .railnav,
  .skip-link,
  .hero__hint,
  .datatable,
  .backtotop {
    display: none !important;
  }

  /* The per-role charts restate figures the bullets already give in words
     ("from roughly 40% to above 55%"), and the Results section up top carries
     the same numbers as graphics. On screen the repetition is reinforcement; on
     paper it is a wasted page, so the inline role figures come out and the
     Results summary stays.
     Exception: the research-coverage tag matrix is not a duplicate — those
     competitor and platform names appear nowhere else — so it is kept. */
  .role__figure:has(.delta),
  .role__figure:has(.funnel) {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-block: 0 6mm;
  }

  .hero::before {
    display: none;
  }

  .hero__name {
    font-size: var(--t-display);
  }

  /* NOT `break-inside: avoid` — a section taller than the remaining page then
     pushes to a fresh sheet and leaves the rest of the current one blank, which
     is what turned a 5-page document into 8. Sections may split; the smaller
     units inside them (a role, a stat tile) are what must stay intact. */
  .section {
    padding-block: 4mm 0;
    border-top: 0.5pt solid var(--rule-soft);
  }

  /* Keep a heading with the content it introduces. */
  .section__head {
    break-after: avoid;
    margin-bottom: 3mm;
  }

  .section__title,
  .role__org,
  .edu__school,
  .closing__headline {
    break-after: avoid;
  }

  .section--tint,
  .closing {
    background: #fff;
  }

  .closing,
  .closing__headline,
  .closing__body,
  .closing__link a,
  .closing__link span,
  .closing__link-label,
  .footer,
  .footer a {
    color: #000;
  }

  .closing__link a,
  .closing__link span {
    border-bottom-color: var(--rule-soft);
  }

  /* Chart marks: skip the animation, print at full extent. */
  html.js [data-reveal],
  html.js [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }

  .delta__bar,
  .funnel__fill,
  .propbar__fill {
    transform: none !important;
    transition: none !important;
    /* Background colours are dropped by default in print; force them so the
       marks are not blank outlines. */
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .ring__value,
  .ring__track {
    stroke-dashoffset: 0 !important;
    transition: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Grid gaps rely on a background showing through; print needs real rules.
     Column counts are also fixed rather than auto-fit: `minmax()` against an
     A4 width would stack these into two tall columns and cost a page. */
  .stats,
  .skills {
    background: none;
    border: 0.5pt solid var(--rule-soft);
    gap: 0;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .skills {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat,
  .skillgroup {
    border-right: 0.5pt solid var(--rule-soft);
    border-bottom: 0.5pt solid var(--rule-soft);
    padding: 2.5mm;
    gap: 2mm;
    break-inside: avoid;
  }

  /* The ring is sized in rem for screen; on paper it only needs to read. */
  .ring {
    width: 20mm;
  }

  .delta__pair {
    height: 14mm;
  }

  .stat__note {
    /* The note repeats the experience bullets; the label and figure carry the
       point on paper. */
    display: none;
  }

  .stat,
  .skillgroup,
  .figure,
  .edu,
  .honour,
  .delta,
  .ring,
  .funnel,
  .propbar {
    break-inside: avoid;
  }

  /* A role may split across a page boundary if it must, but never leave fewer
     than two lines stranded on either side. */
  .role {
    padding-block: 3mm;
    orphans: 2;
    widows: 2;
  }

  .role__bullets {
    margin-top: 2mm;
    gap: 1.5mm;
  }

  .role__bullets li {
    padding-left: 4mm;
  }

  .role__bullets li::before {
    width: 2.5mm;
  }

  /* The hero's two-line display name is a single unit. */
  .hero__name,
  .hero__eyebrow,
  .hero__role {
    break-inside: avoid;
  }

  .hero__facts,
  .hero__contact {
    margin-top: 2mm;
  }

  .hero__tagline {
    margin-top: 2mm;
    max-width: none;
  }

  .role__figure {
    border: 0.5pt solid var(--rule-soft);
    padding: 3mm;
    margin-top: 3mm;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  /* Reveal destination URLs that a printed page would otherwise hide. */
  .closing__link a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    color: #444;
  }
}
