/* ============================================================
   SITE - layout of this portfolio. Uses only roles from theme.css and steps from base.css.
   ============================================================ */
:root {
  --step-hero: clamp(2rem, 1.2rem + 3.4vw, 4.25rem);
  --max: 1280px;
}
html { scroll-behavior: smooth; scroll-padding-top: var(--s-6); }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--margin); }
.skip { position: absolute; left: var(--margin); top: -80px; z-index: 5; padding: var(--s-2) var(--s-3); background: var(--ink); color: var(--bg); border-radius: var(--r-1); }
.skip:focus { top: var(--s-2); }
.icon { width: 1.2em; height: 1.2em; flex: none; }

/* ---------- header ---------- */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-4); }
.brand { white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-size: var(--step-lead); letter-spacing: -0.01em; text-decoration: none; }
.nav { display: flex; align-items: center; gap: var(--s-1); }
.nav a, .theme-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  padding-inline: var(--s-3); border: 0; border-radius: var(--r-1); background: transparent;
  color: var(--muted); text-decoration: none; font-size: var(--ui-size);
  transition: color var(--t-hover) ease, background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.theme-btn { padding-inline: 0; }
.theme-btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .nav a:hover, .theme-btn:hover { color: var(--ink); background: var(--surface); }
}
@media (max-width: 560px) { .nav .hide-sm { display: none; } }

/* ---------- home: hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--s-7) var(--s-8); align-items: end; padding-block: var(--s-8) 0; }
.hero-title { max-width: none; font-weight: 600; }
.hero-name { display: block; font-size: var(--step-display); line-height: 0.98; letter-spacing: -0.035em; }
.hero-role { display: block; margin-top: var(--s-5); font-size: var(--step-head); line-height: 1.12; letter-spacing: -0.015em; font-weight: 500; }
.hero-about { margin-top: var(--s-6); font-size: var(--step-lead); line-height: 1.4; max-width: 34ch; }
.facts { display: grid; margin: 0; }
.facts > div { padding-block: var(--s-3); border-top: 1px solid var(--line); }
.facts dt { font-size: var(--step-small); color: var(--muted); }
.facts dd { margin: var(--s-1) 0 0; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); padding-top: var(--s-6); } }

/* ---------- sections ---------- */
.section { padding-top: var(--section-gap); }
.section-head { max-width: 48ch; }
.section-head h2 { font-size: var(--step-head); line-height: 1.05; letter-spacing: -0.02em; }
.section-head p { margin-top: var(--s-3); color: var(--muted); }

/* ---------- home: entries (portfolio cards) ---------- */
.section--near { padding-top: var(--s-8); }
.doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-6); }
.doors[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.door {
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-2);
  background: var(--surface); text-decoration: none;
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.door:active { transform: scale(0.99); }
.door-media { display: block; aspect-ratio: 3 / 2; background: var(--line); }
.door-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--cover-focus, 50% 50%); }
.door-body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: var(--s-5); padding: var(--s-5); }
.door-title { font-size: var(--step-head); line-height: 1.05; letter-spacing: -0.02em; }
.door-cta { align-self: stretch; justify-content: space-between; min-height: 3.25rem; padding-inline: var(--s-4); font-size: 1.0625rem; }
.door-count { display: block; margin-top: var(--s-2); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) {
  .door:hover { background: color-mix(in oklab, var(--surface), var(--ink) 5%); }
}
/* narrow screens: one card per row, cover on the left, text and button on the right */
@media (max-width: 960px) {
  .doors, .doors[data-count="3"] { grid-template-columns: minmax(0, 1fr); }
  .door { flex-direction: row; }
  .door-media { flex: 0 0 38%; aspect-ratio: auto; min-height: 9.5rem; }
  .door-body { padding: var(--s-4); }
}

/* ---------- home: how I work ---------- */
.how { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--s-7) var(--s-8); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 2.5rem minmax(0, 13rem) minmax(0, 1fr); gap: var(--s-2) var(--s-5); padding-block: var(--s-5); border-top: 1px solid var(--line); }
.step:last-child { border-bottom: 1px solid var(--line); }
.step-n { font-family: var(--font-display); font-size: var(--step-lead); color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.1; }
.step-t { font-size: var(--step-lead); line-height: 1.1; letter-spacing: -0.01em; }
@media (max-width: 860px) { .how { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .step { grid-template-columns: 2rem minmax(0, 1fr); } .step p { grid-column: 2; } }

/* ---------- contact (closing scene) ---------- */
.contact-wrap { padding-top: var(--section-gap); }
.contact {  padding: var(--s-8) var(--s-7); border-radius: var(--r-2); background: var(--closing); color: var(--closing-ink); }
.contact :focus-visible { outline-color: currentColor; }
.contact ::selection { background: var(--closing-ink); color: var(--closing); }
.contact h2 { font-size: var(--step-lead); font-weight: 500; }
.contact-mail { display: inline-block; margin-top: var(--s-5); font-family: var(--font-display); font-weight: 600; font-size: clamp(1.375rem, 0.5rem + 3.7vw, 3.5rem); line-height: 1.05; letter-spacing: -0.025em; overflow-wrap: anywhere; color: inherit; }
.contact-links { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); margin-top: var(--s-6); }
.contact-links a { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; color: inherit; }
.contact-where { margin-top: var(--s-5); font-size: var(--step-small); }
@media (max-width: 560px) { .contact { padding: var(--s-6) var(--s-4); } }
.foot { padding-block: var(--s-6); font-size: var(--step-small); color: var(--muted); }

