/* ==========================================================================
   Dana Saar — portfolio
   Grid: 6 columns. Desktop design frame 1680px = 200px margins, 1280px content,
   80px gutters. Above 1680px margins + gutters stay fixed and columns grow.
   ========================================================================== */

:root {
  --ink: #222222;
  --muted: rgba(34, 34, 34, 0.62);
  --rule: rgba(34, 34, 34, 0.2);
  --stroke: rgba(34, 34, 34, 0.15);
  --accent: #bcedf6;
  --yellow: #ffb703;
  --blue: #187795;
  --red: #a54657;

  /* side margin: 200px, but the content column stops growing at 1520px
     (a 1920px screen). Wider than that, the margins grow instead.
     To let columns grow forever, set --content-max to 99999px. */
  --content-max: 1520px;
  --m: max(200px, (100vw - var(--content-max)) / 2);
  --g: 80px;    /* column gutter */
  --section-gap: 160px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
}

@media (max-width: 1679px) {
  :root {
    --m: clamp(64px, 11.905vw, 200px);
    --g: clamp(32px, 4.762vw, 80px);
    --section-gap: clamp(96px, 9.524vw, 160px);
  }
}
@media (max-width: 899px) {
  :root { --m: 40px; --g: 24px; --section-gap: 88px; }
}
@media (max-width: 599px) {
  :root { --m: 20px; --g: 16px; --section-gap: 72px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 32px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: none; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, figure, blockquote, ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { padding-inline: var(--m); }

/* Column helpers — % of the parent (which must span the full content width) */
.w2 { width: calc((100% - 5 * var(--g)) / 3 + var(--g)); }
.w3 { width: calc((100% - 5 * var(--g)) / 2 + 2 * var(--g)); }
.w4 { width: calc((100% - 5 * var(--g)) * 2 / 3 + 3 * var(--g)); }

/* Type */
.t-h2 { font-size: 32px; line-height: 42px; font-weight: 500; }
.t-body { font-size: 18px; line-height: 32px; }
.t-caption { font-size: 14px; line-height: 24px; font-weight: 600; color: var(--muted); }
strong, b { font-weight: 600; }

@media (max-width: 899px) {
  .t-h2 { font-size: 26px; line-height: 34px; }
  body, .t-body { font-size: 17px; line-height: 29px; }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 40px;
  padding-bottom: 16px;
  min-height: 80px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 18px; line-height: 22px; font-weight: 600;
}
.brand__mark { width: 8px; height: 22px; background: var(--accent); }

.nav { display: flex; align-items: center; gap: 24px; }
.nav__link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; line-height: 24px; font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav__link:hover, .nav__link[aria-current="page"], .nav__link.is-active { color: var(--ink); }
.nav__chev { width: 24px; height: 24px; transition: transform 0.25s var(--ease-out); }
.nav__work { position: relative; display: flex; }
.nav__work.is-open .nav__chev { transform: rotate(180deg); }

/* Work dropdown (designed in code — not in Figma yet) */
.work-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: -16px;
  width: max-content;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(34, 34, 34, 0.1);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(34, 34, 34, 0.1);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.25s var(--ease-out), visibility 0s linear 0.25s;
}
.nav__work.is-open .work-menu {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity 0.2s ease, transform 0.25s var(--ease-out), visibility 0s;
}
.work-menu__item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 16px; line-height: 22px; font-weight: 500;
  transition: background-color 0.15s ease;
}
.work-menu__item:hover, .work-menu__item[aria-current="page"] { background: rgba(34, 34, 34, 0.05); }
.swatch { flex: none; width: 8px; height: 22px; background: var(--c); }

/* Mobile menu (designed in code — not in Figma yet) */
/* Icon-only toggle: a three-line hamburger that turns into an X. The 44px tap
   area overhangs by 11px so the icon's right edge sits on the page margin. */
