:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #1a1a1a;
  --line: #cccccc;
  --nav-w: 220px;
  --pink: #ff2d95;
  --box-h: 260px; /* fallback; js/main.js sets the real height */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #161616; --text: #eeeeee; --line: #444444; }
}
:root[data-theme="dark"] { --bg: #161616; --text: #eeeeee; --line: #444444; }
html { scroll-behavior: smooth; scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; line-height: 1.5; }
nav { position: fixed; top: 0; left: 0; bottom: 0; width: var(--nav-w); padding: 24px; border-right: 1px solid var(--line); box-sizing: border-box; }
nav h1 { font-size: 1.1rem; margin: 0 0 24px; }
nav ul { list-style: none; margin: 0; padding: 0; }
nav li { margin-bottom: 12px; }
nav a { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.05rem; transition: color 0.2s; }
nav a.active { color: var(--pink); }
main { margin-left: var(--nav-w); }
section { min-height: 100vh; padding: 48px; box-sizing: border-box; border-bottom: 1px solid var(--line); }
.mobile-header { display: none; }
@media (max-width: 700px) {
  nav { display: none; }
  .mobile-header { display: block; padding: 16px 24px; border-bottom: 1px solid var(--line); font-size: 1rem; }
  main { margin-left: 0; }
  section { min-height: 60vh; padding: 24px; }
}

/* Intro */
#intro {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--box-h) / 2 + 24px);
  color: #ffffff;
  background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url("../images/intro/office.jpg") center / cover no-repeat;
}
.intro-content { max-width: 52rem; margin: auto 0; }
.intro-content h2 { font-size: clamp(2.75rem, 7vw, 5.5rem); line-height: 1.1; margin: 0 0 20px; }
.intro-content p { font-size: 1.75rem; line-height: 1.4; margin: 0; }
.philosophy-heading { font-size: 1.75rem; margin: 0; }

