/* Inter Tight — SIL Open Font License 1.1, see /fonts/OFL.txt */
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #ffffff;
  --ink: #1a1a18;
  --muted: #6f6c64;
  --pad: 20px;
  --card: clamp(140px, 14vw, 240px); /* size of each square image */
  --gap: clamp(14px, 1.6vw, 26px);
  --fade: 14vw; /* width of the white fade on each side */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
/* stop phone browsers from enlarging text on some pages and not others */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: "Inter Tight", "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover, a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- header (on every page) ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--pad);
  z-index: 10;
  /* no background: the header floats over the page, images scroll underneath */
  background: transparent;
  /* the empty parts of the header don't block clicks on what's underneath */
  pointer-events: none;
}
.site-header a { pointer-events: auto; }
.site-header .name { font-weight: 500; }
.site-header nav { display: flex; gap: 28px; }
/* NW monogram, small in the top middle */
.site-header .logo {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  line-height: 0;
}
.site-header .logo img { display: block; height: 44px; width: auto; }
.site-header .logo:hover { text-decoration: none; opacity: 0.7; }
/* three-line menu button: phones only (added by js/menu.js) */
.menu-toggle { display: none; }

/* phones: logo top left, three-line menu top right, name hidden.
   Projects / About / Contact drop down when the button is pressed. */
@media (max-width: 640px) {
  .site-header {
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .site-header .name { display: none; }
  .site-header .logo { position: static; transform: none; }
  .site-header .logo img { height: 34px; }
  .menu-toggle {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    margin-right: -6px;
    padding: 0 6px;
    background: none;
    border: 0;
    color: var(--ink);
    cursor: pointer;
  }
  .menu-toggle span {
    display: block;
    height: 1px;
    background: currentColor;
    transition: transform 0.3s ease, opacity 0.2s ease;
  }
  .site-header.menu-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .site-header.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .site-header.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .site-header nav {
    pointer-events: auto;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 14px !important;
    padding: 8px var(--pad) 22px;
    background: var(--cream);
    border-bottom: 1px solid #e4e2dc;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .site-header.menu-open nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  .site-header.menu-open { background: var(--cream); }
}

/* ---------- projects carousel ---------- */
.projects {
  /* pinned to the visible screen, so the pictures sit in the middle in every
     phone browser (Chrome/Google app on iPhone miscounted 100svh) */
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
}

.track {
  display: flex;
  align-items: center;
  gap: var(--gap);
  width: 100%;
  /* room for the title/roles above and the hover growth */
  padding: 180px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.track::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  flex: 0 0 var(--card);
  width: var(--card);
  transition: flex-basis 0.6s cubic-bezier(.2,.7,.2,1), width 0.6s cubic-bezier(.2,.7,.2,1);
}

.card .meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  font-size: 10px;
  letter-spacing: 0.03em;
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.card .title { display: block; }
.card .roles {
  display: flex;
  flex-direction: column;
  color: var(--muted);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.4s ease;
}

.card .frame {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* the whole picture is a link to the project page (when it has one) */
.card .card-link { position: absolute; inset: 0; z-index: 1; }

/* hover: picture grows slightly, roles appear under the name */
@media (hover: hover) {
  .card:hover { z-index: 2; }
  /* the hovered picture becomes bigger and gently pushes its neighbours aside */
  .card:hover { flex-basis: calc(var(--card) * 1.3); width: calc(var(--card) * 1.3); }
  .card:hover .roles { max-height: 10em; opacity: 1; }
}
/* touch screens: no hover, so always show the roles */
@media (hover: none) {
  .card .roles { max-height: 10em; opacity: 1; }
}

/* white fade on both sides, with the plus buttons sitting in it */
.fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--fade);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.fade.left  { left: 0;  background: linear-gradient(to right, var(--cream) 35%, rgba(255,255,255,0)); }
.fade.right { right: 0; background: linear-gradient(to left,  var(--cream) 35%, rgba(255,255,255,0)); }
.fade.left  { justify-content: flex-start; padding-left: var(--pad); }
.fade.right { justify-content: flex-end;   padding-right: var(--pad); }

.plus {
  pointer-events: auto;
  background: none;
  border: 0;
  color: var(--ink);
  width: 30px;   /* click area */
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.plus svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1; fill: none; }
.fade.right .plus { justify-content: flex-end; }
.plus svg { transition: transform 0.3s ease; }
.plus:hover svg { transform: rotate(90deg); }
.plus:focus-visible, a:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- about / contact ---------- */
.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 120px var(--pad) 80px;
}
.page .text {
  max-width: 440px;
  display: grid;
  gap: 1.4em;
}
.page .label { color: var(--muted); }
.page dl { display: grid; grid-template-columns: 9em 1fr; gap: 0.6em 1em; }
.page dt { color: var(--muted); }

@media (max-width: 640px) {
  :root { --card: 62vw; --fade: 14vw; --pad: 16px; }
  .site-header nav { gap: 16px; }
}

/* ---------- footer on project pages (added by js/footer.js) ---------- */
.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1em var(--pad);
  align-items: baseline;
  padding: 60px var(--pad) var(--pad);
}
.site-footer .to-prev { justify-self: start; }
.site-footer .to-projects { justify-self: center; }
.site-footer .to-next { justify-self: end; text-align: right; }
.site-footer [hidden] { display: none; }
@media (max-width: 640px) {
  .site-footer { grid-template-columns: 1fr 1fr; }
  .site-footer .to-projects { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- project title + description (the same on every project page) ----------
   Title, roles and description all use the site's body text: 11px Inter Tight,
   uppercase, like the header. Don't override these sizes inside a project page. */
main h1 {
  font: inherit;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
main .text {
  display: grid;
  gap: 1.4em;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
main .text dl { display: grid; grid-template-columns: 9em 1fr; gap: 0.6em 1em; }
main .text dt { color: var(--muted); }
