/* Layout shared across the light and dark treatments of the Stitch redesign. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.project-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.project-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.project-filter [aria-pressed="true"] {
  border-color: var(--action);
  background: var(--action);
  color: var(--action-ink);
}
#project-count { padding-inline: 5px; color: var(--muted); font-size: 13px; }
.scenario-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.project-grid .case {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}
.project-grid .case-visual {
  align-self: auto;
}
.project-grid .case:not(.lead-case) .case-visual { order: -1; }
.project-grid .case:not(.lead-case) > .tags { margin-top: auto; }
.project-grid .lead-case {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
  align-items: center;
}
.project-grid .lead-case .case-visual { align-self: center; }
.case-details {
  margin-top: 15px;
  color: var(--muted);
}
.case-details summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
  font-weight: 650;
  font-size: 14px;
}
.case-details .breakdown { margin-top: 8px; }
.case .technical-panel { height: auto; }
@media (max-width: 680px) {
  .project-grid { grid-template-columns: 1fr; }
  .project-grid .lead-case { display: flex; }
}

/* Ink and sand are used for reading surfaces, soft focusing, and primary actions. */
:root {
  --bg: #f6f3ec; --paper: #fffdf8; --ink: #172434; --muted: #4e5d6e;
  --line: #cfd3d2; --soft: #ece9e1; --accent: #235a76; --on: #fff;
  --chart: #166887; --grid: #d6dce0; --action: #16364b; --action-ink: #fff;
}
html[data-theme=dark] {
  --bg: #0d1420; --paper: #151f2c; --ink: #eff5fa; --muted: #a9b9c9;
  --line: #354453; --soft: #1b2a38; --accent: #a5deec; --on: #102533;
  --chart: #a5deec; --grid: #354d60; --action: #f3d3a8; --action-ink: #1e2833;
}
.site-header {
  background: color-mix(in srgb, var(--bg) 89%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner { min-height: 65px; }
.monogram {
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--accent);
  background: var(--soft);
}
.theme, .menu { border-radius: 8px; }
.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  background: var(--bg);
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(ellipse at 78% 44%, color-mix(in srgb,var(--accent) 14%,transparent) 0, transparent 47%);
}
.hero-grid {
  gap: clamp(32px, 7vw, 98px);
  grid-template-columns: minmax(0, 1.24fr) minmax(0, .76fr);
  padding-block: clamp(44px, 6.6vw, 100px);
}
.hero h1 {
  font-size: clamp(56px, 8.3vw, 118px);
  line-height: .89;
  font-weight: 760;
  letter-spacing: -.085em;
  margin: 18px 0 20px;
}
.hero h1 span { color: var(--accent); }
.hero-role {
  margin-bottom: 8px;
  font-size: clamp(16px, 2.25vw, 27px);
  font-weight: 650;
  color: var(--accent);
}
.hero .lede { font-size: clamp(15px, 1.7vw, 19px); }
.identity-panel figure {
  transform: none;
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 16px 50px #0002;
}
.identity-panel img { aspect-ratio: 1.18; object-position: 50% 43%; }
.identity-panel figcaption { padding: 12px 13px; }
.environment, .quick-specs { border-radius: 10px; overflow: hidden; }
.button { border-radius: 8px; padding: 10px 14px; }
.primary { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.case, .lab-frame, .toolkit article, .timeline article, .contact-card {
  border-radius: 17px;
}
.case-visual img { border-radius: 10px; }
.case-visual a:focus-visible { display: block; border-radius: 10px; }
.technical-panel { border-radius: 8px; }
.lab-frame {
  background: linear-gradient(145deg, var(--soft), var(--paper) 39%);
}
.lab-selection button, .lab select { border-radius: 7px; }
.lab-metrics { border-radius: 8px; }
.timeline-date { max-width: 100%; }
.contact-card { background: #172e42; }
@media (max-width: 680px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { margin: 15px 0; }
  .identity-panel { max-width: 410px; }
}
@media (prefers-reduced-motion: no-preference) {
  .case-visual img { transition: filter .18s ease; }
  .case-visual a:hover img { filter: brightness(1.075); }
}

/* The compact portrait console and graph-paper field follow the updated Stitch concept. */
.header-cv {
  flex: none;
  border: 1px solid var(--action);
  background: var(--action);
  color: var(--action-ink);
  border-radius: 7px;
  padding: 6px 9px;
  font: 650 11px/1.5 Consolas, monospace;
}
.hero h1 {
  max-width: 100%;
  font-size: clamp(49px, 6.15vw, 92px);
  line-height: .98;
  letter-spacing: -.065em;
}
.hero::before {
  background:
    radial-gradient(ellipse at 75% 35%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 49%),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 26%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--line) 26%, transparent) 1px, transparent 1px);
  background-size: auto, 39px 39px, 39px 39px;
  mask-image: linear-gradient(105deg, transparent 37%, #000 95%);
}
.environment { grid-template-columns: 1fr 1fr; margin-top: 9px; }
.environment div + div { border-left: 1px solid var(--line); border-top: 0; }
.environment dd { font-size: 11px; }
.profile-lab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--accent);
  background: var(--soft);
}
.profile-lab strong { display: block; font-size: 13px; }
.profile-lab small { display: block; color: var(--muted); font-size: 11px; }
.lab-wave { font: 25px/1 Consolas, monospace; }
.profile-lab:hover strong, .header-cv:hover { text-decoration: underline; }
.lead-case {
  background: linear-gradient(135deg, var(--soft) 0%, var(--paper) 54%);
}
@media (max-width: 1050px) {
  .header-inner { gap: 11px; }
  .header-links { display: none; }
}
@media (max-width: 680px) {
  .header-cv { display: none; }
  .hero h1 { font-size: clamp(47px, 12vw, 64px); }
  .hero::before { mask-image: linear-gradient(105deg, transparent 25%, #000 100%); }
}
@media (min-width: 801px) { .menu { display: none; } }
