/* =========================================================
   Cheryl Tang — portfolio
   Tokens
   ========================================================= */

:root {
  /* Colour */
  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #2b2b2b;
  --ink-soft: #5a5a5a;
  --ink-muted: #757575;
  --green-deep: #27391c;
  --green: #3a5a40;
  --rule: #1a1a1a;

  /* Project-page palette */
  --dark: #161221;
  --dark-raised: #292533;
  --band: #4c4c4c;
  --on-dark: #ffffff;
  --on-dark-soft: #dedce4;

  --placeholder: #e9e7e3;
  --placeholder-ink: #a09b93;

  /* Type */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Avenir Next", "Avenir", "Nunito Sans", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout — each --container-* is a *content* width; gutters sit outside it */
  --container: 1220px;        /* home + more image grids */
  --container-narrow: 1040px; /* about */
  --container-project: 1200px;
  --gutter: 30px;
  --gutter-wide: 40px;        /* header + project page */
  --header-h: 62px;
  --grid-gap: 10px;
  --panel-pad: 40px;          /* inner padding of project panels */
}

/* =========================================================
   Base
   ========================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* Keep [hidden] winning over the display rules further down. */
[hidden] { display: none !important; }

a { color: inherit; }

h1, h2, h3, p, dl, dd, figure { margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* =========================================================
   Image slots
   Every image sits in a `.ph` (placeholder) wrapper so the
   layout holds its shape before the real artwork is dropped
   in. If a file is missing, js/main.js flags the slot and we
   render its alt text as a label instead of a broken icon.
   ========================================================= */

.ph {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--placeholder);
}

.ph > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ph--contain > img { object-fit: contain; }

.is-missing::before {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--placeholder-ink);
}

/* =========================================================
   Header
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  padding: 0 var(--gutter-wide);
  max-width: calc(var(--container-project) + 2 * var(--gutter-wide));
  margin: 0 auto;
}

.brand {
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
}

.brand img { display: block; width: 100%; height: 100%; object-fit: contain; }

.brand.is-missing {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand.is-missing::before {
  content: attr(data-label);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--green-deep);
}

.nav {
  display: flex;
  align-items: center;
  gap: 34px;
}

.nav__link {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.2s ease;
}

.nav__link:hover { color: var(--green-deep); }

.nav__link.is-active {
  color: var(--green-deep);
  font-weight: 700;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  background: var(--surface);
  padding: 46px var(--gutter) 50px;
  text-align: center;
  color: var(--ink-muted);
}

.site-footer__links a {
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer__links a:hover { color: var(--green); }

.site-footer__sep {
  display: inline-block;
  margin: 0 22px;
  color: #bdbdbd;
}

.site-footer__copy { margin-top: 22px; }

/* =========================================================
   Page shells
   ========================================================= */

.container {
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: calc(var(--container-narrow) + 2 * var(--gutter));
}

/* =========================================================
   Home — intro
   ========================================================= */

.intro { padding: 46px 0 40px; }

.intro__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  color: var(--green-deep);
}

.intro__tagline {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 3.5vw, 45px);
  line-height: 1.1;
  color: var(--green);
}

/* =========================================================
   Work grid + tiles
   ========================================================= */

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
  padding-bottom: 50px;
}

.work-grid--top { padding-top: 40px; }

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--placeholder);
  text-decoration: none;
  color: var(--on-dark);
}

.tile > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

/* The dimmer is a layer rather than a filter on the image, so
   the hover state still reads while artwork is missing. */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 26, 0.62);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tile__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tile:hover > img,
.tile:focus-visible > img { transform: scale(1.04); }

.tile:hover::after,
.tile:focus-visible::after { opacity: 1; }

.tile:hover .tile__overlay,
.tile:focus-visible .tile__overlay { opacity: 1; }

.tile__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.tile__meta {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

/* A tile with no destination yet is not focusable and gets a
   plain cursor, but keeps the hover treatment. */
.tile:not([href]) { cursor: default; }

/* While artwork is still missing, drop the slot label on hover so it
   doesn't collide with the overlay copy. */
.tile.is-missing::before { transition: opacity 0.3s ease; }

.tile:hover.is-missing::before,
.tile:focus-visible.is-missing::before { opacity: 0; }

/* =========================================================
   About
   ========================================================= */

.about { padding: 40px 0 60px; }

.about__top {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 58px;
  align-items: start;
}

.about__portrait { aspect-ratio: 1 / 1; }

.about__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  color: var(--green-deep);
  margin-bottom: 26px;
}

.prose p { color: var(--ink-soft); }

.prose p + p { margin-top: 22px; }

.prose strong { color: var(--ink); font-weight: 600; }

/* Career timeline */

.timeline { margin-top: 34px; }

