:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --tile: #f1f1f1;
  --chip: rgba(255, 255, 255, 0.94);
  --chip-fg: #111111;
  --radius: 12px;
  --sidebar: 360px;
  --pad: 40px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: "Inter Tight", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "intro side"
    "main  side";
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Main pane ---------- */
.main { grid-area: main; padding: var(--pad) 20px var(--pad) var(--pad); min-width: 0; }
.intro:not([hidden]) + .main { padding-top: 36px; }

/* Intro (top left): big name, headshot, tagline */
.intro { grid-area: intro; padding: var(--pad) 20px 0 var(--pad); min-width: 0; }
.big-name {
  display: block; width: fit-content;
  font-size: clamp(48px, 6.5vw, 104px); font-weight: 600;
  letter-spacing: -0.035em; line-height: 0.95;
}
.headshot { display: block; width: fit-content; margin-top: 28px; }
.headshot img {
  width: 200px; aspect-ratio: 1; object-fit: cover; object-position: center 25%;
  border-radius: var(--radius); display: block; transition: opacity 0.2s;
}
.headshot:hover img { opacity: 0.85; }
.tagline { font-size: 26px; font-weight: 400; letter-spacing: -0.01em; margin-top: 20px; }

/* Mosaic */
.mosaic {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: clamp(180px, 22vw, 360px);
  gap: 16px;
}
.tile {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius); background: var(--tile);
  transition: opacity 0.25s ease;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.tile:hover img, .tile.is-hot img { transform: scale(1.03); }
.mosaic.has-hot .tile:not(.is-hot) { opacity: 0.4; }
.cap {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--chip); color: var(--chip-fg);
  padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(4px); transition: opacity 0.2s, transform 0.2s;
}
.tile:hover .cap, .tile.is-hot .cap, .tile:focus-visible .cap { opacity: 1; transform: none; }

/* ---------- Project view (fills the main pane) ---------- */
.view-project {
  display: flex; flex-direction: column; gap: 16px;
  height: calc(100vh - 2 * var(--pad));
  position: sticky; top: var(--pad);
}
.pv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.pv-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.pv-title { font-size: 30px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
.pv-desc { color: var(--muted); max-width: 70ch; margin-top: 6px; font-size: 15px; }
.pv-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.pill:hover { border-color: var(--fg); }
.pill.dark { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.pv-stage {
  flex: 1; min-height: 0; position: relative;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--tile);
}
.pv-stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; position: relative; }
.pv-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.pv-static { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.pv-static img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.pv-static .note { padding: 14px 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); background: var(--bg); }
.pv-static .note a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 40px; align-items: start; max-width: 1100px; }
.portrait { width: 100%; border-radius: var(--radius); display: block; }
.about-text h2 { font-size: 30px; font-weight: 500; margin-bottom: 16px; }
.about-text p { margin-bottom: 14px; max-width: 62ch; }
.highlights { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin-top: 24px; font-size: 15px; }
.highlights dt { font-weight: 600; }
.highlights dd { color: var(--muted); }

/* ---------- Sidebar (right) ---------- */
.sidebar {
  grid-area: side; align-self: start;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: var(--pad) var(--pad) var(--pad) 20px;
  display: flex; flex-direction: column; gap: 28px;
  font-size: 22px; line-height: 1.3;
}
.nav { display: flex; flex-direction: column; }
.nav a, .ext a { width: fit-content; }
.nav a:hover, .ext a:hover, .proj-list a:hover .t { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.nav a.is-active { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.proj-list { list-style: none; display: flex; flex-direction: column; }
.proj-list a { display: grid; grid-template-columns: 2.2ch 1fr; gap: 12px; padding: 1px 0; }
.proj-list .n { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.proj-list a.is-active .t { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.proj-list a.is-active .n { color: var(--fg); }

.ext { list-style: none; margin-top: auto; font-size: 17px; color: var(--muted); }
.ext a:hover { color: var(--fg); }

/* ---------- Small screens: sidebar moves on top ---------- */
@media (max-width: 900px) {
  :root { --pad: 16px; }
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "intro" "side" "main";
  }
  .intro { padding: 24px 16px 20px; }
  .big-name { font-size: 48px; }
  .headshot { margin-top: 18px; }
  .headshot img { width: 140px; }
  .tagline { font-size: 20px; margin-top: 14px; }
  .sidebar {
    position: static; height: auto;
    padding: 16px; gap: 16px; font-size: 18px;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; gap: 16px; }
  .ext { display: flex; gap: 16px; margin-top: 0; font-size: 15px; }
  .main, .intro:not([hidden]) + .main { padding: 20px 16px 32px; }
  .mosaic { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 56vw; gap: 12px; }
  .mosaic .tile { grid-column: auto !important; }
  .cap { opacity: 1; transform: none; }
  .view-project { position: static; height: auto; }
  .pv-head { flex-direction: column; gap: 12px; }
  .pv-actions { justify-content: flex-start; }
  .pv-title { font-size: 24px; }
  .pv-stage { height: 75vh; flex: none; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .portrait { max-width: 260px; }
  .highlights { grid-template-columns: 1fr; gap: 2px; }
  .highlights dd { margin-bottom: 8px; }
}
