/* ============================================================
   Linus Louie — FinTech Portfolio
   Site stylesheet. Imports design-system tokens, then applies
   the Meta-blue-on-warm palette override and component styles.
   ============================================================ */

@import url("./tokens/fonts.css");
@import url("./tokens/colors.css");
@import url("./tokens/typography.css");
@import url("./tokens/spacing.css");

/* ---- Palette override: Meta-blue-on-warm (per brief) ---------
   Overrides the monochrome base ink + introduces an accent. */
:root {
  --ink: #1C2B33;
  --ink-soft: #37474F;
  --text-muted: #6B6B66;
  --accent: #0082FB;
  --accent-hover: #0064E0;
}

/* ---- Base ---- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface-warm);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---- Layout helpers ---- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.section {
  border-top: 1px solid var(--line);
  position: relative;          /* own stacking context — content can't paint over neighbours */
  z-index: 0;
  isolation: isolate;
}
.section--white { background: var(--surface); }
.section--warm  { background: var(--surface-warm); }
.section__inner {
  position: relative;
  z-index: 0;
  padding-top: 140px;
  padding-bottom: 140px;
}

/* ---- Overline / eyebrow ---- */
.overline {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.overline--muted { color: var(--text-muted); letter-spacing: 0.08em; }
.overline--sm { font-size: 12px; }

/* ---- Headings ---- */
.h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 60px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
}

