/* ---------- Work: scroll-driven stack ---------- */
.work-track { position: relative; }           /* height is set by home.js */

.work-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  height: 100dvh;                              /* phones: follows the visible screen, so nothing is left over at the bottom when the browser bars tuck away */
  overflow: hidden;
}

.work-intro {
  position: absolute;
  left: 0; right: 0;
  top: 26vh;                                   /* home.js fine-tunes this */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  pointer-events: none;
  will-change: opacity, transform;
}
.work-intro h1 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(41px, 6vw, 86px);          /* 20% smaller than before */
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.work-intro h1, .work-intro p { will-change: transform; }
/* letter-by-letter reveal (scripts/hero-reveal.js); the intro stays hidden until the letters are ready */
.hero-pending .work-intro { visibility: hidden; }
.rv-word { display: inline-block; white-space: nowrap; }
/* the title under the name, 24px below it */
.work-intro p { margin: 24px 0 0; font-size: 23px; line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); }

.work-card {
  position: absolute;
  left: 0; top: 0;
  display: block;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transition: box-shadow .3s ease;
}
.work-card.is-peek { border-radius: var(--r-xl) var(--r-xl) 0 0; }
.work-card.is-peek:hover { box-shadow: var(--shadow-lift); }
.work-card img, .work-card video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  pointer-events: none;
}
.work-card-dim {
  position: absolute; inset: 0;
  background: var(--dim);
  opacity: 0;
  pointer-events: none;
}

/* Full-width glass strip along the bottom of the screen. Its content lines up with
   the card's left and right edges: home.js sets --card-inset to the card's side margin. */
.work-caption {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px var(--card-inset, var(--gutter)) 32px;
  opacity: 0;
  pointer-events: none;
}
/* the glass only appears while the drawer is open (on hover) */
.work-caption::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--header-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--hairline);
  opacity: 0;
  transition: opacity .4s ease;
}
.work-caption.is-open::before { opacity: 1; }
.work-caption .work-link { flex: none; }
.work-caption-text { display: flex; flex-direction: column; min-width: 0; }
.work-name { font-size: clamp(30px, 3.6vw, 56px); line-height: 1; font-weight: 500; letter-spacing: -0.03em; }

/* The caption shows the project name and the button. Hovering it or the project image
   (home.js adds .is-open) brings in the glass and grows it upward over the image to show
   the number and the intro. */
.work-more {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .55s var(--ease-out), opacity .3s ease;
}
.work-more > div { min-height: 0; overflow: hidden; }
.work-caption.is-open .work-more {
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows .55s var(--ease-out), opacity .45s ease .12s;
}
.work-counter { display: block; padding-bottom: 12px; font-size: 14px; color: var(--muted); }
.work-desc {
  display: block;
  max-width: 44ch;
  padding-top: 18px;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* ---------- About and contact ---------- */
.section {
  padding: 128px 0 112px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 80px;
}
/* breathing room between the last project and About */
#about { margin-top: clamp(96px, 16vh, 180px); }
.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 32px 64px;
}
.section-title { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.section-body { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

.big-statement {
  margin: 0;
  max-width: 26ch;
  font-size: 40px;
  line-height: 1.12;
}
.body-copy { margin: 0; max-width: 58ch; font-size: 18px; line-height: 1.6; color: var(--muted); }

.experience {
  width: 100%; border-collapse: collapse; text-align: left;
  font-size: 18px; line-height: 1.4;
}
.experience th {
  padding: 0 24px 12px 0; font-size: 16px; font-weight: 500; color: var(--muted);
}
.experience td { padding: 12px 24px 12px 0; border-top: 1px solid var(--line); vertical-align: top; }
.experience { table-layout: fixed; font-variant-numeric: tabular-nums; }
.experience th:nth-child(1), .experience td:nth-child(1) { width: 26%; }
.experience th:nth-child(2), .experience td:nth-child(2) { width: 24%; white-space: nowrap; }
.experience th:nth-child(3), .experience td:nth-child(3) { width: 50%; padding-right: 0; }
/* phones: two columns, with the years under the company name */
@media (max-width: 700px) {
  .experience, .experience thead, .experience tbody { display: block; }
  .experience tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    column-gap: 20px;
  }
  .experience th, .experience td { width: auto !important; padding: 0; border: 0; }
  .experience th { padding-bottom: 12px; }
  .experience th:nth-child(2) { display: none; }
  .experience tbody tr { grid-template-rows: auto 1fr; padding: 14px 0; border-top: 1px solid var(--line); }
  .experience td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .experience td:nth-child(2) { grid-column: 1; grid-row: 2; padding-top: 2px; font-size: 16px; color: var(--muted); }
  .experience td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
}

.about-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px 48px;
}
.list-title { margin: 0 0 12px; font-size: 16px; font-weight: 500; color: var(--muted); }
.plain-list {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 18px; line-height: 1.4;
}

.mail-link {
  align-self: flex-start;
  font-size: 32px;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.contact-links { display: flex; flex-wrap: wrap; gap: 8px 32px; font-size: 17px; }
.contact-links a { padding: 12px 0; text-underline-offset: 4px; }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  /* the caption sits right under the image, lined up with its edges (home.js sets
     --cap-top and --card-inset): number, name and intro, with a full-width button
     at the bottom of the screen */
  .work-caption {
    left: var(--card-inset, 16px); right: var(--card-inset, 16px);
    top: var(--cap-top, auto);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0;
  }
  .work-caption::before { display: none; }
  /* hero: as large as fits on one line each (the name about 85% of the width, the title edge to edge) */
  .work-intro h1 { font-size: clamp(54px, 17vw, 84px); }
  .work-intro p { margin-top: 18px; font-size: calc((100vw - 40px) / 11.2); }
  .work-more, .work-caption.is-open .work-more { grid-template-rows: 1fr; opacity: 1; }
  .work-counter { padding-bottom: 16px; font-size: 18px; }
  .work-name { font-size: clamp(34px, 10.5vw, 46px); }
  .work-desc { max-width: none; padding-top: 20px; font-size: clamp(20px, 5.8vw, 25px); line-height: 1.3; letter-spacing: -0.01em; }
  .work-caption .work-link { margin-top: auto; justify-content: space-between; }
  .section { padding: 72px 0; }
  #about { margin-top: 64px; }
  .section-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .big-statement { font-size: 30px; }
  .mail-link { font-size: 24px; }
}
