@font-face {
  font-family: 'Atlas';
  src: url('./fonts/Atlas_Grotesk_Web_Black_Regular.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

:root {
  --blue:   #002FA7;
  --bg:     #ffffff;
  --rule:   rgba(0,47,167,0.18);
  --muted:  rgba(0,47,167,0.45);
  /* Title block width (home + sidebar), tuned toward the 2×3.5 business card */
  --sidebar-w: 220px;
  /* Sidebar zoom: 1 at ≥1200px, easing to 0.85 at the 720px breakpoint.
     tan(atan2()) turns 100vw/3200px into a unitless number for zoom. */
  --sidebar-scale: clamp(0.85, calc(0.625 + tan(atan2(100vw, 3200px))), 1);
  /* One spacing unit for the whole frame: the title block's edge offset,
     scaled with it. Every gap between neighbours — window edges, rules,
     content, boxes — is one --gap, except the wider left margin. */
  --gap-base: 32px;
  --gap: calc(var(--gap-base) * var(--sidebar-scale));
  /* Viewport right edge to sidebar left edge: its width plus one gap */
  --sidebar-reach: calc((var(--sidebar-w) + var(--gap-base)) * var(--sidebar-scale));
  --sidebar-inset: var(--gap);
  /* Sheet frame: page edge to the left rule (kept wider), and rule to content */
  --sheet-margin: clamp(28px, 5vw, 64px);
  --sheet-pad: var(--gap);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scrollbar-gutter: stable; }

body {
  background: var(--bg);
  color: var(--blue);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ─────────────────────────────────────────
   HOMEPAGE — centred title block
───────────────────────────────────────── */

body.home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.home-block {
  width: min(var(--sidebar-w), 92vw);
  border: 0.75px solid var(--blue);
  opacity: 0;
  transform: translateY(7px);
  animation: fadein 0.5s ease forwards 0.08s;
}

/* ─────────────────────────────────────────
   SHARED BLOCK PARTS
   (used on homepage + sidebar)
───────────────────────────────────────── */

.block-logo {
  padding: 24px 24px 18px;
  border-bottom: 0.75px solid var(--blue);
}

.block-info {
  border-bottom: 0.75px solid var(--blue);
}

.info-row {
  border-bottom: 0.5px solid var(--rule);
  padding: 6px 16px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: baseline;
}
.info-row:last-child { border-bottom: none; }

.info-label {
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-value {
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--blue);
  line-height: 1.55;
}

.info-value--title {
  font-family: 'Atlas', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.block-nav { border-bottom: 0.75px solid var(--blue); }

.nav-row {
  border-bottom: 0.5px solid var(--rule);
  display: grid;
  grid-template-columns: 58px 1fr 24px;
  gap: 8px;
  align-items: center;
  padding: 0 16px;
  height: 36px;
  cursor: pointer;
  transition: background 0.13s ease;
}
.nav-row:last-child { border-bottom: none; }
.nav-row:hover { background: rgba(0,47,167,0.05); }

.nav-row-label {
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-row-title {
  font-family: 'Atlas', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue);
  transition: letter-spacing 0.18s ease;
}
.nav-row:hover .nav-row-title { letter-spacing: 0.14em; }

/* Active page highlight */
.nav-row.active { background: rgba(0,47,167,0.04); }
.nav-row.active .nav-row-title { letter-spacing: 0.14em; }

.nav-row-num {
  font-size: 7px;
  letter-spacing: 0.06em;
  color: rgba(0,47,167,0.35);
  text-align: right;
}


.block-rev {
  display: grid;
  grid-template-columns: 16px 1fr 68px;
}

.rev-cell {
  padding: 4px 6px;
  font-size: 6.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0,47,167,0.38);
  border-right: 0.5px solid var(--rule);
}
.rev-cell:last-child { border-right: none; }
.rev-cell.data { color: var(--blue); }

/* Row 3 — Instagram + copyright */
.rev-ig-spacer {
  border-top: 0.5px solid var(--rule);
}
.rev-ig {
  border-top: 0.5px solid var(--rule);
  border-right: none;
  text-decoration: none;
  color: var(--muted);
  letter-spacing: 0.1em;
  transition: color 0.18s ease;
}
.rev-ig:hover { color: var(--blue); }
.rev-copy {
  border-top: 0.5px solid var(--rule);
  border-right: none;
  color: rgba(0,47,167,0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rev-instagram {
  grid-column: 1 / -1;
  border-top: 0.5px solid var(--rule);
  padding: 4px 6px;
}

.rev-instagram a {
  font-size: 6.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0,47,167,0.5);
  text-decoration: none;
  transition: color 0.18s;
}

.rev-instagram a:hover { color: var(--blue); }

/* ─────────────────────────────────────────
   INNER PAGE LAYOUT
───────────────────────────────────────── */

body.inner {
  min-height: 100vh;
  display: flex;
}

/* Sidebar — floating title block */
.sidebar {
  position: fixed;
  /* Unscaled gap: the sidebar's zoom scales it to --gap */
  bottom: var(--gap-base);
  right: var(--gap-base);
  width: var(--sidebar-w);
  zoom: var(--sidebar-scale);
  border: 0.75px solid var(--blue);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

/* Brand glyph: small, bottom-left on every desktop page, centred in the
   left gutter and standing on the bottom margin. Links to Instagram like
   the @almost_arch tag. (Phones have it in the bottom bar instead.) */
.corner-glyph {
  --glyph-w: 13px;
  position: fixed;
  left: calc((var(--sheet-margin) - var(--glyph-w)) / 2);
  bottom: var(--gap);
  width: var(--glyph-w);
  line-height: 0;
  z-index: 90;
  transition: opacity 0.18s ease;
}
.corner-glyph svg { display: block; width: 100%; height: auto; }
.corner-glyph:hover { opacity: 0.6; }

/* Main content */
.main {
  margin-right: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────
   WORK PAGE — one large frame, driven by a project list
   stacked above the title block
───────────────────────────────────────── */

/* Work's scale also shrinks on short windows so the three stacked boxes
   fit (~795px tall at full size, offsets included). Set on body so the
   gaps, left rule and frame all scale with the boxes. */
body:has(.work-stage) {
  --sidebar-scale: min(
    clamp(0.85, calc(0.625 + tan(atan2(100vw, 3200px))), 1),
    tan(atan2(100vh, 795px))
  );
  /* Re-derived here so they pick up this page's scale */
  --gap: calc(var(--gap-base) * var(--sidebar-scale));
  --sidebar-reach: calc((var(--sidebar-w) + var(--gap-base)) * var(--sidebar-scale));
  --sidebar-inset: var(--gap);
  --sheet-pad: var(--gap);
}

/* The frame fills the sheet exactly, so the page itself doesn't scroll */
#work-grid {
  position: relative;
  height: calc(100vh - 2 * var(--sidebar-inset));
  margin: var(--sidebar-inset) var(--sidebar-reach) var(--sidebar-inset) var(--sheet-margin);
  touch-action: pinch-zoom; /* swipes step projects instead of panning */
}

/* Left rule stays put, inset top and bottom like the sidebar. On body,
   since .main's fade-in transform would trap a fixed child. */
body:has(#work-grid)::before {
  content: "";
  position: fixed;
  top: var(--sidebar-inset);
  bottom: var(--sidebar-inset);
  left: var(--sheet-margin);
  border-left: 0.75px solid var(--blue);
  pointer-events: none;
  z-index: 90;
}

/* Every project sits in the same frame; only the active one shows */
.stage-item {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--sheet-pad);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.stage-item.is-active { opacity: 1; pointer-events: auto; }

/* Desktop frame is image-only; title and facts show in the info box */
.stage-item .panel-title,
.stage-item .project-info { display: none; }

/* Photos fill the frame edge to edge (focus set per image);
   drawings sit whole in the middle */
.stage-img { flex: 1; min-height: 0; }
.stage-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stage-img--drawing img { object-fit: contain; }

/* Project facts: black content under a blue title */
.project-info { list-style: none; }
.project-info li {
  font-size: 8px;
  letter-spacing: 0.14em;
  line-height: 1.9;
  text-transform: uppercase;
  color: #000;
}

/* Info and index boxes ride above the title block in one fixed column */
.sidebar-stack {
  position: fixed;
  right: var(--gap-base);
  bottom: var(--gap-base);
  zoom: var(--sidebar-scale);
  display: flex;
  flex-direction: column;
  gap: 16px; /* tighter than --gap: the boxes read as one set */
  z-index: 100;
}
.sidebar-stack > .sidebar { position: static; zoom: 1; }
.sidebar--top > :last-child { border-bottom: none; }

/* Small grey box label, e.g. PROJECTS */
.box-label {
  display: flex;
  justify-content: space-between;
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Project pages: prev / next arrows either side of the "n / total" count */
.pager {
  display: flex;
  align-items: center;
  gap: 2px;
}
.pager a {
  font-size: 10px;
  letter-spacing: 0;
  line-height: 1;
  color: var(--blue);
  padding: 4px 5px;  /* bigger target than the arrow itself */
  margin: -4px 0;
  transition: opacity 0.13s ease;
}
.pager a:hover { opacity: 0.6; }

/* Info box: every project's info sits in one grid cell so the box keeps
   the height of the tallest and doesn't jump between projects */
.project-card-body {
  display: grid;
  padding: 12px 16px 14px;
}
.card-item {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}
.card-item.is-active { opacity: 1; visibility: visible; }

.card-name {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  line-height: 1.25;
  margin-bottom: 6px;
}

/* Project list */
.project-block { padding-top: 12px; }
.project-block .box-label { padding: 0 16px; }

.project-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 5px 16px;
  border-top: 0.5px solid var(--rule);
  transition: background 0.13s ease;
}
.project-row:hover,
.project-row:focus-visible { background: rgba(0,47,167,0.05); outline: none; }
.project-row.is-active { background: rgba(0,47,167,0.06); }

.project-row-name {
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--blue);
}
.project-row-place {
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Filters, above the project list; they hide rows and frames alike */
.filter-block {
  border-bottom: 0.75px solid var(--blue);
  padding: 12px 16px 14px;
}

.filter-block-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-tag {
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  border: 0.5px solid rgba(0,47,167,0.3);
  padding: 3px 7px;
  cursor: pointer;
  background: transparent;
  transition: background 0.13s ease, border-color 0.13s ease;
}
.filter-tag:hover {
  background: rgba(0,47,167,0.05);
  border-color: rgba(0,47,167,0.5);
}
.filter-tag.active {
  background: var(--blue);
  color: var(--bg);
  border-color: var(--blue);
}

.project-row.hidden,
.stage-item.hidden { display: none; }

/* ─────────────────────────────────────────
   SHEET LAYOUT — About + Contact
   Panels split by full-height rules, like a drawing sheet.
   The last panel runs open up to the sidebar.
───────────────────────────────────────── */

.sheet {
  display: grid;
  /* Every rule stops level with the bottom of the title block,
     with the same inset at the top */
  min-height: calc(100vh - 2 * var(--sidebar-inset));
  /* One gap to the sidebar on the right, as on the left */
  margin: var(--sidebar-inset) var(--sidebar-reach) var(--sidebar-inset) var(--sheet-margin);
  border-left: 0.75px solid var(--blue);
}

.sheet--about   { grid-template-columns: 1.4fr 1fr 1fr; }
.sheet--contact { grid-template-columns: 1fr 1.5fr; }

.sheet-panel {
  padding: var(--sheet-pad);
  border-left: 0.75px solid var(--blue);
}
.sheet-panel:first-child { border-left: none; }

/* Matches the sheet's light uppercase panel titles */
.panel-title {
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 24px;
}

/* Underlined bold sub-heading, e.g. "DENSITY CALCULATION" */
.panel-sub {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--blue);
  margin-bottom: 10px;
}

.panel-text p {
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(0,0,0,0.7);
}
.panel-text p + p { margin-top: 12px; }
.panel-text + .contact-form { margin-top: 32px; }

/* Plain ruled list */
.panel-list { list-style: none; }

.panel-list li {
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  padding: 8px 0;
  border-bottom: 0.5px solid var(--rule);
}

/* Directory, like the sheet's owner / architect listing */
.directory dt {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-top: 18px;
  margin-bottom: 3px;
}
.directory dt:first-child { margin-top: 0; }

.directory dd {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--blue);
}

.directory a:hover { opacity: 0.65; }

/* Narrower desktops: Services drops under Practice, Principles keeps column 2 */
@media (max-width: 1100px) {
  .sheet--about {
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: auto 1fr;
  }
  .sheet--about .sheet-panel:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
  .sheet--about .sheet-panel:nth-child(3) { grid-column: 1; grid-row: 2; border-left: none; }
}

/* Form */
.contact-form .field { margin-bottom: 18px; }

.contact-form label {
  display: block;
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid rgba(0,47,167,0.28);
  border-radius: 0;
  padding: 7px 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  color: var(--blue);
  outline: none;
  appearance: none;
  transition: border-color 0.18s ease;
}

.contact-form textarea { resize: vertical; min-height: 100px; }

.contact-form input:focus,
.contact-form textarea:focus { border-bottom-color: var(--blue); }

.contact-form button {
  margin-top: 6px;
  background: var(--blue);
  color: #ffffff;
  border: none;
  padding: 11px 28px;
  font-family: 'Atlas', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.18s ease;
}
.contact-form button:hover { opacity: 0.8; }

.form-success {
  display: none;
  font-size: 12.5px;
  color: var(--blue);
  padding: 12px 0;
}

/* ─────────────────────────────────────────
   PROJECT PAGES — contact sheet + one fixed frame
   Built on the Work page's frame (.work-stage); images are shown whole.
───────────────────────────────────────── */

.work-stage--whole .stage-img img { object-fit: contain; }

/* Alignment: portrait and square images stand on the bottom margin;
   landscape ones (.is-landscape, set by the page script) hang from the top
   of the box stack. --lift is the stack top's distance below the frame top,
   kept current by the page script. */
.work-stage--whole .stage-img img { object-position: center bottom; }
.work-stage--whole .is-landscape .stage-img { padding-top: var(--lift, 0px); }
.work-stage--whole .is-landscape .stage-img img { object-position: center top; }

/* Axo drawings at true architectural scale: every drawing shares one
   inches-per-pixel scale on screen, so a 400 SF ADU reads smaller than an
   800 SF house. Each image gives its real width in inches (--real-w,
   measured from its 6'-8" doors). The shared scale is the largest that
   lets every drawing in the set fit: the widest across the frame, the
   tallest (bottom-standing) in its full height, and the tallest landscape
   one in the height left below --lift. */
.work-stage--whole .stage-img--to-scale {
  --set-w: 1457;            /* Delphi, 121'-5" wide */
  --set-h: 1177;            /* Laurelcrest, 98'-1" deep */
  --set-h-landscape: 1093;  /* Delphi, 91'-1" deep */
  container-type: size;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.work-stage--whole .stage-img--to-scale img {
  width: calc(var(--real-w) * min(100cqw / var(--set-w),
                                  100cqh / var(--set-h),
                                  (100cqh - var(--lift, 0px)) / var(--set-h-landscape)));
  height: auto;
}
/* Its frame stays full height (the shared scale is worked out from it), so
   a landscape drawing is lowered by margin rather than padding */
.work-stage--whole .is-landscape .stage-img--to-scale { padding-top: 0; align-items: flex-start; }
.work-stage--whole .is-landscape .stage-img--to-scale img { margin-top: var(--lift, 0px); }

/* Contact sheet: a grid of blue-scale thumbnails, like a sheet index */
.contact-sheet { padding: 12px 16px 14px; }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.thumb {
  position: relative;
  display: block;
  padding: 0;
  border: 0.5px solid var(--rule);
  background: none;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.13s ease;
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1);
}
/* Blue-scale: a lightened brand blue screened over the greyscale image,
   so darks turn a pale blue and whites stay white */
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--blue) 65%, white);
  mix-blend-mode: screen;
}
.thumb:hover { border-color: var(--blue); }
.thumb.is-active { border-color: var(--blue); outline: 0.75px solid var(--blue); }
.thumb:focus-visible { outline: 0.75px solid var(--blue); }

