/* Casey Kawahara — portfolio */

:root {
  --paper: #EDF0EE;        /* pale sage-grey, like a whiteboard wall */
  --card: #FFFFFF;
  --ink: #1D2126;
  --ink-soft: #545B63;
  --heading: #3A4048;      /* all headings: a shade softer than the ink */
  --rule: #D5DAD7;
  --deep-blue: #2D5F94;         /* Deep Blue (links, hovers, focus rings, flowchart answers) */
  --deep-blue-tint: #DCEBFA;    /* pale sky */
  --teal: #218380;              /* Teal */
  --teal-tint: #E1F0EF;

  --display: "Unbounded", sans-serif;  /* wide, softly rounded headline face that echoes Nunito */
  --sans: "Nunito", system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1280px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--deep-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---------- Nav ---------- */

.site-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.logo-mark svg { width: 100%; height: 100%; }
.logo-disc { fill: var(--heading); transition: fill .15s; }
.logo-letters { stroke: var(--paper); }
.logo-mark:hover .logo-disc,
.logo-mark:focus-visible .logo-disc { fill: var(--deep-blue); }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.8vw, 24px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  white-space: nowrap;
  font-size: 0.9375rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color .15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }

.nav-links a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.nav-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  position: relative;
  top: 5px;
}
.nav-icon svg { width: 100%; height: 100%; }

/* ---------- Home ---------- */

.home {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) var(--gutter) 80px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}

.intro { padding-top: clamp(8px, 4vh, 48px); }

.intro h1 {
  font-family: var(--display);
  font-weight: 700;
  color: var(--heading);
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);  /* wide letters: sized so "nice to meet you" holds one line */
  text-wrap: balance;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 0.45em;
}

.intro p {
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 34em;
  margin: 0 0 1.25em;
}

.intro a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: #AEB5B1;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color .15s, text-decoration-color .15s;
}
.intro a:hover { color: var(--deep-blue); text-decoration-color: currentColor; }

/* ---------- Flowchart card ---------- */

.chart-card {
  /* tokens consumed by the flowchart markup */
  --surface-1: var(--paper);
  --border: #D3D9D6;
  --border-strong: #AEB5B1;
  --border-stronger: #1D2126;
  --text-primary: var(--ink);
  --text-secondary: var(--ink);
  --text-muted: #6B727A;
  --fill-primary: var(--heading);  /* current question box: soft charcoal */
  --on-primary: #FFFFFF;
  --bg-accent: var(--deep-blue-tint);
  --fill-accent: var(--deep-blue);
  --border-accent: var(--deep-blue);
  --text-accent: var(--deep-blue);
  --on-accent: #FFFFFF;
  --bg-success: var(--teal-tint);
  --border-success: #7DB8B6;
  --text-success: var(--teal);
  --bg-warning: var(--teal-tint);
  --border-warning: #7DB8B6;
  --text-warning: var(--teal);
  --fill-ghost-hover: #E2E6E4;
}

.chart-canvas { padding: 0; }

.chart-canvas svg text { font-family: var(--sans); }

/* answered path lines and arrowheads in Teal */
.chart-canvas .ce.tr { stroke: var(--teal); }
.chart-canvas #as path { stroke: var(--teal); }

/* every ending shows in Teal once someone lands on it */
.chart-canvas .rn.r-p rect { fill: var(--bg-success); stroke: var(--border-success); }
.chart-canvas .rn.r-p text { fill: var(--text-success); }

.chart-card #foot,
.chart-card #rp { border-top: 0; background: transparent; }

/* Happy endings: the result label hops when someone lands on it.
   The hop pivots on a point in chart coordinates that index.html sets on the label
   (Safari reads a label-relative transform-origin from the wrong spot and flings the text). */
.rn.r-f text,
.rn.r-p text {
  transform-box: view-box;
  animation: happy-hop 1.2s cubic-bezier(.3, .7, .4, 1) .2s both;
}

/* Friends! gets the hop twice to stand apart from Practically friends */
.rn.r-f text { animation-iteration-count: 2; }

/* Practically friends: a smaller, calmer hop */
.rn.r-p text { animation: happy-hop-soft 1s cubic-bezier(.3, .7, .4, 1) .2s both; }

