/* ============================================================
   FS Interiors — design tokens
   Tracking 0.185em is taken from the PowerPoint titles (spc=740
   on 40pt type), so the site and the printed portfolio match.
   ============================================================ */
:root {
  --paper: #ffffff;
  --wash: #f7f6f4;
  --ink: #111111;
  --muted: #767068;   /* 4.9:1 on paper — passes WCAG AA at small sizes */
  --hairline: #e4e1dc;

  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --track: 0.185em;
  --sidebar: 300px;
  --gutter: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* old Edge/IE */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;              /* Chrome, Safari */
}
.sidebar { scrollbar-width: none; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute; top: 0; left: 0; z-index: 100;
  clip-path: inset(50%);
  background: var(--ink); color: #fff; padding: 12px 18px;
}
.skip-link:focus { clip-path: none; left: 12px; top: 12px; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  padding: 56px var(--gutter);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  z-index: 50;
}

.logo { display: block; margin-bottom: 48px; }
.logo img { width: 92px; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-eyebrow {
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.nav a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  color: var(--muted);
  transition: color 0.35s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }

.nav .num {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #b8b3ac;
  transition: color 0.35s var(--ease);
}
.nav a:hover .num,
.nav a[aria-current="page"] .num { color: var(--muted); }

.nav-sep {
  height: 1px;
  background: var(--hairline);
  margin: 26px 0;
}

.nav-secondary a { color: var(--muted); }

.sidebar-foot { margin-top: auto; padding-top: 40px; }

.social {
  display: flex;
  gap: 16px;
  margin-bottom: 22px;
}
.social a { color: var(--muted); transition: color 0.3s var(--ease); }
.social a:hover { color: var(--ink); }
.social svg { width: 16px; height: 16px; fill: currentColor; }

.colophon {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

/* ---------- mobile bar ---------- */
.mobile-bar { display: none; }

/* ---------- main ---------- */
.main {
  margin-left: var(--sidebar);
  padding: 56px var(--gutter) 120px;
  min-width: 0;
}

.page-head {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 56px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0.01em;
  margin: 0;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}

.lede {
  max-width: 62ch;
  margin: 22px 0 0;
  color: #4a4844;
  font-size: 16px;
}

/* ---------- home ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(28px, 3.4vw, 52px);
}

.card { position: relative; display: block; }

.card-media {
  position: relative;
  overflow: hidden;
  background: var(--wash);
  aspect-ratio: 3 / 4;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  transition: transform 1.1s var(--ease), filter 0.7s var(--ease);
}
.card:hover .card-media img,
.card:focus-visible .card-media img {
  transform: scale(1.035);
  filter: grayscale(0);
}

/* the number plate — echoes the 01–04 index in the printed portfolio */
.card-num {
  position: absolute;
  right: 0; bottom: 0;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transform: translate(1px, 1px);
}

.card-body { padding-top: 18px; }
.card h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 34ch;
}

/* home "contents" — every project as a tall vertical tile, all in one screen */
.contents {
  display: grid;
  grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr));
  gap: clamp(8px, 0.8vw, 14px);
}
.tile { display: flex; flex-direction: column; min-width: 0; }
.tile-media {
  position: relative;
  overflow: hidden;
  background: var(--wash);
  aspect-ratio: 3 / 5;
}
.tile-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  transition: transform 1.2s var(--ease);
}
.tile:hover .tile-media img { transform: scale(1.05); }
.tile-num {
  position: absolute;
  right: 0; bottom: 0;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transform: translate(1px, 1px);
}
.tile-title {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.3s var(--ease);
}
.tile:hover .tile-title { color: var(--muted); }

/* ---------- project page ---------- */
.hero {
  position: relative;
  margin-bottom: 48px;
  background: var(--wash);
}
.hero img {
  width: 100%;
  /* leave room under the hero for the title block, so it's visible on load;
     capped at 70vh on tall screens so the hero doesn't get oversized */
  max-height: min(70vh, calc(100vh - 260px));
  object-fit: cover;
}
.hero-num {
  position: absolute;
  top: 0; left: 0;
  padding: 10px 16px;
  background: var(--paper);
  font-size: 11px;
  letter-spacing: var(--track);
}