/* Caption for the image in the frame, under the project facts */
.card-caption {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 0.5px solid var(--rule);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.caption-name { color: #000; }
.caption-count { color: var(--muted); }

/* ─────────────────────────────────────────
   PROJECT PAGE
───────────────────────────────────────── */

.project-hero {
  width: 100%;
  height: 65vh;
  object-fit: cover;
  display: block;
}

.project-header {
  padding: 32px clamp(28px, 5vw, 64px) 0;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 20px;
}

.project-meta-label {
  font-size: 6.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}

.project-title {
  font-family: 'Atlas', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-size: clamp(18px, 3vw, 26px);
  letter-spacing: 0.01em;
  color: var(--blue);
  margin-bottom: 12px;
}

.project-meta-list {
  list-style: none;
}

.project-meta-list li {
  font-size: 11.5px;
  color: rgba(0,0,0,0.55);
  line-height: 1.9;
}

.project-images {
  padding: 36px clamp(28px, 5vw, 64px) 48px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-images img { width: 100%; }

.project-nav {
  border-top: 0.5px solid var(--rule);
  padding: 20px clamp(28px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
}

.project-nav a {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.18s;
}
.project-nav a:hover { color: var(--blue); }

/* ─────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────── */

@keyframes fadein {
  to { opacity: 1; transform: none; }
}

.main > * {
  opacity: 0;
  animation: fadein 0.4s ease forwards 0.12s;
}

/* ─────────────────────────────────────────
   VIEW TRANSITIONS (cross-document)
───────────────────────────────────────── */

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
  /* Named so logo, info and nav morph to their new positions rather than jumping */
  .block-logo    { view-transition-name: sidebar-logo;    }
  .block-info    { view-transition-name: sidebar-info;    }
  .block-nav     { view-transition-name: sidebar-nav;     }
  .project-card  { view-transition-name: sidebar-card;    }
  .project-index { view-transition-name: sidebar-index;   }

  /* Sync morph timing with the expand/collapse animations */
  ::view-transition-group(sidebar-logo),
  ::view-transition-group(sidebar-info),
  ::view-transition-group(sidebar-nav) {
    animation-duration: 0.38s;
    animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes vt-expand-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0);    }
  }
  @keyframes vt-collapse-down {
    from { opacity: 1; transform: translateY(0);   }
    to   { opacity: 0; transform: translateY(8px); }
  }

  ::view-transition-new(sidebar-card),
  ::view-transition-new(sidebar-index) {
    animation: vt-expand-up 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  }
  ::view-transition-old(sidebar-card),
  ::view-transition-old(sidebar-index) {
    animation: vt-collapse-down 0.22s ease-in forwards;
  }

  /* Keep root cross-fade quick so sidebar animation reads clearly */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.22s;
  }
}