@keyframes happy-hop-soft {
  0%   { transform: translateY(0) scale(1, 1) rotate(0); }
  15%  { transform: translateY(0) scale(1.04, .96) rotate(0); }
  35%  { transform: translateY(-4px) scale(.99, 1.02) rotate(-1.5deg); }
  55%  { transform: translateY(0) scale(1.02, .98) rotate(0); }
  75%  { transform: translateY(-1.5px) scale(1, 1) rotate(1deg); }
  100% { transform: translateY(0) scale(1, 1) rotate(0); }
}

@keyframes happy-hop {
  0%   { transform: translateY(0) scale(1, 1) rotate(0); }
  12%  { transform: translateY(0) scale(1.1, .9) rotate(0); }
  26%  { transform: translateY(-7px) scale(.96, 1.06) rotate(-3deg); }
  40%  { transform: translateY(0) scale(1.06, .94) rotate(0); }
  54%  { transform: translateY(-4px) scale(.98, 1.03) rotate(3deg); }
  68%  { transform: translateY(0) scale(1.03, .97) rotate(0); }
  82%  { transform: translateY(-1.5px) scale(1, 1) rotate(-1deg); }
  100% { transform: translateY(0) scale(1, 1) rotate(0); }
}

.confetti { pointer-events: none; }
.confetti rect,
.confetti circle {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: confetti-pop 1.1s cubic-bezier(.15, .7, .35, 1) both;
}

@keyframes confetti-pop {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0) scale(.4); }
  12%  { opacity: 1; }
  70%  { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); }
}

.confetti .fall { animation-name: confetti-fall; animation-timing-function: linear; }

@keyframes confetti-fall {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0); }
  15%  { opacity: .9; }
  50%  { transform: translate(calc(var(--dx) * -.6), calc(var(--dy) * .5)) rotate(calc(var(--rot) * .5)); }
  80%  { opacity: .8; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* Lukewarm ending: a slow shrug — lift, hold, sigh back down, lazy tilt
   (pivot set from index.html, same as the happy endings above) */
.rn.r-m text {
  transform-box: view-box;
  animation: meh-shrug 1.8s ease-in-out .2s both;
}

@keyframes meh-shrug {
  0%   { transform: translateY(0) scale(1, 1) rotate(0); }
  18%  { transform: translateY(-3px) scale(1.02, 1.04) rotate(0); }
  38%  { transform: translateY(-3px) scale(1.02, 1.04) rotate(0); }
  52%  { transform: translateY(1px) scale(1.01, .97) rotate(0); }
  66%  { transform: translateY(0) scale(1, 1) rotate(-2deg); }
  82%  { transform: translateY(0) scale(1, 1) rotate(1deg); }
  100% { transform: translateY(0) scale(1, 1) rotate(0); }
}

/* ---------- Placeholder pages ---------- */

.placeholder {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 10vh, 120px) var(--gutter) 80px;
}

.placeholder h1 {
  font-family: var(--display);
  color: var(--heading);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);  /* matches the homepage headline */
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

.placeholder p {
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
  color: var(--ink-soft);
  max-width: 32em;
  margin: 0 0 1em;
}

.placeholder a {
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* ---------- Side projects ---------- */

.projects {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) var(--gutter) 96px;
}

.projects h1 {
  font-family: var(--display);
  color: var(--heading);
  font-weight: 700;
  font-size: clamp(1.375rem, 2.4vw, 2rem);
  text-wrap: balance;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 clamp(32px, 5vh, 56px);
}

.project + .project { margin-top: clamp(16px, 2.5vh, 30px); }

/* description on the left, photos on the right */
.project {
  display: grid;
  grid-template-columns: minmax(0, 20.4rem) minmax(0, 648px);
  gap: clamp(6px, 0.8vw, 10px);  /* same gap as between the photos */
  align-items: start;
  justify-content: center;
}