.lead {
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--ink-soft);
}
.footnote {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(240, 238, 230, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.nav__brand {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav__link {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s var(--ease);
}
.nav__link:hover { color: var(--ink); }
.nav__link.is-active { color: var(--accent); font-weight: 600; }
.nav__link--cta { color: var(--accent); font-weight: 600; }
.nav__link--cta:hover { color: var(--accent-hover); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 13px 24px;
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn--primary {
  color: #fff;
  background: var(--accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn--secondary {
  color: var(--accent);
  background: transparent;
}
.btn--secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* ---- Text link with arrow ---- */
.link {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.link:hover { color: var(--accent-hover); }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding-top: 120px; padding-bottom: 96px; }
.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 72px;
  align-items: center;
}
.hero__title { margin-top: 28px; }
.hero__lead { margin: 28px 0 0; max-width: 46ch; }
.hero__actions { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }
.hero__note { margin: 40px 0 0; }

/* Cover-page contact block (resume-style header) */
.contact-card { margin-bottom: 28px; }
.contact-card__name {
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.contact-card__row {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.contact-card__link { color: var(--ink-soft); text-decoration: none; }
.contact-card__link:hover { color: var(--accent); }
.contact-card__sep { color: var(--line); }

/* ============================================================
   MEDIA PLACEHOLDERS
   Neutral slots for photos / video / embeds until real assets land.
   ============================================================ */
.media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-warm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 10px;
}
.media--lg { border-radius: var(--radius-lg); }
.media--onwhite { background: var(--surface); }
/* When a real image fills the slot, drop the inner padding + gap */
.media--img { padding: 0; gap: 0; position: relative; }
.media__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Play badge overlaid on a real image/thumbnail */
.media--img .media__play,
.media--img .media__play--sm,
.media--img .media__play--xs,
.media--img .media__play--lg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.media__label {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.media__label--sm { font-size: 10px; }
.media__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  padding-left: 3px;
}
.media__play--sm { width: 38px; height: 38px; font-size: 13px; }
.media__play--xs { width: 34px; height: 34px; font-size: 12px; padding-left: 2px; }
.media__play--lg { width: 48px; height: 48px; font-size: 16px; }

/* Placeholder media — for blue "to include" assets not yet supplied */
.media--placeholder {
  border-style: dashed;
  border-color: var(--accent);
  background: var(--surface-warm);
  padding: 20px;
}
.media--placeholder .footnote { color: var(--accent); max-width: 40ch; }

/* Aspect-ratio utilities */
.ar-4-5  { aspect-ratio: 4 / 5; }
.ar-4-3  { aspect-ratio: 4 / 3; }
.ar-3-2  { aspect-ratio: 3 / 2; }
.ar-3-4  { aspect-ratio: 3 / 4; }
.ar-16-9 { aspect-ratio: 16 / 9; }
.ar-16-10 { aspect-ratio: 16 / 10; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.card--feature { padding: 40px; }
.card--column { display: flex; flex-direction: column; gap: 18px; }
.card--column-sm { display: flex; flex-direction: column; gap: 16px; padding: 28px; }

.card__overline { }
.card__title { }
.card__body { }
.card__foot { margin-top: auto; padding-top: 6px; font-family: var(--font-sans); font-size: 15px; font-weight: 500; }
.card__links { display: flex; gap: 20px; margin-top: 24px; font-family: var(--font-sans); font-size: 15px; font-weight: 500; }

/* ---- Tech chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  line-height: 1.3;
  white-space: nowrap;
}

/* ---- Grids ---- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ---- Photo gallery (small multi-image strips) ---- */
.gallery {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  align-items: start;          /* don't stretch a short figure to a tall sibling's height */
}
.gallery--2 { grid-template-columns: repeat(2, 1fr); }
.gallery--3 { grid-template-columns: repeat(3, 1fr); }
.gallery--4 { grid-template-columns: repeat(4, 1fr); }
.gallery__item {
  display: block;              /* an inline <a> with aspect-ratio mis-sizes and overflows */
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-warm);
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s var(--ease);
}
.gallery__item:hover img { transform: scale(1.04); }
@media (max-width: 720px) {
  .gallery--3, .gallery--4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(20, 20, 19, 0.88);
  backdrop-filter: blur(4px);
}
.lightbox.is-open { display: flex; }
.lightbox__img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.8;
}
.lightbox__close:hover { opacity: 1; }

/* Video modal: responsive 16:9 iframe */
.lightbox__frame {
  width: min(92vw, 1100px);
  aspect-ratio: 16 / 9;
  max-height: 88vh;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  background: #000;
}
.lightbox__frame iframe,
.lightbox__frame .lightbox__video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.lightbox__frame .lightbox__video {
  object-fit: contain;
  background: #000;
}
/* Vertical YouTube Shorts: 9:16 portrait frame instead of 16:9 */
.lightbox--portrait .lightbox__frame {
  aspect-ratio: 9 / 16;
  width: auto;
  height: min(88vh, 900px);
  max-width: 92vw;
}
/* A ▶ thumbnail rendered as a real button */
button.media--video {
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  width: 100%;
}
.media--video .media__play { transition: transform .25s var(--ease); }
.media--video:hover .media__play { transform: translate(-50%, -50%) scale(1.08); }

/* ---- Full-width feature video (landscape Drive embeds, "trading-app style") ---- */
.feature-video {
  margin: 32px 0 0;
}
.feature-video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.feature-video__frame .media__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
/* Inline autoplaying video (local clips) — fills the 16:9 frame cleanly.
   Native controls provide the play/pause prompt, so no overlay is drawn. */
.feature-video__frame .inline-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.feature-video__frame.has-inline-video { cursor: default; }

/* Poster-style video frames (external YouTube/Drive embeds, and the
   reduced-motion fallback) open a modal on click, so they get a clean
   CSS play cue drawn on the frame — no markup badge needed. */
.feature-video__frame:not(.has-inline-video)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: var(--accent);
  /* white play triangle, centred */
  background-image:
    linear-gradient(var(--accent), var(--accent)),
    conic-gradient(from 90deg at 50% 50%, transparent 0, transparent 100%);
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  transition: transform .2s var(--ease), background-color .2s var(--ease);
  pointer-events: none;
}
.feature-video__frame:not(.has-inline-video)::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
  pointer-events: none;
  transition: transform .2s var(--ease);
}
.feature-video__frame:not(.has-inline-video):hover::after {
  transform: translate(-50%, -50%) scale(1.08);
  background-color: var(--accent-hover);
}
.feature-video__frame:not(.has-inline-video):hover::before {
  transform: translate(-40%, -50%) scale(1.08);
}
.feature-video figcaption { margin-top: 12px; }
/* Two feature videos side by side on wide screens */
.feature-video-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}
@media (max-width: 760px) {
  .feature-video-pair { grid-template-columns: 1fr; }
}

/* ---- Captioned figures for images (whole-image, clickable) ---- */
figure.media-figure { margin: 0; display: flex; flex-direction: column; }
figure.media-figure figcaption { margin-top: 10px; }

/* A gallery item that shows the WHOLE image (no crop) — for certs, screenshots */
.gallery__item--contain { aspect-ratio: auto; background: var(--surface); }
.gallery__item--contain img { object-fit: contain; height: auto; }

/* Wider 16:9 thumbnail for panoramic event photos so they aren't hard-cropped
   the way the default 4:3 slot crops them. Click still opens the full image. */
.gallery__item--wide { aspect-ratio: 16 / 9; }

/* Safety: a video button with no mapped poster still reads as video, not a
   broken image — hide the empty <img> and lean on the dark frame + ▶ badge */
.feature-video__frame.is-unposter img { visibility: hidden; }

/* Unresolved Drive assets: keep layout, flag as pending placeholder */
[data-drive].is-unresolved {
  border: 1px dashed var(--accent);
  background: var(--surface-warm);
  min-height: 120px;
}
img[data-drive].is-unresolved {
  /* hide the broken-image glyph; show the alt via the wrapper instead */
  visibility: hidden;
}
a[data-drive].is-unresolved { opacity: 0.5; pointer-events: none; }
.pending-note {
  display: none;               /* hidden once the asset resolves */
  color: var(--accent);
  font-style: italic;
  padding: 16px;
}
/* Show the note only while the asset is still an unresolved placeholder */
[data-drive].is-unresolved .pending-note,
.is-unresolved > .pending-note { display: block; }
a[data-drive].is-unresolved,
button[data-drive].is-unresolved {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ============================================================
   WORK / APPLIED LEARNING
   ============================================================ */
.feature-oxo {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}
.feature-oxo__media {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
}

/* Quant feature — video is the centrepiece, so it takes the wider column */
.feature-quant {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 44px;
  align-items: start;
}
.quant-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
  margin-top: 28px;
}
.feature-quant__demo { margin: 0; position: sticky; top: 96px; }
.quant-video {
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #000;
  /* Match the real footage (384x832) and show the whole frame — no crop.
     Height-driven so the box hugs the portrait video instead of letterboxing. */
  aspect-ratio: 384 / 832;
  height: 72vh;
  max-height: 640px;
  object-fit: contain;
}

@media (max-width: 1000px) {
  .feature-quant { grid-template-columns: 1fr; gap: 32px; }
  .feature-quant__demo { position: static; max-width: 340px; }
}
@media (max-width: 720px) {
  .quant-facts { grid-template-columns: 1fr; gap: 22px; }
  .feature-quant__demo { max-width: 320px; margin-left: auto; margin-right: auto; }
}

/* ============================================================
   ENTREPRENEURSHIP
   ============================================================ */
.ent__grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 56px;
  align-items: center;
  margin-top: 56px;
}
.stats { display: flex; gap: 48px; margin-top: 44px; flex-wrap: wrap; }
.stat__num {
  font-family: var(--font-serif);
  font-size: 52px;
  line-height: 1;
  font-weight: 600;
  color: var(--accent);
}
.stat__label {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
  margin-top: 10px;
  max-width: 12ch;
}
.card--chargee {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  gap: 40px;
  align-items: center;
}

/* ============================================================
   LEADERSHIP
   ============================================================ */
.feature-captain {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.feature-captain__media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ============================================================
   TESTIMONIALS
   ============================================================ */
.testimonial {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.testimonial__quote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}
.testimonial__cite {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
  font-style: normal;
}
.testimonial__name { font-weight: 500; color: var(--ink-soft); }

/* ============================================================
   FOOTER CTA
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
}
.footer__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 56px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #fff;
}
.footer__lead {
  margin: 24px 0 0;
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  max-width: 42ch;
}
.footer__links { display: flex; gap: 28px; margin-top: 48px; flex-wrap: wrap; }
.footer__link {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  padding-bottom: 3px;
  transition: border-color .15s var(--ease);
}
.footer__link:hover { color: #fff; border-bottom-color: var(--accent); }
.footer__note {
  margin: 64px 0 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .hero__grid { grid-template-columns: 1fr; gap: 48px; }
  .feature-oxo,
  .feature-captain,
  .ent__grid,
  .card--chargee { grid-template-columns: 1fr; gap: 32px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .h1 { font-size: 48px; }
  .footer__title { font-size: 44px; }
}

@media (max-width: 720px) {
  .section__inner { padding-top: 88px; padding-bottom: 88px; }
  .hero { padding-top: 80px; padding-bottom: 64px; }
  .nav__links { gap: 16px; overflow-x: auto; }
  .grid-2,
  .grid-3,
  .testimonials-grid { grid-template-columns: 1fr; }
  .feature-oxo__media,
  .feature-captain__media { grid-template-columns: 1fr; }
  .h1 { font-size: 38px; }
  .h2 { font-size: 30px; }
  .footer__title { font-size: 36px; }
  .card--feature { padding: 28px; }
  .stats { gap: 32px; }
  .stat__num { font-size: 44px; }
}

@media (max-width: 480px) {
  .nav__links { gap: 14px; }
  .nav__link { font-size: 14px; }
}