/* ---------- topic page ---------- */
.topic-head { padding-top: var(--s-8); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--s-6) var(--s-8); align-items: end; }
.topic-title { font-size: var(--step-hero); line-height: 1; letter-spacing: -0.03em; max-width: 16ch; }
.topic-intro { margin-top: var(--s-5); max-width: 46ch; font-size: var(--step-lead); line-height: 1.4; }
.legend { display: grid; gap: var(--s-4); margin: 0; }
.legend > div { display: grid; gap: var(--s-2); justify-items: start; padding-top: var(--s-3); border-top: 1px solid var(--line); }
.legend dd { margin: 0; font-size: var(--step-small); }
@media (max-width: 860px) { .topic-head { grid-template-columns: minmax(0, 1fr); padding-top: var(--s-6); } }

.tag { display: inline-flex; align-items: center; height: 24px; padding-inline: var(--s-2); border-radius: var(--r-1); font-size: var(--step-small); font-weight: 500; line-height: 1; white-space: nowrap; }
.tag--live { background: var(--accent); color: var(--accent-ink); }
.tag--concept { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.tag--ph { color: var(--muted); border: 1px dashed var(--muted); }

.gallery { columns: 2; column-gap: var(--gutter); margin-top: var(--s-6); }
@media (min-width: 700px) { .gallery { columns: 3; } }
@media (min-width: 1100px) { .gallery { columns: 4; } }
.tile { display: block; width: 100%; margin: 0 0 var(--s-6); padding: 0; border: 0; background: none; color: inherit; text-align: left; break-inside: avoid; }
.tile-media { position: relative; display: block; overflow: hidden; border-radius: var(--r-2); background: var(--surface); min-height: 96px; }
.tile-media img, .tile-media video { width: 100%; height: auto; }
.tile-play { position: absolute; right: var(--s-2); bottom: var(--s-2); display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-full); background: var(--ink); color: var(--bg); }
.tile-play .icon { width: 16px; height: 16px; }
.tile-cap { display: grid; gap: var(--s-1); justify-items: start; padding-top: var(--s-3); }
.tile-title { font-weight: 500; line-height: 1.25; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.2em; transition: text-decoration-color var(--t-hover) ease; }
.tile-note { font-size: var(--step-small); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: hover) and (pointer: fine) { .tile:hover .tile-title { text-decoration-color: currentColor; } }
.tile:focus-visible { outline-offset: 4px; }
.missing { display: grid; place-items: center; min-height: 160px; padding: var(--s-4); font-size: var(--step-small); color: var(--muted); text-align: center; }
.empty-note { margin-top: var(--s-6); padding: var(--s-6); border-radius: var(--r-2); background: var(--surface); }

/* ---------- breakdowns ---------- */
.case { margin-top: var(--s-7); }
.case-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.case-head h3 { font-size: var(--step-head); line-height: 1.05; letter-spacing: -0.02em; max-width: 28ch; }
.case-note { margin-top: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-2); background: var(--surface); font-size: var(--step-small); max-width: none; }
.case-body { margin-top: var(--s-5); }
.case-row { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--s-2) var(--s-6); padding-block: var(--s-5); border-top: 1px solid var(--line); }
.case-row:last-child { border-bottom: 1px solid var(--line); }
.case-row h4 { font-family: var(--font-display); font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
.prose > * + * { margin-top: var(--s-3); }
.prose p { white-space: pre-line; max-width: var(--measure); }
.hint { color: var(--muted); }
.hooks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); max-width: var(--measure); }
.hooks li { font-family: var(--font-display); font-size: var(--step-lead); line-height: 1.25; letter-spacing: -0.01em; padding-left: var(--s-4); border-left: 2px solid var(--line); }
.hooks li.hint { font-family: var(--font-text); font-size: var(--step-body); }
.script { padding: var(--s-4) var(--s-5); border-radius: var(--r-2); background: var(--surface); max-width: var(--measure); }
.script p { max-width: none; }
@media (max-width: 760px) { .case-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- preview (dialog floats, so it may have a shadow) ---------- */
.lightbox { width: min(1100px, 94vw); max-width: none; max-height: 94dvh; margin: auto; padding: var(--s-4); border: 0; border-radius: var(--r-2); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-float); }
.lightbox::backdrop { background: rgb(0 0 0 / 0.72); }
.lb-stage { display: grid; place-items: center; min-height: 200px; }
.lb-stage img, .lb-stage video { width: auto; height: auto; max-width: 100%; max-height: calc(94dvh - 9.5rem); border-radius: var(--r-1); }
.lb-bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-3) var(--s-5); margin-top: var(--s-4); }
.lb-cap { display: grid; gap: var(--s-1); justify-items: start; min-width: 0; flex: 1 1 18rem; }
.lb-title { font-family: var(--font-display); font-size: var(--step-lead); font-weight: 600; line-height: 1.15; }
.lb-note { font-size: var(--step-small); color: var(--muted); max-width: 60ch; }
.lb-nav { display: flex; gap: var(--s-1); }
.lb-nav .btn { width: var(--control-h); padding: 0; }