.project h2 {
  font-family: var(--display);
  color: var(--heading);
  font-weight: 700;
  font-size: clamp(1.375rem, 2vw, 1.5rem);  /* Unbounded is wide: 24px fits the card */
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

/* text sits in a card with the same corners and height as the photos */
.project-text {
  align-self: stretch;
  background: rgba(255, 255, 255, .4);  /* 40% white so it sits back against the page */
  border-radius: 12px;
  padding: clamp(24px, 2.64vw, 34px);
}

.project-text p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.project-text p + p { margin-top: 0.75em; }

.project-link {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.project-link:hover { background: var(--deep-blue); }

/* until the URL is ready the button shows but does nothing */
.project-link[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* stacked: card above photos, both the photos' width so edges line up */
@media (max-width: 860px) {
  .project {
    grid-template-columns: minmax(0, 1fr);
    max-width: 648px;
    margin-inline: auto;
  }
  .project-text { align-self: auto; }
}

/* one large photo with two details stacked beside it */
.project-gallery {
  max-width: 648px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: clamp(6px, 0.8vw, 10px);
}

.project-gallery figure { margin: 0; }
.project-gallery .shot-main { grid-row: 1 / span 2; }

/* every photo gets a fixed shape; no percentage heights (Safari can collapse those) */
.project-gallery img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  background: var(--rule);
}

/* the big photo fills the height of the two stacked ones beside it */
.project-gallery:not(.wide) .shot-main { position: relative; }
.project-gallery:not(.wide) .shot-main .zoom,
.project-gallery:not(.wide) .shot-main > img { position: absolute; inset: 0; }
.project-gallery:not(.wide) .shot-main img { height: 100%; aspect-ratio: auto; }

@media (max-width: 640px) {
  .project-gallery { grid-template-columns: 1fr 1fr; }
  .project-gallery .shot-main { grid-column: 1 / -1; grid-row: auto; }
  .project-gallery:not(.wide) .shot-main { position: static; }
  .project-gallery:not(.wide) .shot-main .zoom,
  .project-gallery:not(.wide) .shot-main > img { position: static; }
  .project-gallery:not(.wide) .shot-main img { height: auto; aspect-ratio: 3 / 4; }
}

/* landscape photo sets: one wide photo on top, three details below */
.project-gallery.wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto;
}
.project-gallery.wide .shot-main { grid-column: 1 / -1; grid-row: auto; }
.project-gallery.wide .shot-main img { aspect-ratio: 3 / 2; }
.project-gallery.wide figure:not(.shot-main) img { aspect-ratio: 4 / 3; }

@media (max-width: 640px) {
  .project-gallery.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* three landscape shots: one wide on top, two side by side below */
.project-gallery.wide.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-gallery.wide.pair figure:not(.shot-main) img { aspect-ratio: 16 / 9; }
@media (max-width: 640px) {
  .project-gallery.wide.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* square photo sets: one big square with four small squares beside it */
.project-gallery.squares { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
.project-gallery.squares figure:not(.shot-main) img { aspect-ratio: 1 / 1; }
@media (max-width: 640px) {
  .project-gallery.squares { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-gallery.squares .shot-main img { aspect-ratio: 1 / 1; }
}

/* a single screenshot: one wide frame, cropped only at the sides */
/* at least 3:2, and grows to match the card if the text runs taller */
.project-gallery.single { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; align-self: stretch; }
.project-gallery.single .shot-main { grid-row: auto; position: relative; aspect-ratio: 3 / 2; align-self: stretch; justify-self: stretch; width: 100%; }
.project-gallery.single .shot-main .zoom,
.project-gallery.single .shot-main > img { position: absolute; inset: 0; }
.project-gallery.single .shot-main img { height: 100%; aspect-ratio: auto; }

/* photos open larger when clicked */
.project-gallery .zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 12px;
  cursor: zoom-in;
}

.lb-open { overflow: hidden; }

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.lightbox[open] {
  display: grid;
  place-items: center;
  animation: lb-in .22s ease-out;
}
.lightbox::backdrop { background: rgba(29, 33, 38, .88); }

/* quick clicks on the arrows count as a double-click, which selected the photo and tinted it blue */
.lightbox,
.project-gallery,
.cs-carousel-stage,
.cs-figure img { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

.lightbox img {
  display: block;
  max-width: min(94vw, 1600px);
  max-height: 88vh;
  max-height: 88dvh;
  width: auto;
  height: auto;
  border-radius: 12px;
  cursor: default;
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

.lb-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #FFFFFF;
  cursor: pointer;
  transition: background .15s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .26); }
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.lb-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 3px; }

.lb-close { top: 20px; right: 20px; }
.lb-prev  { left: 20px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox.single .lb-prev,
.lightbox.single .lb-next { display: none; }

@media (max-width: 640px) {
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
  .lightbox img { max-height: 76vh; max-height: 76dvh; }
}

/* ---------- Case studies ---------- */

/* same top spacing as the Side projects page */
.placeholder.cs-index { padding-top: clamp(24px, 6vh, 72px); }

/* index: case studies stacked, each card centered with the image on top and centered text below */
.cs-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: grid;
  gap: clamp(48px, 7vh, 72px);  /* open space between case studies now that there's no card edge */
  max-width: 880px;
}

/* no container: just the image, with the title and summary centered below */
.cs-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}
.cs-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 0;
  border-radius: 12px;
  background: var(--rule);
}
.cs-card-text {
  padding: clamp(18px, 2.4vw, 28px) clamp(8px, 4vw, 48px) 0;
  text-align: center;
}
.placeholder .cs-card h2 { transition: color .15s; }
.cs-card a:hover h2 { color: var(--deep-blue); }
.placeholder .cs-card h2 {
  font-family: var(--display);
  font-weight: 700;
  color: var(--heading);
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.placeholder .cs-card p { font-size: 1rem; line-height: 1.6; margin: 0 auto; max-width: 34em; }
.placeholder .cs-card .cs-card-meta { margin-top: 14px; font-size: 0.875rem; color: var(--ink-soft); }

/* case study page: text column for reading, images span the full content width */
.case-study {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(24px, 6vh, 64px) var(--gutter) 120px;
}
.case-study article { max-width: 780px; margin: 0 auto; }  /* text and images share one width */

.cs-back { margin: 0 0 20px; font-size: 0.9375rem; }
.cs-back a { color: var(--ink-soft); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cs-back a:hover { color: var(--deep-blue); }
.cs-footer {                                   /* second "All case studies" link at the end of a case study */
  margin-top: clamp(56px, 7.7vh, 90px);
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.cs-footer .cs-back { margin: 0; }

.cs-header h1 {
  font-family: var(--display);
  font-weight: 700;
  color: var(--heading);
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}
.cs-subtitle {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 36em;
  margin: 0 0 28px;
}

.cs-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 0;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cs-facts dt { font-size: 0.8125rem; font-weight: 700; color: var(--heading); margin-bottom: 4px; }
.cs-facts dd { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--ink-soft); }

.cs-header + .cs-body { margin-top: 56px; }   /* spacing when the results row is hidden */

/* headline results: a quiet row under the project details, not a feature */
.cs-stats {
  list-style: none;
  margin: 0 0 56px;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
}
.cs-stats li { display: flex; flex-direction: column; gap: 4px; }
.cs-stat-value {
  font-weight: 700;
  color: var(--heading);
  font-size: 1rem;
  line-height: 1.4;
}
.cs-stat-label { font-size: 0.875rem; line-height: 1.45; color: var(--ink-soft); }

/* long-form copy */

.cs-body p,
.cs-body li {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.cs-body p { margin: 0 0 1.25em; }
.cs-body ul, .cs-body ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.cs-body li { margin-bottom: 0.45em; }
.cs-body li::marker { color: var(--heading); }
.cs-body strong { font-weight: 700; color: var(--heading); }

.cs-body h2 {
  font-family: var(--display);
  font-weight: 700;
  color: var(--heading);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.cs-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.3;
  margin: clamp(56px, 8vh, 80px) 0 14px;
}
.cs-body h2 + h3 { margin-top: 8px; }

/* each part of the story is its own section, separated by space and a rule */
.cs-section + .cs-section {
  margin-top: clamp(67px, 9.8vh, 112px);
  padding-top: clamp(56px, 7.7vh, 90px);
  border-top: 1px solid var(--rule);
}

/* the Overview already ends with the table's bottom line, so no second divider before Phase 1 */
.cs-section:first-child:has(> .cs-table-wrap:last-child) + .cs-section { border-top: 0; padding-top: 0; }

/* "What I took away": reflections set apart from the narrative */
.cs-takeaway {
  margin: 64px 0 8px;
  padding: clamp(22px, 3vw, 32px) clamp(22px, 3.4vw, 36px);
  background: rgba(255, 255, 255, .5);
  border-radius: 12px;
}
.cs-body .cs-takeaway-title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--heading);
}
.cs-takeaway ul { margin: 0; }
.cs-takeaway li:last-child { margin-bottom: 0; }


/* images: full content width, caption below, click to enlarge */
.cs-figure { margin: 44px 0 56px; }
.cs-figure .zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 12px;
  cursor: zoom-in;
}
.cs-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;      /* no background: transparent areas show the page color */
}
.cs-figure figcaption {
  margin-top: 12px;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
}

