/* Swiss / International Typographic Style, dark.
   Strict 12-column grid, oversized grotesk type, flush-left,
   one red accent, hard rules instead of boxes, no rounding. */

:root {
  --bg: #0e0e0e;
  --text: #f2f2f2;
  --muted: #8f8f8f;
  --border: #333333;
  --accent: #ff3b2f;
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}
a { color: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2 { line-height: 1.15; margin: 0; }

/* ---------- Page frame ---------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 128px 24px 64px;
  counter-reset: section;
}

/* ---------- Hero: text left, full-height photo right ---------- */
.hero {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto 1fr;
  gap: 48px 32px;
}
.hero + section { margin-top: 144px; }
h1 {
  grid-column: 1 / 8;
  grid-row: 1;
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: .9;
}
.portrait {
  grid-column: 8 / -1;
  grid-row: 1 / 3;
  /* 90% of 5 columns ≈ 4.5 columns, pinned to the right edge */
  justify-self: end;
  width: 90%;
  height: auto;
}
.lede {
  grid-column: 1 / 7;
  grid-row: 2;
  align-self: end;
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

/* ---------- Numbered sections on the grid ---------- */
section,
footer {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 24px;
  margin-top: 96px;
  padding-top: 16px;
  border-top: 2px solid var(--text);
}
section h2,
footer::before {
  grid-column: 1 / 4;
  counter-increment: section;
}
section h2 {
  font-size: 1rem;
  font-weight: 700;
}
section h2::before,
footer::before {
  content: counter(section, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}
section > :not(h2),
footer > p { grid-column: 4 / -1; }

/* ---------- Projects: index list, not cards ---------- */
.projects { list-style: none; margin: 0; padding: 0; }
.projects li { border-bottom: 1px solid var(--border); }
.projects a {
  display: grid;
  grid-template-columns: 1fr auto 2rem;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  color: var(--text);
  text-decoration: none;
}
.projects a:hover,
.projects a:focus-visible { color: var(--accent); }
.projects .name {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.projects .url { color: var(--muted); font-size: .95rem; }
/* Points up-right at rest, swings to point straight ahead on hover */
.projects .arrow {
  justify-self: end;
  width: 28px; height: 28px;
  color: var(--accent);
  transform: rotate(-45deg);
  transition: transform .25s ease;
}
.projects a:hover .arrow,
.projects a:focus-visible .arrow { transform: translateX(3px); }

/* ---------- Gallery: square modules on a hard grid ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gallery button {
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--border);
  overflow: hidden;
  cursor: zoom-in;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery button:hover img { transform: scale(1.03); }
.gallery button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Lightbox ---------- */
html:has(.lightbox[open]) { overflow: hidden; }
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #0a0a0a;
  color: #fff;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox:focus { outline: none; }
.lightbox::backdrop { background: transparent; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; gap: 14px; }
/* Fixed frame: the image fits inside it whatever its resolution, so swapping
   the thumbnail for the full-size file never changes the size on screen */
.lightbox img {
  width: calc(100vw - 176px);
  height: calc(100dvh - 120px);
  object-fit: contain;
}
.lightbox figcaption {
  display: flex; gap: 16px; justify-content: center;
  font-size: .95rem; color: rgb(255 255 255 / .75);
}
.lightbox .count { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
.lightbox button {
  position: fixed;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border: 0;
  background: transparent; color: #fff;
  cursor: pointer;
  transition: background-color .2s;
}
.lightbox button:hover, .lightbox button:focus-visible { background: var(--accent); }
.lightbox button svg { width: 28px; height: 28px; }
.lightbox .close { top: 16px; right: 16px; }
.lightbox .nav { top: 50%; translate: 0 -50%; }
.lightbox .prev { left: 24px; }
.lightbox .prev svg { transform: rotate(180deg); }
.lightbox .next { right: 24px; }

/* ---------- Contact ---------- */
footer > p { margin: 0; }
.email {
  display: block;
  margin-top: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: clamp(1.75rem, 5vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  transition: filter .8s ease, opacity .8s ease, color .2s;
}
.email:hover { color: var(--accent); }
.email.blurred { filter: blur(6px); opacity: .6; user-select: none; pointer-events: none; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  main { padding: 72px 16px 48px; }
  /* Stack: name, photo, intro */
  .hero { grid-template-columns: repeat(6, 1fr); grid-template-rows: none; gap: 24px 16px; }
  h1 { grid-column: 1 / -1; grid-row: 1; }
  .portrait { grid-column: 1 / 5; grid-row: 2; justify-self: stretch; width: 100%; }
  .lede { grid-column: 1 / -1; grid-row: 3; }
  section,
  footer { grid-template-columns: 1fr; margin-top: 72px; }
  .hero + section { margin-top: 104px; }
  section h2,
  footer::before,
  section > :not(h2),
  footer > p { grid-column: 1 / -1; }
  section h2 { margin-bottom: 20px; }
  .projects .url { display: none; }
  .projects a { grid-template-columns: 1fr 2rem; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  /* 9 photos in 2 columns: let the first one run full width so the grid closes evenly */
  .gallery button:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }

  .lightbox img { width: 100vw; height: calc(100dvh - 160px); }
  .lightbox figcaption { padding: 0 72px; flex-direction: column; gap: 2px; text-align: center; }
  .lightbox .nav { top: auto; bottom: 20px; translate: none; }
  .lightbox .prev { left: 16px; }
  .lightbox .next { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