.timeline__row {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.timeline__year {
  text-align: right;
  color: var(--ink-muted);
  padding-top: 1px;
}

.timeline__role { margin: 0; color: var(--ink-soft); }

.timeline__role a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.timeline__co { color: var(--ink); }

.timeline__job { display: block; margin-top: 3px; }

/* Experience block */

.about__rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 56px 0 46px;
}

.about__bottom {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 58px;
  align-items: start;
}

.about__subtitle {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
}

.client-logos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 34px 30px;
  align-items: center;
}

.client-logos .ph {
  aspect-ratio: 3 / 1;
  background: transparent;
}

/* =========================================================
   Project page
   ========================================================= */

.project {
  max-width: calc(var(--container-project) + 2 * var(--gutter-wide));
  margin: 0 auto;
  padding: 0 var(--gutter-wide) 46px;
}

.panel { padding: 60px var(--panel-pad); }

.panel--dark { background: var(--dark); color: var(--on-dark); }

.panel--light { color: var(--ink); }

/* Images that run edge to edge inside a panel. */
.bleed { margin-inline: calc(var(--panel-pad) * -1); }

/* Hero */

.project-hero {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--dark);
}

.project-hero__copy {
  position: absolute;
  top: 44px;
  left: var(--panel-pad);
  z-index: 1;
  color: var(--on-dark);
}

.project-hero__title {
  font-size: clamp(28px, 3.6vw, 46px);
  font-weight: 300;
  letter-spacing: 0.2em;
}

