:root {
  --font: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --bg: #f8f8f8;
  --text: #000000;
  --link-muted: #9b9b9b;
  --pad: clamp(24px, 3vw, 76px);
  --gap: clamp(10px, 1.1vw, 28px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
strong { font-weight: 600; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--bg); padding: 8px 12px; z-index: 200; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(22px, 2.2vw, 44px) var(--pad);
}
.site-title {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
}
.site-nav { display: flex; align-items: center; gap: clamp(18px, 1.4vw, 28px); }
.site-nav a { text-decoration: none; font-size: 1rem; line-height: 1; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.site-nav .linkedin { font-weight: 700; font-size: 1.15rem; margin-left: clamp(8px, 1vw, 20px); letter-spacing: -0.02em; }

.menu-toggle {
  display: none; background: none; border: 0; padding: 10px 0; cursor: pointer;
  width: 38px; height: 26px; position: relative;
}
.menu-toggle span { position: absolute; left: 0; right: 0; height: 1.5px; background: var(--text); }
.menu-toggle span:first-child { top: 6px; }
.menu-toggle span:last-child { bottom: 6px; }

/* Phone menu overlay */
.mobile-menu {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: none; flex-direction: column; padding: 0 var(--pad);
}
.mobile-menu.open { display: flex; }
.mobile-menu-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.menu-close {
  width: 54px; height: 46px; border: 1.5px solid var(--text); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.mobile-menu nav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.mobile-menu nav a { font-size: 2.4rem; text-decoration: none; line-height: 1.5; }
.mobile-menu .linkedin { align-self: center; font-weight: 700; font-size: 1.3rem; text-decoration: none; padding: 32px 0; letter-spacing: -0.02em; }

/* ---------- Main ---------- */
main { padding: 0 var(--pad) 60px; }

.page-title {
  font-size: clamp(2.3rem, 3.3vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
  max-width: 13em;
  margin: clamp(32px, 4vw, 72px) 0 clamp(48px, 6vw, 110px);
}

.project { margin-bottom: clamp(56px, 6vw, 120px); }
.project:first-of-type { margin-top: clamp(16px, 2vw, 32px); }
.project-intro { margin: 0 0 clamp(20px, 2.2vw, 40px); font-size: 1.05rem; }
.project-intro a { color: var(--link-muted); text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Design page: one image per row with caption */
.stack { display: grid; gap: clamp(32px, 3vw, 56px); }
.stack figure { margin: 0; }
.stack figcaption, .gallery figcaption { margin-top: 10px; font-size: 0.85rem; line-height: 1.5; }

/* Grids that open full size */
.gallery { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, 1fr); row-gap: clamp(24px, 2.4vw, 48px); }
@media (width > 800px) {
  .cols-2.equal-gap { row-gap: var(--gap); }
}
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.gallery figure { margin: 0; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
.gallery img { width: 100%; object-fit: cover; }
.ratio-portrait img { aspect-ratio: 3 / 4; }
.ratio-landscape img { aspect-ratio: 4 / 3; }
.ratio-3x2 img { aspect-ratio: 3 / 2; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 150; background: rgba(248,248,248,0.94);
  display: none; align-items: center; justify-content: center; padding: 70px 90px;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: calc(100vh - 140px); max-width: 100%; width: auto; }
.lb-btn { position: absolute; background: none; border: 0; cursor: pointer; padding: 14px; color: var(--text); }
.lb-btn svg { display: block; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* Back to top */
.back-to-top-wrap { text-align: center; padding: 20px 0 40px; }
.back-to-top {
  display: inline-block; border: 1.5px solid var(--text); border-radius: 999px;
  padding: 10px 22px; font-size: 0.85rem; font-weight: 600; text-decoration: none; line-height: 1.2;
}

/* Reviews */
.reviews { max-width: 1010px; margin: clamp(40px, 5vw, 100px) auto 0; }
.review { margin: 0 0 clamp(56px, 4.6vw, 90px); }
.review p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes page-enter {
    from { opacity: 0.55; transform: translateY(8px); }
  }

  .site-header, .page-title, .is-revealed {
    animation: page-enter 480ms cubic-bezier(0.2, 0.65, 0.3, 1) backwards;
  }
  .site-header, .page-title { overflow-anchor: none; }
  .page-title { animation-delay: 70ms; }
  img.is-revealed { animation-duration: 560ms; }
}

/* ---------- Phone ---------- */
@media (max-width: 800px) {
  body { font-size: 16px; }
  .site-nav { display: none; }
  .menu-toggle { display: block; }
  .cols-4, .cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
  .stack figure img { width: calc(100% + var(--pad)); max-width: none; margin-left: calc(var(--pad) * -0.5); }
  .stack figcaption { margin-left: 0; font-size: 0.95rem; }
  .lightbox.open:not(.lightbox-mobile) { display: none; }
  .lightbox-mobile { padding: 60px 16px; }
  .lightbox-mobile .lb-prev { left: 0; }
  .lightbox-mobile .lb-next { right: 0; }
}