.project-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr);
  gap: clamp(28px, 5vw, 90px);
  padding-bottom: 44px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 72px;
}
.project-intro p { margin: 0; color: #4a4844; max-width: 68ch; }

.tools h3,
.section-title {
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 14px;
}
.tools ul { list-style: none; margin: 0; padding: 0; }
.tools li { padding: 3px 0; font-size: 14px; }

.section { margin-bottom: clamp(56px, 7vw, 104px); }
.section-title {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 26px;
}

.grid {
  display: grid;
  gap: 14px;
  align-items: start;
}
.grid.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.cols6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
/* a single image is shown large, at its own proportions (e.g. balcony, printer room) */
.grid.cols1 { display: block; }
.grid.cols1 .shot { display: inline-block; width: auto; max-width: 100%; vertical-align: top; }
.grid.cols1 .shot img { width: auto; height: auto; max-width: 100%; max-height: 520px; }
/* photos grouped by size into separate blocks — clear space between them */
.section .grid + .grid { margin-top: clamp(30px, 3vw, 46px); }

.shot {
  position: relative;
  display: block;
  width: 100%;
  background: var(--wash);
  overflow: hidden;
}
.shot img { width: 100%; transition: transform 1.1s var(--ease); }
.shot:hover img { transform: scale(1.025); }

.shot figcaption {
  padding: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Drawings read as documents, not photographs — no frames, no hover zoom. */
.drawings .shot { background: #fff; border: 0; padding: 0; }
.drawings .shot img { padding: 0; }
.drawings .shot:hover img { transform: none; }

/* Plans: every sheet shares one aspect ratio, so one clean grid holds them all. */
.grid.drawings.plans {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: clamp(20px, 2.4vw, 40px);
}
.grid.drawings.plans.uniform .shot img {
  width: 100%;
  aspect-ratio: 1.414 / 1;
  object-fit: contain;
}
/* A single sheet keeps its own proportions rather than being letterboxed. */
.grid.drawings.plans:not(.uniform) { grid-template-columns: minmax(0, 520px); }
.grid.drawings.plans:not(.uniform) .shot img { width: 100%; height: auto; }

/* Elevations are drawn at one scale off a shared wall height, so we match their
   height and let the widths fall where they truly fall. */
.subsection {
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  margin: 52px 0 22px;
}
.drawings.elevations {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: clamp(20px, 2.6vw, 44px);
}
.drawings.elevations .shot { flex: 0 0 auto; width: auto; }
.drawings.elevations .shot img {
  height: clamp(200px, 24vw, 320px);
  width: auto;
  max-width: none;
}
.drawings.elevations figcaption { max-width: 22ch; }

/* ---------- next project ---------- */
.next {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}
.next span {
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
}
.next strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 38px);
}
.next a { display: block; }
.next a:hover strong { text-decoration: underline; text-underline-offset: 6px; }

/* ---------- about / contact ---------- */
.prose { max-width: 62ch; }
.prose p { color: #4a4844; }
.prose a { border-bottom: 1px solid var(--hairline); }
.prose a:hover { border-color: var(--ink); }

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: start;
}
.about-layout img {
  filter: grayscale(1);
  /* keep the filtered image on its own layer (painted once), so sliding the
     menu over it doesn't re-run the grayscale filter each frame.
     will-change only — no transform value, so the reveal animation still runs */
  will-change: transform;
}

/* contact: email/copy column on the left, message form on the right */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: start;
}

.contact-intro {
  margin: 0 0 22px;
  color: #4a4844;
  max-width: 30ch;
}
.contact-note {
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 34ch;
}