/* a carousel whose slides each carry their own text: every slide gets the same 4:3 frame
   (images fit inside it, centered), and the text below swaps with the slide */
.cs-carousel--text .cs-slide { position: relative; aspect-ratio: 4 / 3; }
.cs-carousel--text .cs-slide .zoom,
.cs-carousel--text .cs-slide > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.cs-carousel--text .cs-slide img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.cs-slide-texts { margin-top: 32px; }
.cs-slide-text > :last-child { margin-bottom: 0; }

/* videos: same frame as images; a dashed placeholder until the file is added */
.cs-video video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: rgba(29, 33, 38, 0.06);
}
.cs-video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 16 / 10;
  padding: 24px;
  border: 1.5px dashed rgba(84, 91, 99, 0.45);
  border-radius: 12px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.cs-video-soon {
  font-weight: 700;
  color: var(--heading);
}

/* quoted blocks, e.g. the prompts given to AI tools */
.cs-quote {
  margin: 32px 0 40px;
  padding: 24px 28px;
  border-radius: 12px;
  background: rgba(29, 33, 38, 0.05);
}
.cs-body .cs-quote p,
.cs-body .cs-quote li { font-size: 1rem; color: var(--ink-soft); }
.cs-quote > :last-child { margin-bottom: 0; }

/* a line of only emoji, e.g. the crickets in Fuze One */
.cs-body p.cs-emoji { font-size: 2.125rem; line-height: 1.2; letter-spacing: 0.08em; margin-bottom: 12px; }

