:root {
  color-scheme: dark;
  --page: #101622;
  --surface: #161f2d;
  --raised: #1c2839;
  --media: #0d1420;
  --ink: #edf2fa;
  --muted: #b8c4d5;
  --line: #38475c;
  --accent: #adc8ef;
  --space: clamp(1.2rem, 5.5vw, 5rem);
  --body: 1.0625rem;
  --small: .875rem;
  --heading: clamp(1.8rem, 3.1vw, 2.6rem);
}

html[data-theme="light"] {
  color-scheme: light;
  --page: #f5f7fa;
  --surface: #ffffff;
  --raised: #e8eef7;
  --media: #e1e9f4;
  --ink: #19283c;
  --muted: #465671;
  --line: #bbc9da;
  --accent: #254d85;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 var(--body)/1.62 "DM Sans", system-ui, sans-serif; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1, h2, h3 { line-height: 1.12; font-weight: 650; letter-spacing: -.035em; text-wrap: balance; }
h2 { font-size: var(--heading); }
a { color: inherit; text-underline-offset: .22em; }
button { font: inherit; }
img { display: block; width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.frame { width: min(100%, 90rem); margin-inline: auto; padding-inline: var(--space); }
.skip-link { position: absolute; z-index: 2; inset: .75rem auto auto .75rem; padding: .6rem 1rem; background: var(--raised); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.top, .site-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: 4.65rem; }
.top { border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 700; letter-spacing: -.025em; }
.top nav { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(.65rem, 2.25vw, 1.8rem); }
.top a, .site-footer a, .breadcrumb a { display: inline-flex; align-items: center; gap: .28rem; min-height: 2.75rem; text-decoration: none; }
.top a:hover, .site-footer a:hover, .breadcrumb a:hover { color: var(--accent); }
.theme-toggle { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; padding: .35rem .7rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: .48rem; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 1.12rem; height: 1.12rem; }
.theme-toggle .sun, html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: initial; }

.hero { position: relative; isolation: isolate; display: grid; justify-items: center; padding-block: clamp(2rem, 4.2vw, 3.4rem) clamp(2.5rem, 4.6vw, 4.2rem); }
.hero::before { content: ""; position: absolute; z-index: -1; inset: 19% 28% 17%; background: var(--accent); opacity: .16; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Crect x='5' y='5' width='2' height='2' rx='.35' fill='black'/%3E%3C/svg%3E") repeat; pointer-events: none; }
.hero-intro { text-align: center; }
.hero h1 { font-size: clamp(2.55rem, 5.25vw, 4.7rem); }
.hero-role, .detail-headline { color: var(--accent); font-size: clamp(1.15rem, 2.1vw, 1.7rem); font-weight: 600; line-height: 1.32; }
.hero-role { margin-block: .45rem 1rem; }
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 24%) minmax(0, 1fr); align-items: center; width: 100%; gap: clamp(1rem, 4vw, 3.5rem); padding: .9rem 0 .25rem; }
.hero-discipline { width: min(100%, 27ch); justify-self: center; }
.hero-discipline h2 { font-size: clamp(1.4rem, 3.3vw, 2.75rem); }
.hero-discipline p { margin-top: .55rem; }
.discipline-architecture { text-align: right; }
.button { display: inline-flex; align-items: center; gap: .7rem; min-height: 3rem; margin-top: 1.35rem; padding: .65rem 1rem; border: 1px solid var(--accent); border-radius: .42rem; color: var(--ink); text-decoration: none; font-weight: 600; transition: background-color .2s ease, transform .2s ease; }
.button:hover { background: var(--raised); transform: translateY(-2px); }
.portrait-image { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: .48rem; }
.portrait img { aspect-ratio: 1 / 1.04; object-fit: cover; object-position: 50% 37%; }
.portrait img[aria-hidden] { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); filter: grayscale(1) contrast(.9); }
.portrait figcaption { text-align: center; }
.portrait figcaption { margin-top: .55rem; color: var(--muted); font-size: var(--small); }
.hero > * { animation: arrive .65s ease-out both; }
.hero-split { animation-delay: 80ms; }

