/* ============================================================
   Dap Collections — site.css
   One stylesheet for the whole site. No framework, no build.

   Contents
     1. Fonts
     2. Tokens (palette, type scale, space)
     3. Reset + base
     4. Layout shell
     5. The index rail  ← signature element
     6. Masthead
     7. Home: index entries
     8. Project pages
     9. Footer
    10. Motion + reduced motion
   ============================================================ */


/* 1. Fonts —————————————————————————————————————————————————
   Self-hosted, latin subset, variable. Preloaded in each page's
   <head> so they land before first paint.                     */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url('../fonts/bricolage-grotesque-var-latin.woff2') format('woff2-variations');
}

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/public-sans-var-latin.woff2') format('woff2-variations');
}


/* 2. Tokens ————————————————————————————————————————————— */

:root {
  color-scheme: light;

  /* Palette — warm pine on bone, one loud colour, one cool note */
  --ink:         #1b2a26;
  --ink-soft:    #4e5f58;
  --bone:        #f2efe7;
  --bone-2:      #e7e2d6;
  --marigold:    #f0a63c;
  /* Deeper amber for small text. Marigold at body size is ~2:1 on bone,
     which fails AA; this is the same hue at 5.2:1. */
  --amber-ink:   #8a5a10;
  --ultramarine: #2e45c7;

  --rule: var(--bone-2);

  /* Type */
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: 'Public Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --step--1: 0.875rem;
  --step-0:  1.0625rem;
  --step-1:  clamp(1.25rem, 1.10rem + 0.7vw, 1.5rem);
  --step-2:  clamp(1.60rem, 1.30rem + 1.4vw, 2.25rem);
  --step-3:  clamp(2.20rem, 1.60rem + 3.0vw, 3.5rem);
  --step-4:  clamp(3.00rem, 1.80rem + 6.0vw, 6.5rem);

  /* Space */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2.5rem;
  --s5: 4rem;
  --s6: 6rem;

  --measure: 65ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --rail-w: 6rem;
}


/* 3. Reset + base ——————————————————————————————————————— */

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

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

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

ul, ol { margin: 0; padding: 0; list-style: none; }

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--ultramarine); text-underline-offset: 0.18em; }

::selection { background: var(--marigold); color: var(--ink); }

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

/* Small narrow uppercase label — the second voice of the display face */
.label {
  font-family: var(--display);
  font-stretch: 75%;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: var(--s2) var(--s3);
  background: var(--marigold);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { left: 0; }


/* 4. Layout shell ——————————————————————————————————————— */

.shell { display: grid; }

.column {
  min-width: 0;
  max-width: 78rem;
  padding: 0 var(--gutter) var(--s5);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

.measure { max-width: var(--measure); }


/* 5. The index rail ————————————————————————————————————
   Mobile: a horizontal numeral strip under the top edge.
   Desktop (≥900px): a sticky vertical rail down the left.     */

.rail {
  border-bottom: 1px solid var(--rule);
  padding: var(--s2) var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail__list {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: max-content;
}

.rail__home {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink);
  padding: var(--s1) 0;
  margin-right: var(--s1);
}
.rail__home:hover { color: var(--ultramarine); }

.rail__link {
  display: flex;
  align-items: center;
  gap: var(--s1);
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.35rem 0.35rem 0.35rem 0;
}

.rail__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 2px;
  color: var(--ink);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rail__name {
  font-family: var(--display);
  font-stretch: 75%;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rail__link:hover .rail__num { background: var(--bone-2); }

/* Current entry — the one filled numeral on the page */
.rail__link[aria-current='page'] { color: var(--ink); }
.rail__link[aria-current='page'] .rail__num {
  background: var(--marigold);
  border-color: var(--marigold);
}

/* The ghost slot: the collection is built to grow */
.rail__item--ghost { color: var(--ink-soft); opacity: 0.5; }
.rail__item--ghost .rail__link { cursor: default; }
.rail__item--ghost .rail__num {
  border-style: dashed;
  border-color: var(--ink-soft);
  color: var(--ink-soft);
}

@media (min-width: 900px) {
  .shell {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }

  .rail {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: var(--s4) 0 var(--s4) var(--s3);
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    overflow: visible;
  }

  .rail__list {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s3);
    min-width: 0;
  }

  .rail__home { margin: 0 0 var(--s3); }

  .rail__link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0;
  }

  .rail__num {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.05rem;
  }

  .rail__name { font-size: 0.65rem; }

  .column { padding-left: var(--s5); }
}


/* 6. Masthead ——————————————————————————————————————————— */

.masthead {
  padding: var(--s5) 0 var(--s4);
  border-bottom: 1px solid var(--rule);
}

.masthead__title {
  font-size: var(--step-4);
  font-stretch: 100%;
  margin-bottom: var(--s3);
}
.masthead__title span { display: block; }

.masthead__tagline {
  font-size: var(--step-1);
  max-width: 34ch;
  color: var(--ink-soft);
}


/* 7. Home: index entries ————————————————————————————————— */

.index__label { margin-top: var(--s4); }

.index { margin-top: var(--s2); }

.entry { border-bottom: 1px solid var(--rule); }

.entry__link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--s2) var(--s3);
  padding: var(--s4) var(--s2);
  margin: 0 calc(var(--s2) * -1);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s ease;
}
.entry__link:hover { background: var(--bone-2); }