/* "Before" / "After" headings above a side-by-side image: one grid column per panel */
.cs-labels {
  display: grid;
  align-items: end;
  margin-bottom: 8px;
}
.cs-labels > span {
  padding-right: 12px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--heading);
}
/* a label with an arrow to the next label (PV1 → PV2), or a line across a group */
.cs-labels > .cs-label-run {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 14px;
}
.cs-labels > .cs-label-run > span:first-child { white-space: nowrap; }
.cs-label-arrow {
  position: relative;
  flex: 1;
  height: 1px;
  background: var(--ink-soft);   /* same grey as the body text */
}
.cs-label-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1px solid var(--ink-soft);
  border-right: 1px solid var(--ink-soft);
  transform: translateY(-50%) rotate(45deg);
}
.cs-labels > .cs-label-run:has(.cs-label-span) { padding-right: 0; }
.cs-label-span { flex: 1; height: 1px; background: var(--ink-soft); }

@media (max-width: 600px) {
  .cs-labels > span { font-size: 0.8125rem; }
}

/* carousel: one slide at a time; arrows and dots sit on top of the image, caption follows the slide */
.cs-carousel-stage { position: relative; }
.cs-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  border-radius: 12px;
}
.cs-carousel-track::-webkit-scrollbar { display: none; }
.cs-carousel-track:focus-visible { outline: 2px solid var(--deep-blue); outline-offset: 4px; }
.cs-slide { flex: 0 0 100%; scroll-snap-align: start; }

.cs-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--heading);
  box-shadow: 0 1px 2px rgba(29, 33, 38, .18), 0 4px 12px rgba(29, 33, 38, .12);
  cursor: pointer;
  transition: background .15s, opacity .2s;
}
.cs-carousel-btn:hover { background: #FFFFFF; }
.cs-carousel-btn:focus-visible { outline: 2px solid var(--deep-blue); outline-offset: 2px; }
.cs-carousel-btn:disabled { opacity: 0; pointer-events: none; }   /* hidden at the first slide */
.cs-prev { left: 12px; }
.cs-next { right: 12px; }
.cs-carousel-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.cs-carousel-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);   /* centered along the bottom of the image */
  bottom: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(29, 33, 38, .55);
}
.cs-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: background .15s;
}
.cs-dot[aria-current="true"] { background: #FFFFFF; }
.cs-dot:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

@media (max-width: 600px) {
  .cs-carousel-btn { width: 32px; height: 32px; }
  .cs-prev { left: 8px; }
  .cs-next { right: 8px; }
  .cs-carousel-dots { bottom: 8px; }
}

/* tables: real tables on desktop, readable stacked rows on phones */
.cs-table-wrap { margin: 28px 0 8px; }
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.cs-table th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--heading);
  padding: 0 32px 10px 0;
  border-bottom: 1px solid var(--heading);
  vertical-align: bottom;
}
.cs-table td {
  padding: 14px 32px 14px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  text-wrap: pretty;
}
.cs-table td.cs-nowrap { white-space: nowrap; }
.cs-table th:last-child, .cs-table td:last-child { padding-right: 0; }