.menu-toggle {
  display: none;
  place-items: center;
  width: 44px; height: 44px;
  margin: -11px -11px -11px 0;
}
.menu-toggle__text {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.menu-toggle__icon, .menu-toggle__icon::before, .menu-toggle__icon::after {
  display: block; width: 22px; height: 2px; border-radius: 1px; background: var(--ink);
}
.menu-toggle__icon { position: relative; transition: background-color 0.15s ease; }
.menu-toggle__icon::before, .menu-toggle__icon::after {
  content: ""; position: absolute; left: 0;
  transition: transform 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.menu-toggle__icon::before { top: -7px; }
.menu-toggle__icon::after { top: 7px; }
/* X: rotated 22px lines would only span 15.6px, so they grow to 31.1px (centred) —
   the X then spans exactly the hamburger's 22px box */
.menu-open .menu-toggle__icon { background-color: transparent; }
.menu-open .menu-toggle__icon::before,
.menu-open .menu-toggle__icon::after { top: 0; width: 31.1px; left: -4.55px; }
.menu-open .menu-toggle__icon::before { transform: rotate(45deg); }
.menu-open .menu-toggle__icon::after { transform: rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #fff;
  padding: 120px var(--m) 40px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.menu-open .mobile-menu { opacity: 1; visibility: visible; transition: opacity 0.25s ease, visibility 0s; }
.menu-open { overflow: hidden; }
.mobile-menu__label { font-size: 14px; line-height: 24px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.mobile-menu__projects { display: flex; flex-direction: column; gap: 4px; margin-bottom: 40px; }
.mobile-menu__project {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 0;
  font-size: 22px; line-height: 30px; font-weight: 500;
}
.mobile-menu__project .swatch { margin-top: 4px; }
/* About / Contact: same type and spacing as the project links */
.mobile-menu__pages { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--rule); padding-top: 24px; }
.mobile-menu__page { padding: 10px 0; font-size: 22px; line-height: 30px; font-weight: 500; }

@media (max-width: 899px) {
  .nav { display: none; }
  .menu-toggle { display: grid; }
}
@media (min-width: 900px) {
  .mobile-menu { display: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { padding-bottom: 100px; }
.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }
.connect { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.connect__title {
  font-stretch: 87.5%;
  font-weight: 500;
  font-size: 72px; line-height: 88px; letter-spacing: 1.44px;
}
.contact-line { font-size: 18px; line-height: 32px; font-weight: 500; }
.contact-line a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s ease;
}
.contact-line a:hover { text-decoration-color: currentColor; }
.dot { font-family: Georgia, serif; font-weight: 700; margin-inline: 0.55em; }

.site-footer--home .rule { margin-bottom: 80px; }

.pager { display: flex; gap: var(--g); margin-top: 32px; margin-bottom: 160px; }
.pager__link { position: relative; display: block; height: 240px; }
.pager__bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24px; background: var(--c);
  transition: height 0.35s var(--ease-out);
}
.pager__link:hover .pager__bar { height: 40px; }
.pager__text {
  position: absolute; bottom: 44px; display: flex; flex-direction: column; line-height: 32px;
  transition: transform 0.35s var(--ease-out);
}
.pager__link:hover .pager__text { transform: translateY(-16px); }
.pager__link--prev .pager__text { right: 24px; align-items: flex-end; text-align: right; }
.pager__link--next .pager__text { left: 24px; align-items: flex-start; text-align: left; }
.pager__label { font-size: 14px; font-weight: 600; color: var(--muted); }
.pager__title { font-size: 24px; font-weight: 500; }
.pager__link--prev .pager__title { max-width: 268px; }
.pager__link--next .pager__title { max-width: 383px; }

@media (max-width: 1199px) {
  .connect__title { font-size: 60px; line-height: 72px; }
}
@media (max-width: 899px) {
  .site-footer { padding-bottom: 64px; }
  .site-footer--home .rule { margin-bottom: 56px; }
  .connect__title { font-size: 44px; line-height: 52px; letter-spacing: 0.88px; }
  .contact-line { font-size: 16px; line-height: 28px; }
  /* Pager as the mobile menu: label, then a colour bar to the left of the title.
     Next project comes first. */
  .pager { flex-direction: column; gap: 32px; margin-top: 40px; margin-bottom: 88px; }
  .pager__link--next { order: -1; }
  .pager__link {
    width: 100%; height: auto;
    display: grid; grid-template-columns: 8px 1fr; column-gap: 14px; align-items: start;
  }
  .pager__text { display: contents; }
  .pager__label { grid-column: 1 / -1; line-height: 24px; margin-bottom: 8px; }
  .pager__bar { position: static; grid-column: 1; grid-row: 2; height: 22px; margin-top: 4px; }
  .pager__title, .pager__link--prev .pager__title, .pager__link--next .pager__title {
    grid-column: 2; grid-row: 2; max-width: none !important;   /* beats the per-page desktop widths */
    font-size: 22px; line-height: 30px;
  }
  .pager__link--prev .pager__text { text-align: left; }
  .pager__link:hover .pager__bar { height: 22px; }
}
@media (max-width: 599px) {
  .contact-line { display: flex; flex-direction: column; gap: 4px; }
  .contact-line .dot { display: none; }
}

/* ==========================================================================
   Device frames (grey — used inside case studies). Internals scale with the
   frame via container units: --u = one design pixel.
   ========================================================================== */
.device { position: relative; container-type: inline-size; flex: none; }
.device > * { position: absolute; }
.device__frame {
  inset: 0;
  border-radius: calc(var(--r) * var(--u));
  box-shadow: inset 0 0 0 calc(2 * var(--u)) var(--stroke);
}
.device__screen {
  left: calc(7 * var(--u)); top: calc(7 * var(--u));
  width: calc(var(--sw) * var(--u)); height: calc(var(--sh) * var(--u));
  border-radius: calc(var(--sr) * var(--u));
  overflow: hidden;
  background: #fff;
  isolation: isolate;
}
.device__screen::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 0 calc(2 * var(--u)) var(--stroke);
}
.device__notch {
  left: calc(162 * var(--u)); top: calc(15 * var(--u));
  width: calc(50 * var(--u)); height: calc(10 * var(--u));
  border-radius: calc(10 * var(--u));
  background: var(--ink);
  z-index: 6;
}
.device--phone { --u: calc(100cqw / 373); --r: 40; --sw: 359; --sr: 36; aspect-ratio: 373 / var(--h); }
.device--desktop { --u: calc(100cqw / 986); --r: 24; --sw: 972; --sh: 498; --sr: 21; aspect-ratio: 986 / 512; }

/* An image layer inside a screen, positioned in design px */
.layer { position: absolute; overflow: hidden;
  left: calc(var(--x, 0) * var(--u)); top: calc(var(--y, 0) * var(--u));
  width: calc(var(--w) * var(--u)); height: calc(var(--lh) * var(--u)); }
.layer > img, .layer > .imgbox { position: absolute; }
.layer > img.cover { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.layer > img.cover.top { object-position: top; }
.imgbox { container-type: inline-size; }
.imgbox > img { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (max-width: 899px) {
  .site-header { padding-top: 24px; min-height: 64px; }
}

/* Dropdown: titles break into two lines; swatch spans both */
.work-menu__item { align-items: center; padding: 12px 16px 12px 14px; }
.work-menu .swatch { height: 40px; }

/* ==========================================================================
   Full-screen image viewer
   ========================================================================== */
img[data-zoom] { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: clamp(12px, 1.6vw, 28px);
  background: rgba(24, 24, 24, 0.92);
  cursor: zoom-out;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s ease, visibility 0s; }
.lightbox__img {
  max-width: 100%; max-height: calc(100vh - 2 * clamp(12px, 1.6vw, 28px));
  width: auto; height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transform: scale(0.97);
  transition: transform 0.35s var(--ease-out);
}
.lightbox.is-open .lightbox__img { transform: none; }
.lightbox__close {
  position: fixed; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
}
.lightbox-open, .lightbox-open body { overflow: hidden; }

/* white margin around images that need breathing room (e.g. the flow diagram) */
.lightbox__img.is-padded { padding: clamp(12px, 2vw, 36px); }

/* Viewer zoom */
.lightbox.can-zoom .lightbox__img { cursor: zoom-in; }
.lightbox.is-zoomed { display: block; overflow: auto; overscroll-behavior: contain; }
.lightbox.is-zoomed .lightbox__img { max-width: none; max-height: none; height: auto; margin: 0 auto; cursor: grab; transform: none; transition: none; }
.lightbox.is-dragging, .lightbox.is-dragging .lightbox__img { cursor: grabbing; user-select: none; }

/* Back to top — project pages only (added by main.js when the page has a hero) */
.to-top {
  position: fixed; z-index: 40;
  right: clamp(16px, 2.4vw, 40px);
  bottom: clamp(16px, 2.4vw, 40px);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 20px rgba(34, 34, 34, 0.16), 0 0 0 1px rgba(34, 34, 34, 0.06);
  display: grid; place-items: center;
  color: var(--ink);
  opacity: 0; visibility: hidden;
  transform: translateY(calc(12px - var(--lift, 0px)));
  transition: opacity 0.3s ease, transform 0.35s var(--ease-out), visibility 0s linear 0.35s, box-shadow 0.25s ease;
}
.to-top.is-shown {
  opacity: 1; visibility: visible;
  transform: translateY(calc(0px - var(--lift, 0px)));
  transition: opacity 0.3s ease, transform 0.35s var(--ease-out), visibility 0s, box-shadow 0.25s ease;
}
.to-top svg { width: 20px; height: 20px; transition: transform 0.25s var(--ease-out); }
@media (hover: hover) {
  .to-top:hover { box-shadow: 0 10px 28px rgba(34, 34, 34, 0.22), 0 0 0 1px rgba(34, 34, 34, 0.06); }
  .to-top:hover svg { transform: translateY(-2px); }
}
@media (max-width: 899px) { .to-top { width: 40px; height: 40px; } .to-top svg { width: 18px; height: 18px; } }
.menu-open .to-top, .lightbox-open .to-top { opacity: 0; visibility: hidden; }