.contact-email { margin: 0; }
.contact-email .label {
  display: block;
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
/* email is a plain mailto link — click to write, or select to copy */
.contact-email .value {
  font-size: 17px;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.3s var(--ease);
}
.contact-email .value:hover { border-color: var(--ink); }

/* Contact fits one screen on desktop — no page scroll.
   Mobile (≤900px) keeps normal scrolling so the form + keyboard have room. */
@media (min-width: 901px) {
  body.page-contact { height: 100vh; overflow: hidden; }
  body.page-contact .main {
    height: 100vh;
    box-sizing: border-box;
    padding-bottom: 56px;
    overflow: hidden;
  }

  /* Home fits one screen — no scroll. Tiles fill the leftover height as tall slices. */
  body.page-home { height: 100vh; overflow: hidden; }
  body.page-home .main {
    height: 100vh;
    box-sizing: border-box;
    padding-bottom: 40px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.page-home .page-head { margin-bottom: clamp(18px, 2.4vh, 40px); }
  body.page-home .contents {
    flex: 1 1 auto;
    min-height: 0;
    grid-auto-rows: minmax(0, 1fr);
  }
  body.page-home .tile { min-height: 0; }
  body.page-home .tile-media { aspect-ratio: auto; flex: 1 1 auto; min-height: 0; }
}

/* ---------- contact form ---------- */
.contact-form { margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;            /* 16px stops iOS Safari from zooming in on focus */
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  padding: 9px 0;
  border-radius: 0;
  transition: border-color 0.3s var(--ease);
}
.field textarea { resize: none; overflow-y: hidden; min-height: 96px; }
.field input:hover,
.field textarea:hover { border-bottom-color: var(--muted); }
.field input:focus,
.field textarea:focus { outline: none; border-bottom-color: var(--ink); }
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-bottom-color: #a3352b; }

.btn {
  padding: 13px 24px;
  border: 1px solid var(--ink);
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: transparent; color: var(--ink); }

/* send bar — a single Submit that opens the visitor's own mail app */
.send {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.send .btn { display: inline-block; }
.send-status {
  margin: 16px 0 0;
  font-size: 12px;
  min-height: 1em;
  color: var(--muted);
}
.send-status[data-state="error"] { color: #a3352b; }
.send-status[data-state="ok"] { color: var(--ink); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.985);
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 64px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.lightbox[data-open="true"] { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  padding: 14px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  transition: color 0.3s var(--ease);
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { color: var(--ink); }
.lightbox-close { top: 10px; right: 14px; }
.lightbox-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-count {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: var(--track);
  color: var(--muted);
}

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--gutter);
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
  }
  .mobile-bar img { width: 46px; }
  .menu-toggle {
    font-size: 10px;
    letter-spacing: var(--track);
    text-transform: uppercase;
    padding: 8px 0;
  }

  .sidebar {
    inset: 0;
    width: 100%;
    /* clear the sticky bar (≈85px) plus the notch, then breathe */
    padding-top: calc(85px + env(safe-area-inset-top, 0px) + 32px);
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform 0.45s var(--ease), visibility 0.45s;
    overflow-y: auto;
    border-right: 0;
    /* keep the sliding panel on its own GPU layer so the (heavy, filtered)
       page content behind it isn't repainted each frame — smooth everywhere */
    will-change: transform;
    backface-visibility: hidden;
  }
  .sidebar[data-open="true"] { transform: none; visibility: visible; }
  .sidebar .logo { display: none; }
  .nav-eyebrow { margin-bottom: 18px; }
  .nav a { padding: 11px 0; font-size: 18px; }

  .main { margin-left: 0; padding-top: 36px; }
  .project-intro,
  .about-layout,
  .contact-layout { grid-template-columns: 1fr; }
  .grid.cols2, .grid.cols3, .grid.cols4, .grid.cols5, .grid.cols6 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid.drawings.plans { grid-template-columns: 1fr; gap: 22px; }
  .contents { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .contents .tile-media { aspect-ratio: 3 / 4; }
}

@media (max-width: 560px) {
  .grid.cols2, .grid.cols3, .grid.cols4, .grid.cols5, .grid.cols6 { grid-template-columns: 1fr; }
  .grid.drawings.plans { grid-template-columns: 1fr; }
  .field-row { gap: 16px; }
  .lightbox-prev, .lightbox-next { top: auto; bottom: 12px; transform: none; }

  /* the home page was four full-height portraits stacked — too much scrolling */
  .card-media { aspect-ratio: 4 / 3; }
  .card-num { width: 46px; height: 46px; font-size: 13px; }
  .projects { gap: 34px; }

  .hero { margin-bottom: 44px; }
  .hero img { max-height: 56vh; }

  .main { padding-bottom: 84px; }
  .page-head { margin-bottom: 40px; }

  /* comfortable thumb targets */
  .nav a { padding: 13px 0; }
  .btn { padding: 16px 26px; }
}

@media (max-width: 360px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .sidebar, .mobile-bar, .lightbox { display: none; }
  .main { margin: 0; }
}