.directory, .about, .project-card { scroll-margin-top: 1.15rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem; margin-bottom: 1.3rem; }
.section-heading p { color: var(--muted); }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.85rem, 2vw, 1.5rem); }
.work-switcher { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .85rem; }
.work-switcher button { min-height: 2.75rem; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--ink); cursor: pointer; font-size: var(--small); font-weight: 600; }
.work-switcher button:hover { border-color: var(--accent); }
.work-switcher button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--page); }
.project-card { display: grid; grid-template-rows: 1fr auto; min-width: 0; padding: clamp(1.15rem, 2.5vw, 1.75rem); border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); }
.project-card.featured-project { grid-column: 1 / -1; grid-template-columns: minmax(0, .8fr) minmax(0, 1.25fr); grid-template-rows: auto; align-items: center; gap: 1.25rem clamp(1.25rem, 4vw, 3.3rem); }
.featured-project .project-preview { margin-top: 0; aspect-ratio: 1.9; }
.project-card:target, .project-card:focus-within { border-color: var(--accent); }
.project-card h3 { font-size: clamp(1.45rem, 2.3vw, 2rem); }
.project-card .project-category { margin-block: .3rem .5rem; color: var(--accent); font-weight: 600; }
.project-card p { max-width: 56ch; }
.project-card .project-example { margin-top: .65rem; color: var(--muted); }
.project-card .text-link { margin-top: .45rem; }
.text-link { display: inline-flex; align-items: center; gap: .52rem; min-height: 2.75rem; padding: .48rem .85rem; border: 1px solid var(--line); border-radius: .45rem; color: var(--ink); background: var(--surface); font-weight: 650; text-decoration: none; transition: background-color .18s ease, border-color .18s ease; }
.text-link:hover { background: var(--raised); border-color: var(--accent); }
.project-card .text-link { background: var(--accent); border-color: var(--accent); color: var(--page); margin-top: .9rem; }
.project-card .text-link:hover { filter: brightness(.92); }
.project-preview { margin-top: .65rem; display: grid; place-items: center; aspect-ratio: 2.45; overflow: hidden; background: var(--media); border: 1px solid var(--line); border-radius: .4rem; }
.project-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.preview-wibag img, .preview-ufla img { object-position: center; }
.about { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1fr); gap: 1rem 3rem; margin-block: clamp(2.75rem, 6vw, 5.4rem); padding-block: clamp(1.7rem, 4vw, 3rem); border-top: 1px solid var(--line); }
.about p + p { margin-top: .7rem; }
.about .text-link { margin-top: .4rem; }
.site-footer { min-height: 4.25rem; color: var(--muted); border-top: 1px solid var(--line); font-size: var(--small); }

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .8rem; color: var(--muted); font-size: var(--small); }
.breadcrumb a { color: var(--accent); }
.detail-intro { padding-block: clamp(1.1rem, 2.6vw, 2rem) clamp(1.5rem, 3.6vw, 3rem); }
.visual-gallery { margin-bottom: clamp(2.1rem, 5vw, 4rem); }
.visual-gallery h2 { font-size: clamp(1.25rem, 2.5vw, 1.8rem); margin-bottom: .8rem; }
.visual-gallery-controls { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.visual-gallery-controls button { display: inline-flex; align-items: center; gap: .55rem; min-height: 3.1rem; padding: .38rem .7rem .38rem .38rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--small); cursor: pointer; text-align: left; }
.visual-gallery-controls button img { width: 3.35rem; height: 2.1rem; object-fit: cover; border-radius: .23rem; }
.visual-gallery-controls button:hover { border-color: var(--accent); }
.visual-gallery-controls button[aria-pressed="true"] { background: var(--accent); color: var(--page); border-color: var(--accent); }
.visual-gallery-frames { display: grid; gap: .9rem; }
.visual-frame { min-width: 0; border: 1px solid var(--line); border-radius: .85rem; overflow: hidden; background: var(--surface); }
.visual-stage { display: grid; place-items: center; background: var(--media); min-height: 8rem; padding: clamp(.45rem, 2.2vw, 1.25rem); }
.visual-stage img { width: auto; max-width: 100%; height: auto; max-height: 32rem; object-fit: contain; border-radius: .38rem; }
.product-gallery .visual-stage { padding: clamp(.4rem, 1vw, .8rem); }
.product-gallery .visual-stage img { width: 100%; max-height: 42rem; }
.visual-cover .visual-stage { padding: 0; }
.visual-cover .visual-stage img { width: 100%; max-height: 31rem; aspect-ratio: 2.25; object-fit: cover; border-radius: 0; }
.visual-frame figcaption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; padding: .65rem .85rem; color: var(--muted); font-size: var(--small); }
.visual-frame .text-link { min-height: 2.5rem; padding: .3rem .65rem; white-space: nowrap; }
.detail-intro h1 { font-size: clamp(2.35rem, 4.65vw, 4.05rem); }
.detail-headline { margin-top: .4rem; }
.tech-list { display: flex; flex-wrap: wrap; gap: .4rem .9rem; list-style: none; padding: 0; margin-top: .9rem; color: var(--muted); font-size: var(--small); }
.tech-list li + li::before { content: "·"; margin-right: .9rem; color: var(--accent); }
.decision { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.3fr); align-items: start; gap: clamp(1.25rem, 4vw, 3.5rem); }
.overview-copy { display: grid; gap: 1.35rem; }
.overview-copy h2, .brief h2 { font-size: clamp(1.3rem, 2.2vw, 1.75rem); }
.overview-copy p, .brief p { margin-top: .5rem; max-width: 60ch; }
.without-capture { display: block; padding: clamp(1.1rem, 3vw, 2rem); background: var(--surface); border-radius: .7rem; }
.without-capture .overview-copy { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.decision, .example, .case-nav, .wibag-interactive { margin-top: clamp(1.75rem, 4.5vw, 3.8rem); }
.decision { padding: clamp(1.15rem, 3.3vw, 2.15rem); border-radius: .55rem; background: var(--surface); }
.decision h2, .example h2 { font-size: clamp(1.45rem, 3vw, 2.15rem); }
.decision p { max-width: 70ch; }
.example-flow { counter-reset: example; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; list-style: none; padding: 0; }
.example-flow li { counter-increment: example; padding: 1.2rem clamp(.85rem, 2vw, 1.35rem); background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; }
.example-flow li::before { content: counter(example, decimal-leading-zero); display: inline-grid; place-items: center; width: 2.35rem; aspect-ratio: 1; margin-bottom: .7rem; border-radius: .48rem; background: var(--raised); color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.example-flow h3 { font-size: 1.12rem; color: var(--accent); }
.example-flow p { margin-top: .5rem; }
.case-source { margin-top: 1.1rem; }
.case-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; padding-block: .8rem 1.65rem; border-top: 1px solid var(--line); }

.explorer { padding: clamp(1.1rem, 3.5vw, 2.1rem); border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); }
.explorer h3 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); }
.options { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
.options button { min-height: 2.75rem; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--page); color: var(--ink); font-size: var(--small); font-weight: 650; cursor: pointer; }
.options button:hover { border-color: var(--accent); }
.options button[aria-pressed="true"] { color: var(--page); background: var(--accent); border-color: var(--accent); }
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; list-style: none; padding: 0; margin-block: 1.2rem .8rem; }
.flow li { position: relative; display: flex; flex-direction: column; gap: .15rem; min-height: 5.9rem; padding: .65rem; background: var(--raised); border-radius: .4rem; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; left: 100%; top: 50%; width: 1rem; text-align: center; transform: translateY(-50%); color: var(--accent); }
.flow svg { width: 1.55rem; height: 1.55rem; margin-bottom: .2rem; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.flow span, .explorer-note { color: var(--muted); font-size: var(--small); }
.explorer-note { margin-top: .55rem; }

@keyframes arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
.revealed { animation: arrive .58s var(--delay, 0ms) both; }

@media (max-width: 52rem) {
  .decision { grid-template-columns: 1fr; }
}

@media (max-width: 39rem) {
  .top { flex-wrap: wrap; padding-block: .35rem; }
  .top nav { font-size: var(--small); gap: .45rem .8rem; }
  .theme-toggle span { display: none; }
  .hero::before { inset: 15% 4% 55%; }
  .project-grid, .about, .without-capture .overview-copy, .project-card.featured-project { grid-template-columns: 1fr; }
  .hero-split { grid-template-columns: 1fr 1fr; gap: 1.15rem 1rem; align-items: start; }
  .hero-discipline { text-align: left; }
  .portrait { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: min(100%, 15rem); }
  .portrait img { aspect-ratio: 1.15; }
  .example-flow { grid-template-columns: 1fr; }
  .visual-cover .visual-stage img { aspect-ratio: 1.55; }
  .flow { grid-template-columns: 1fr; }
  .flow li { min-height: auto; }
  .flow li:not(:last-child)::after { content: "↓"; left: 50%; top: 100%; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