/* Philosophy boxes: straddle the intro image and the next section */
.philosophy {
  position: relative;
  z-index: 2;
  height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 48px;
}
.philosophy-boxes {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.box {
  box-sizing: border-box;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
/* Philosophy boxes: white with black outline, rounded, flat */
.philosophy .box { background: #ffffff; color: #1a1a1a; border: 2px solid #000000; border-radius: 16px; box-shadow: none; }
.box-icons { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.box-icons .icon { width: 40px; height: 40px; flex: none; }
.box-icons .icon.op { width: 28px; height: 28px; opacity: 0.6; }
.box-icons .icon:not(.op) { color: var(--pink); }
.box h3 { margin: 0 0 12px; font-size: 1.15rem; }
.box p { margin: 0; }
#ic-case-study { display: flex; align-items: center; padding-top: calc(var(--box-h) / 2 + 96px); padding-bottom: 96px; }
/* when jumping here from the nav, land just below the lower half of the philosophy boxes */
#ic-case-study { scroll-margin-top: calc(var(--box-h) / -2 - 8px); }

/* Case study layout */
.case-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 48px;
  align-items: start;
}
.image-placeholder {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--line);
  opacity: 0.8;
}
.case-text .sirtitle { margin: 0 0 2px; font-size: 1.125rem; font-weight: bold; }
.case-text h2 { margin: 0 0 20px; font-size: 2.5rem; line-height: 1.15; }
.case-text p { font-size: 1.125rem; margin: 0 0 24px; }
.case-links { list-style: none; margin: 0; padding: 0; }
.case-links li { margin-bottom: 8px; }
.case-links a { color: var(--pink); text-decoration: none; font-weight: 700; }
.case-links a::after { content: " →"; content: " →" / ""; }

/* Team case study: same layout, image on the right */
#team-case-study { display: flex; align-items: center; padding-top: 96px; padding-bottom: 96px; }
#team-case-study { --bg: #000000; --text: #ffffff; --line: #666666; background: var(--bg); color: var(--text); }
.case-layout.reverse { grid-template-columns: 1fr 1.3fr; }
/* Skills and examples */
#skills-and-examples { display: flex; flex-direction: column; justify-content: center; padding-top: 96px; padding-bottom: 96px; }
.skills-intro { max-width: 44rem; margin-bottom: 40px; }
.skills-intro h2 { margin: 0 0 20px; font-size: 2.5rem; line-height: 1.15; }
.skills-intro p { margin: 0; font-size: 1.125rem; }

.case-layout.reverse .phones { order: 2; }
.phones { display: flex; align-items: flex-start; gap: 16px; }
.phones img { flex: 1; min-width: 0; width: 100%; height: auto; display: block; }
.phone {
  flex: 1;
  min-width: 0;
  aspect-ratio: 9 / 19.5;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  border: 2px dashed var(--line);
  border-radius: 16px;
  opacity: 0.8;
}

@media (max-width: 700px) {
  #intro { padding-bottom: 24px; }
  .philosophy { height: auto; display: block; padding: 24px; }
  .philosophy-boxes { grid-template-columns: 1fr; }
  #ic-case-study { padding-top: 48px; padding-bottom: 48px; scroll-margin-top: 0; }
  .case-layout, .case-layout.reverse { grid-template-columns: 1fr; gap: 24px; }
  #skills-and-examples { padding-top: 48px; padding-bottom: 48px; }
  .phones { gap: 8px; }
  #team-case-study { padding-top: 48px; padding-bottom: 48px; }
}

/* Case study page */
.cs-back a { color: var(--pink); text-decoration: none; font-weight: 700; }
.cs { max-width: 1200px; margin: 0 auto; padding: 48px 48px 96px; }
/* keep stacked text to a readable line length while images use the full width */
.cs > h1, .cs > h2, .cs > p { max-width: 50rem; }

/* Text on the left, images floated to the right (desktop) */
.cs-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 48px;
  align-items: start;
  margin-top: 56px;
}
.cs-split h2 { margin-top: 0; }
.cs-split .shot, .cs-split .shot-row { margin-top: 0; }
.cs-split + .shot { margin-top: 32px; }
.cs h1 { font-size: 2.5rem; line-height: 1.15; margin: 0 0 16px; }
.cs h2 { font-size: 1.5rem; line-height: 1.25; margin: 56px 0 12px; }
.cs p { font-size: 1.125rem; margin: 0 0 16px; }
.cs .cs-back { font-size: 0.95rem; margin: 0 0 24px; }
.cs .cs-role { margin-bottom: 24px; }
.cs .cs-lead { font-size: 1.35rem; }
.cs .impact { padding-left: 16px; border-left: 3px solid var(--line); }
.shot { margin: 24px 0 0; }
.shot img { display: block; max-width: 100%; height: auto; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); }
.shot-label { display: none; }
.shot.missing img { display: none; }
.shot.missing { aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); opacity: 0.8; }
.shot.missing .shot-label { display: block; }
.shot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.shot-row .shot { margin: 0; }
@media (max-width: 900px) {
  .cs-split { grid-template-columns: 1fr; gap: 16px; margin-top: 40px; }
}
@media (max-width: 700px) {
  .cs { padding: 32px 24px 64px; }
  .cs h1 { font-size: 2rem; }
  .shot-row { grid-template-columns: 1fr; gap: 16px; }
}

/* Three-up image rows */
.shot-row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
  .shot-row.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

/* Profile card (top of the side nav) */
.profile-card {
  min-height: 130px;
  margin-bottom: 24px;
  padding: 80px 16px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #ffffff;
  border-radius: 16px;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../images/shared/profile.jpg") center / cover no-repeat;
}
.profile-card h1 { margin: 0; font-size: 1.75rem; line-height: 1.1; }
.profile-card p { margin: 4px 0 0; font-size: 0.85rem; }