/* ─────────────────────────────────────────
   RESPONSIVE — mobile
───────────────────────────────────────── */

/* ─────────────────────────────────────────
   MOBILE NAV — bottom bar + overlay
───────────────────────────────────────── */

.mob-bar,
.mob-overlay {
  display: none;
}

@media (max-width: 720px) {
  :root { --sidebar-reach: 0px; --gap: 16px; }

  /* Same proportions as desktop, a little larger for phones */
  .home-block { zoom: 1.25; }

  /* Hide desktop sidebar entirely */
  .sidebar { display: none; }

  /* Project pages keep their PROJECT box (details + prev/next) on phones,
     moved to the top of the page, with the contact sheet beside it in the
     top-right corner as an index of the images below */
  .sidebar-stack--project {
    position: static;
    zoom: 1;
    order: -1;
    flex-direction: row;
    align-items: stretch;
    padding: 16px 16px 0;
  }
  .sidebar-stack--project .project-card { display: block; flex: 1 1 auto; min-width: 0; width: auto; }
  .sidebar-stack--project .contact-sheet {
    display: block;
    order: 2;
    flex: 0 0 116px;
    width: auto;
    padding: 10px;
  }

  /* Project pages: images stack (Work's phone layout); the caption is
     dropped since the box sits at the top */
  .card-caption { display: none; }
  .work-stage--whole .stage-img--to-scale { container-type: normal; display: block; }
  .work-stage--whole .stage-img--to-scale img { width: calc(100% * var(--real-w) / var(--set-w)); margin: 0 auto; }
  .work-stage--whole .is-landscape .stage-img,
  .work-stage--whole .is-landscape .stage-img--to-scale img { padding-top: 0; margin-top: 0; }
  /* No rules between a project's images, just an even space */
  .work-stage--whole .stage-item { border-top: none; padding: 16px 0 0; }
  .sidebar-stack--project .pager a { font-size: 13px; padding: 8px 10px; margin: -8px -2px; }

  body.inner {
    flex-direction: column;
    padding-bottom: 44px;
  }

  body.home {
    padding-bottom: 44px;
  }

  .main {
    margin-right: 0;
    width: 100%;
  }

  /* Bottom bar — always visible */
  .mob-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 44px;
    background: var(--bg);
    border-top: 0.75px solid var(--blue);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 400;
  }

  .corner-glyph { display: none; }

  .mob-bar-glyph {
    display: flex;
    align-items: center;
    padding: 8px 0;
  }

  .mob-bar-menu {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 8px 0;
    cursor: pointer;
  }

  /* Bottom-sheet overlay — slides up over the page */
  .mob-overlay {
    display: flex;
    position: fixed;
    bottom: 44px;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 0.75px solid var(--blue);
    border-bottom: none;
    flex-direction: column;
    z-index: 399;
    transform: translateY(calc(100% + 2px));
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: calc(100svh - 88px);
    overflow-y: auto;
  }

  .mob-overlay.open { transform: none; }

  .mob-overlay-logo {
    flex-shrink: 0;
    padding: 20px 16px 18px;
    border-bottom: 0.75px solid var(--blue);
    display: flex;
    justify-content: center;
  }

  .mob-overlay-logo svg { width: 180px; height: auto; }

  .mob-overlay-nav { flex-shrink: 0; }

  .mob-overlay-nav .nav-row {
    display: grid;
    grid-template-columns: 56px 1fr 26px;
    gap: 8px;
    align-items: center;
    padding: 0 16px;
    height: 42px;
    border-bottom: 0.5px solid var(--rule);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.13s ease;
  }

  .mob-overlay-nav .nav-row:last-child { border-bottom: none; }
  .mob-overlay-nav .nav-row:hover { background: rgba(0,47,167,0.05); }
  .mob-overlay-nav .nav-row:hover .nav-row-title { letter-spacing: 0.14em; }

  /* Sheet: panels stack, rules turn horizontal */
  .sheet {
    display: block;
    min-height: unset;
    margin: 0 var(--sheet-margin);
    border: none;
  }
  .sheet-panel {
    padding: 32px 0;
    border-left: none;
    border-top: 0.75px solid var(--blue);
  }
  .sheet-panel:first-child { border-top: none; }

  /* Work: no title block on phones, so every project shows stacked */
  body:has(.work-stage) { --sidebar-reach: 0px; --gap: 16px; }
  #work-grid {
    height: auto;
    margin: 0;
    padding: 0 16px;
    touch-action: auto;
  }
  body:has(#work-grid)::before { display: none; }
  .stage-item {
    position: static;
    display: block;
    opacity: 1;
    pointer-events: auto;
    padding: 32px 0;
    border-top: 0.75px solid var(--blue);
  }
  .stage-item:first-child { border-top: none; }
  .stage-item .panel-title { display: block; margin-bottom: 8px; }
  .stage-item .project-info { display: block; margin-bottom: 20px; }
  .stage-img img { height: auto; }
}