/* general tables with a header row (e.g. Goals): equal-width columns that wrap */
.cs-table:not(.cs-table--phases):not(.cs-table--pairs) { table-layout: fixed; }

/* phase table (Phase, Year, Time, Team, Result): set proportions, bold phase names,
   short columns never wrap, 32px minimum gap */
.cs-table--phases td:first-child { font-weight: 700; color: var(--heading); }
.cs-table--phases th:not(:last-child),
.cs-table--phases td:not(:last-child) { white-space: nowrap; }
.cs-table--phases td { text-wrap: balance; }
.cs-table--phases td:last-child { text-wrap: wrap; }
.cs-table--phases th:nth-child(1) { width: 18%; }
.cs-table--phases th:nth-child(2) { width: 11%; }
.cs-table--phases th:nth-child(3) { width: 15%; }
.cs-table--phases th:nth-child(4) { width: 22%; }

/* label/value table (no header row, e.g. My role / Team / Timeline) */
.cs-table--pairs th {
  width: 9.5rem;
  padding: 14px 24px 14px 0;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  white-space: nowrap;
}
.cs-table--pairs tr:first-child th,
.cs-table--pairs tr:first-child td { border-top: 1px solid var(--heading); }

@media (max-width: 760px) {
  .cs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-stats { grid-template-columns: minmax(0, 1fr); margin-bottom: 44px; }
  .cs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cs-table, .cs-table tbody, .cs-table tr, .cs-table td, .cs-table--pairs th { display: block; }
  .cs-table:not(.cs-table--pairs) tr {
    background: rgba(255, 255, 255, .4);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
  }
  .cs-table td { border: 0; padding: 4px 0; white-space: normal; }
  .cs-table--phases td:first-child { font-size: 1rem; padding-bottom: 6px; }
  .cs-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--heading);
  }
  .cs-table--phases td:first-child::before { content: none; }
  /* label/value rows: label above its value, separated by a rule */
  .cs-table--pairs tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .cs-table--pairs tr:first-child { border-top: 1px solid var(--heading); }
  .cs-table--pairs th, .cs-table--pairs td { width: auto; padding: 0; border: 0 !important; white-space: normal; }
  .cs-table--pairs th { font-size: 0.8125rem; margin-bottom: 2px; }
}

/* ---------- Password gate (Work) ---------- */

[hidden] { display: none !important; }

/* centered in the whole window; the nav above stays clickable */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}

.gate-form { width: min(100%, 360px); margin: 0; pointer-events: auto; }

.gate-field {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 16px 20px;
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}

.gate-icon { flex: none; display: block; width: auto; height: 22px; }

.gate-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--ink);
  caret-color: var(--ink);
  padding: 2px 0;
}
.gate-field input::placeholder { color: #9AA1A8; font-weight: 300; }

.gate-field:focus-within { border-color: var(--rule); box-shadow: 0 0 0 4px rgba(29, 33, 38, .04); }
.gate-field:has(input[aria-invalid="true"]) { border-color: #D9A29E; }

.gate-field.shake { animation: gate-shake .36s ease-in-out; }

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .home { grid-template-columns: minmax(0, 1fr); }  /* minmax keeps the wide chart from stretching the page */
  .intro { padding-top: 0; }
}

@media (max-width: 600px) {
  .site-nav { padding-top: 20px; padding-bottom: 20px; gap: 16px; }
  .logo-mark { width: 36px; height: 36px; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.875rem; }
  .nav-icon { width: 22px; height: 22px; }
  /* keep node labels legible on phones: let the chart pan sideways */
  .chart-canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
  .chart-canvas svg { min-width: 600px; }
}

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