.project-hero__subtitle {
  margin-top: 10px;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.project-hero__tools {
  position: absolute;
  top: 44px;
  right: var(--panel-pad);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.project-hero__tools .ph {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

/* Too small to carry a label — leave the empty square. */
.project-hero__tools .ph.is-missing::before { content: ""; }

/* Summary band */

.project-band {
  background: var(--band);
  color: var(--on-dark);
  padding: 46px var(--panel-pad);
  text-align: center;
  font-size: 18px;
}

/* Section headings + copy */

.section-head { text-align: center; }

.section-head__title {
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.section-head__sub {
  margin-top: 18px;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.panel--dark .section-head__sub { color: var(--on-dark-soft); }

.section-copy {
  max-width: 1064px;
  margin: 22px auto 0;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
  color: var(--on-dark-soft);
}

.panel--light .section-copy { color: var(--ink-soft); }

.section-copy + .section-copy { margin-top: 26px; }

.stack { margin-top: 48px; }

.stack--tight { margin-top: 28px; }

/* Media rows */

.media-row {
  display: grid;
  gap: 20px;
}

.media-row--2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

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

.media-row--gap-sm { gap: 20px; }

/* The sketch sheet is much wider than the model shelf beside it, and the
   pair shares one height — so the ratio lives on the row. */
.media-row--wide-narrow {
  grid-template-columns: 835fr 345fr;
  aspect-ratio: 1200 / 460;
}

.media-row--wide-narrow .ph { height: 100%; }

.media--diagram { background: #fff; }

.media--diagram > img { object-fit: contain; }

.media--2x1 { aspect-ratio: 2 / 1; }

.media--16x9 { aspect-ratio: 16 / 9; }

.media--4x3 { aspect-ratio: 4 / 3; }

.media--3x2 { aspect-ratio: 3 / 2; }

.media--1x1 { aspect-ratio: 1 / 1; }

.media--4x5 { aspect-ratio: 4 / 5; }

.media--3x4 { aspect-ratio: 3 / 4; }

.media--collage {
  aspect-ratio: 1200 / 809;
  background: var(--dark-raised);
}

/* A white sheet holding one or more full-width graphics that must not be
   cropped — the reference tables and technical diagrams. */
.media-sheet {
  background: #fff;
  font-size: 0;
}

.media-sheet img,
.media-sheet video { display: block; width: 100%; }

/* Looping clips stand in for what would otherwise be very large GIFs. */
.ph > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--diagram > video { object-fit: contain; }

/* A section that sits directly on the page ground rather than a panel. */
.panel--page { color: var(--ink); }

.panel--page .section-head__title { color: var(--dark); }

.panel--page .section-copy,
.panel--page .section-head__sub { color: var(--ink-soft); }

/* The Problem breakdown and the three strap concepts ship as artwork with
   their own transparent ground, so they get no placeholder fill. */
.figure-row {
  display: grid;
  align-items: start;
  margin-top: 44px;
}

.figure-row img { display: block; width: 100%; }

/* Sits marginally wider than the panel's own padding, as in the mockup. */
.figure-row--problem {
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-inline: -8px;
}

/* The card artwork carries its own margin, so the CSS gap is small — the
   ~50px seen between photos in the mockup is mostly the images' own padding. */
.figure-row--concepts {
  grid-template-columns: repeat(3, 1fr);
  gap: 19px;
}

/* Feature cards */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 56px 100px;
  margin-top: 48px;
}

.feature__media { aspect-ratio: 4 / 3; }

.feature__title {
  margin-top: 26px;
  font-size: 24px;
  font-weight: 400;
}

.feature__body {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--on-dark-soft);
}

/* Light closing section */

.panel--light .section-head__title { color: var(--dark); }

.context-stack { display: grid; gap: 19px; margin-top: 40px; }

/* =========================================================
   Nokia Micro Earbuds Pro
   ========================================================= */

.project--nokia {
  background: #fff;
  color: #666;
}

.project-hero--nokia {
  aspect-ratio: 1200 / 800;
  background: #eee;
}

.project-hero--nokia > img { object-position: center 42%; }

.project-hero__copy--nokia {
  color: #777;
  top: 48px;
}

.project-hero__copy--nokia .project-hero__title {
  font-size: clamp(30px, 4vw, 54px);
  letter-spacing: .22em;
}

.project-hero__copy--nokia .project-hero__subtitle {
  font-size: clamp(18px, 2vw, 28px);
  line-height: 1.12;
  letter-spacing: .18em;
}

.project-band--nokia {
  background: #fff;
  color: #999;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
}

.nokia-section {
  padding: 58px var(--panel-pad) 0;
  background: #fff;
}

.nokia-section--grey { background: #f1f0ef; }

.nokia-section--no-top { padding-top: 0; }

.nokia-section .section-head__title {
  color: #666;
  font-size: clamp(28px, 3vw, 40px);
}

.nokia-section .section-head__sub {
  color: #999;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.45;
}

.nokia-copy {
  padding: 44px 30px;
  color: #aaa;
  text-align: center;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.45;
}

.nokia-copy p + p { margin-top: 18px; }

.nokia-media {
  display: block;
  width: 100%;
  margin-top: 46px;
}

.nokia-media--flush {
  width: calc(100% + 2 * var(--panel-pad));
  max-width: none;
  margin-inline: calc(var(--panel-pad) * -1);
}

.nokia-media--contain {
  height: auto;
  object-fit: contain;
}

.nokia-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 46px;
}

.nokia-pair img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.nokia-pair--tall img { aspect-ratio: 1 / 1.45; }

.nokia-visual img {
  display: block;
  width: 100%;
}

.nokia-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 60px var(--panel-pad);
}

.nokia-products img { display: block; width: 100%; }

.nokia-head--after { padding: 52px 0 24px; }

.nokia-media--splash {
  margin: 0 auto;
  max-width: 900px;
}

.nokia-context { padding-bottom: 0; }

.nokia-context__stack {
  display: grid;
  gap: 18px;
  margin-top: 44px;
  margin-inline: calc(var(--panel-pad) * -1);
}

.nokia-context__stack img {
  display: block;
  width: 100%;
  max-height: 760px;
  object-fit: cover;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1000px) {
  .about__top,
  .about__bottom {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  /* Single column: lead with the portrait, then the intro, then the
     career list — the two-column reading order doesn't survive stacking. */
  .about__col { display: contents; }
  .about__portrait { order: 1; max-width: 460px; }
  .about__intro { order: 2; }
  .timeline { order: 3; margin-top: 0; }
  .about__experience { order: -1; }

  .feature-grid { gap: 44px 48px; }

  .media-row--wide-narrow { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --gutter: 20px; --gutter-wide: 20px; --panel-pad: 20px; }

  .work-grid { grid-template-columns: repeat(2, 1fr); }

  .feature-grid,
  .media-row--2,
  .media-row--3,
  .media-row--wide-narrow,
  .figure-row--problem,
  .figure-row--concepts,
  .nokia-pair,
  .nokia-products { grid-template-columns: 1fr; }

  .figure-row--problem { margin-inline: 0; }

  /* Stacked: each image goes back to carrying its own ratio. */
  .media-row--wide-narrow { aspect-ratio: auto; }
  .media-row--wide-narrow .ph:first-child { aspect-ratio: 16 / 9; }
  .media-row--wide-narrow .ph:last-child { aspect-ratio: 3 / 4; }
  .media-row--2 .ph { aspect-ratio: 3 / 4; }

  .panel { padding: 44px var(--panel-pad); }

  .project-hero { aspect-ratio: 4 / 5; }

  .project-hero--nokia { aspect-ratio: 4 / 5; }

  .project-hero--nokia > img { object-position: 56% center; }

  .project-hero__copy--nokia { top: 28px; }

  .nokia-products { padding-inline: 0; }

  .project-hero__tools { gap: 16px; }

  .nav { gap: 20px; }

  .site-footer__sep { margin: 0 10px; }
}

@media (max-width: 520px) {
  .work-grid { grid-template-columns: 1fr; }

  .site-footer__links a { display: block; }

  .site-footer__sep { display: none; }

  .timeline__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .timeline__year { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .tile:hover > img { transform: none; }
}