.entry__num {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-2);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink-soft);
}
.entry__link:hover .entry__num,
.entry__link:focus-visible .entry__num { color: var(--marigold); }

.entry__name {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: var(--s2);
}

.entry__desc {
  display: block;
  max-width: 52ch;
  color: var(--ink-soft);
}

.entry__go {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1;
  color: var(--ink-soft);
  transition: transform 0.2s ease, color 0.2s ease;
}
.entry__link:hover .entry__go,
.entry__link:focus-visible .entry__go {
  transform: translateX(4px);
  color: var(--ink);
}

/* Ghost entry — same shape as a real one, drawn as an empty slot */
.entry--ghost {
  border-bottom-style: dashed;
  border-top: 0;
  opacity: 0.55;
}
.entry--ghost .entry__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s2);
}
.entry--ghost .entry__num { color: var(--ink-soft); }
.entry--ghost .entry__note { color: var(--ink-soft); font-size: var(--step--1); }

@media (max-width: 559px) {
  .entry__link {
    grid-template-columns: auto minmax(0, 1fr);
    padding-block: var(--s3);
  }
  .entry__go { grid-column: 2; justify-self: start; }
}


/* 8. Project pages ——————————————————————————————————————— */

.page-head { padding: var(--s5) 0 var(--s4); }

.eyebrow { display: block; margin-bottom: var(--s3); }
.eyebrow .eyebrow__num { color: var(--amber-ink); }

.page-head h1 {
  font-size: var(--step-3);
  margin-bottom: var(--s3);
}

.lead {
  font-size: var(--step-1);
  max-width: 46ch;
  color: var(--ink-soft);
}

.section { padding: var(--s5) 0 0; }

.section__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--step-2);
  margin-bottom: var(--s4);
}
.section__head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* Numbered feature list — the catalog numeral motif again */
.features {
  display: grid;
  gap: var(--s4);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
}

.feature__num {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--amber-ink);
  margin-bottom: var(--s1);
}

.feature h3 {
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: var(--s1);
}

.feature p { color: var(--ink-soft); max-width: 46ch; }

/* Screenshot placeholders. Replace the <span> inside each frame
   with an <img> when the real screenshots arrive.              */
/* Phone frames stay phone-sized — an auto-fit 1fr track blows them up to
   full-column width, which is 800px of empty placeholder on a wide screen. */
.shots {
  display: grid;
  gap: var(--s3);
  justify-content: start;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 230px));
}
.shots--wide {
  grid-template-columns: minmax(0, 1fr);
  max-width: 900px;
}

.shot {
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(78, 95, 88, 0.4);
  border-radius: 4px;
  background: rgba(231, 226, 214, 0.35);
  color: var(--ink-soft);
  text-align: center;
  padding: var(--s2);
}
/* Empty frames hold their shape; 31/60 matches the 1240x2400 phone
   screenshots so a placeholder and a real one occupy the same space. */
.shot--phone { aspect-ratio: 31 / 60; }
.shot--wide { aspect-ratio: 16 / 10; }

/* A frame with a real screenshot in it: solid hairline, no padding,
   the image's own ratio drives the height. */
.shot--filled {
  aspect-ratio: auto;
  padding: 0;
  background: none;
  border: 1px solid var(--bone-2);
  border-style: solid;
  overflow: hidden;
}
.shot--filled img { width: 100%; height: auto; border-radius: 3px; }

.cta-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 3rem;
  padding: 0.85rem var(--s3);
  background: var(--marigold);
  color: var(--ink);
  border: 1.5px solid var(--marigold);
  border-radius: 3px;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.cta:hover { background: transparent; }
.cta__go { transition: transform 0.2s ease; }
.cta:hover .cta__go { transform: translateX(3px); }

.cta-note { color: var(--ink-soft); font-size: var(--step--1); max-width: 34ch; }

.back {
  display: inline-block;
  margin-top: var(--s5);
  font-family: var(--display);
  font-stretch: 75%;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}
.back:hover { color: var(--ultramarine); }


/* 9. Footer ————————————————————————————————————————————— */

.site-footer {
  margin-top: var(--s6);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2);
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--ultramarine); }


/* 10. Motion ————————————————————————————————————————————
   One idea: a staggered reveal as sections enter the viewport.
   Hidden only when JS is running, so no-JS never blanks out.  */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.6s ease,
    transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}