/* Skills flow: a gentle wave with a gray gradient beneath it and a "More" button at each point */
.flow-scroll { overflow-x: auto; }
.flow { position: relative; min-width: 840px; padding: 110px 0 30px; }
.flow-stage { position: relative; width: 100%; aspect-ratio: 1000 / 190; }
.flow-curve { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.flow-area { fill: url(#flow-area); stroke: none; }
.flow-border { fill: none; stroke: #cfcfcf; stroke-width: 1; vector-effect: non-scaling-stroke; }
.flow-line { fill: none; stroke: #c4c4c4; stroke-width: 4; stroke-linecap: round; }
.flow-curve polygon { fill: #8c8c8c; }
.flow-node { position: absolute; width: 0; height: 0; }
.flow-button {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  padding: 8px 22px; border-radius: 999px;
  background: var(--pink); color: #ffffff;
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.flow-button:hover, .flow-button:focus-visible { transform: translate(-50%, -50%) scale(1.08); }
/* left-aligned: the text starts at the left edge of its button */
.flow-label { position: absolute; left: -42px; width: 150px; text-align: left; }
.flow-node.crest .flow-label { bottom: 28px; }
.flow-node.trough .flow-label { bottom: 48px; }
.flow-title { display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin-bottom: 4px; font-weight: 700; font-size: 1.15rem; }
.flow-icon { width: 24px; height: 24px; flex: none; color: var(--pink); }
.flow-sub { font-size: 0.95rem; line-height: 1.35; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 700px) { .flow-title { font-size: 1.05rem; } }

/* Skills popups */
body.modal-open { overflow: hidden; }
.modal { position: fixed; --modal-h: min(600px, 80vh); width: min(1100px, 92vw); height: var(--modal-h); max-height: none; overflow: hidden; padding: 0; border: none; border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35); }
.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal-close { position: absolute; top: 10px; right: 14px; z-index: 1; width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%; background: transparent; color: #1a1a1a; font-size: 1.75rem; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--pink); }
.modal-slide { display: grid; grid-template-columns: minmax(0, 760px) minmax(260px, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; height: 100%; }
.modal-slide[hidden] { display: none; }
/* image panel: white, centered image at natural size, thin gray divider on the right */
.modal-image.shot { margin: 0; display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 0; overflow: hidden; padding: 32px; background: #f2f2f2; border-right: 1px solid #d6d6d6; }
.modal-image img { width: auto; max-width: 100%; height: auto; max-height: calc(var(--modal-h) - 64px); margin: 0; background: #ffffff; border: 1px solid #c8c8c8; box-shadow: none; }
/* text column: copy at the top, links pinned to the bottom */
.modal-text { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 40px 40px 0; background: #ffffff; color: #1a1a1a; }
.modal-text .modal-surtitle { margin: 0 0 2px; font-size: 0.95rem; font-weight: 700; }
.modal-text h3 { margin: 0 0 12px; font-size: 1.35rem; line-height: 1.2; }
.modal-text p { margin: 0 0 20px; font-size: 0.95rem; line-height: 1.5; }
.modal-nav { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 20px; margin-top: auto; padding: 24px 0 28px; background: #ffffff; font-size: 0.95rem; }
.modal-nav a { color: var(--pink); font-weight: 700; text-decoration: none; }
.nav-next { margin-left: auto; }
.nav-prev::before { content: "← "; content: "← " / ""; }
.nav-next::after { content: " →"; content: " →" / ""; }
@media (max-width: 800px) {
  .modal { overflow: auto; }
  .modal-slide { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100%; }
  .modal-image.shot { padding: 52px 16px 16px; border-right: none; border-bottom: 1px solid #d6d6d6; }
  .modal-image img { max-height: 50vh; }
  .modal-text { overflow: visible; padding: 20px 20px 0; }
  .modal-nav { padding-bottom: 24px; }
  .modal-close { color: var(--text); }
}

/* About me: black section with a circular photo */
#about-me { --bg: #000000; --text: #ffffff; --line: #666666; display: flex; align-items: center; padding-top: 96px; padding-bottom: 96px; background: var(--bg); color: var(--text); }
.about { display: flex; align-items: center; gap: 56px; width: 100%; }
.about-photo { flex: none; width: 260px; height: 260px; box-sizing: border-box; border-radius: 50%; border: 6px solid var(--pink); object-fit: cover; }
.about-text { max-width: 44rem; }
.about-text h2 { margin: 0 0 20px; font-size: 2.5rem; line-height: 1.15; }
.about-text p { margin: 0 0 24px; font-size: 1.125rem; }
@media (max-width: 700px) {
  #about-me { padding-top: 48px; padding-bottom: 48px; }
  .about { flex-direction: column; align-items: flex-start; gap: 24px; }
  .about-photo { width: 200px; height: 200px; }
}

/* Skills: four stacked cards replace the graph on mobile */
.skill-cards { display: none; }
.skill-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.skill-card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1.15rem; }
.skill-card p { margin: 0 0 16px; font-size: 0.95rem; line-height: 1.4; }
.skill-card-button { display: inline-block; padding: 8px 22px; border-radius: 999px; background: var(--pink); color: #ffffff; font-weight: 700; line-height: 1.2; text-decoration: none; }
@media (max-width: 700px) {
  .flow-scroll { display: none; }
  .skill-cards { display: grid; gap: 16px; }
}
.cs-prototype { margin: -8px 0 32px; }
.cs-split-text p a { color: var(--pink); font-weight: 700; text-decoration: none; }
.cs-split-text p a:hover { text-decoration: underline; }
.case-links li { margin-bottom: 12px; }
.case-links a { font-size: 1.125rem; }
.case-image { display: block; width: 100%; height: auto; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); }
p a[target="_blank"] { color: var(--pink); font-weight: 700; text-decoration: none; }
p a[target="_blank"]:hover { text-decoration: underline; }
