/* ============================================================
   astalla bici – bike archive
   Same look as the portfolio: warm paper background, pure black
   ink, hairline rules, Sora for the topbar. The frame names are
   set in Archivo Expanded Black; year, list and toggle in Inter Tight.
   ============================================================ */

:root {
  --bg: #a8a096; /* medium warm grey (trial); previous: #e6d2cf */
  --ink: #000000;
  --line: #000000;
  --line-w: 0.5px;
  --fg-muted: #6b6b66;

  --font: "Sora", sans-serif;
  --font-display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --topbar-h: 56px;
  --gutter: clamp(18px, 3vw, 32px);

  --name-max: 160px;
  --year-size: 13.5px;
  --toggle-size: 11.7px;
  --list-size: 18px;

  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --slide: 0.7s var(--ease-in-out);
}

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

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* Custom cursor everywhere (hotspot on the index fingertip), including
   links and buttons, which would otherwise switch to the system hand. */
*,
*::before,
*::after {
  cursor: url("../img/cursor.png") 3 9, auto;
  cursor: -webkit-image-set(url("../img/cursor.png") 1x, url("../img/cursor@2x.png") 2x) 3 9, auto;
  cursor: image-set(url("../img/cursor.png") 1x, url("../img/cursor@2x.png") 2x) 3 9, auto;
}

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

/* ---------------------------------------------
   Topbar — floats over the posters so each one
   can stay a full 100vh tall (the poster sits centred below it).
--------------------------------------------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--gutter);
}

.topbar__logo {
  /* The ring hangs below the bar, top left. */
  position: absolute;
  top: 10px;
  left: var(--gutter);
  width: var(--logo-size, 112px);
  height: var(--logo-size, 112px);
}

.logo-ring {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: currentColor;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  animation: logo-spin 30s linear infinite;
}

@keyframes logo-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 600px) {
  .topbar__logo {
    --logo-size: 84px;
  }
}

.topbar__info {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------
   Posters — one per screen, snapping. Each poster
   is 80% of the screen height, centred in the
   space between the menu and the bottom edge.
--------------------------------------------- */

.bike {
  --poster-h: 80vh;
  position: relative;
  height: 100vh;
  height: 100svh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: calc(var(--topbar-h) + (100vh - var(--topbar-h) - var(--poster-h)) / 2);
  /* Only clip sideways (wide posters on phones). Vertically nothing is
     clipped, so the drifting names can lie over the neighbouring posters. */
  overflow-x: clip;
  scroll-snap-align: start;
}

.bike__poster {
  display: block;
  height: var(--poster-h);
  width: auto;
  /* Always 80% of the viewport height; on screens narrower than the
     poster the sides are cropped instead of shrinking it. */
  flex: none;
}

.bike__poster,
.bike__year,
.bike__name {
  will-change: transform;
}

.bike__caption {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--gutter);
  /* Above every poster, not just this section's. */
  z-index: 5;
  pointer-events: none;
}

.bike__year {
  display: block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--year-size);
  line-height: 1.2;
  margin-bottom: 4px;
}

/* Font size is fitted in main.js so the name always fills at most the
   width on a single line, capped at --name-max. */
.bike__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125, "wght" 900;
  font-size: var(--name-max);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Holds the letters main.js animates; the outer .bike__name keeps the
   parallax transform. */
.bike__name-inner {
  display: inline-block;
}

/* One slot per letter: stretched by the wave from its own left edge,
   and clipped left and right so the glyph inside slides in as if from
   behind a curtain. */
.bike__char {
  display: inline-block;
  white-space: pre;
  transform-origin: 0 100%;
  clip-path: inset(-50% 0 -50% 0);
  will-change: transform;
}

.bike__glyph {
  display: inline-block;
  will-change: transform;
}

/* Morph variant (MORPH_FROM_SERIF in main.js): the sans and the serif
   letter sit on one baseline; the serif adds no width. */
.bike__glyph--morph {
  display: inline-grid;
  align-items: baseline;
  justify-items: start;
}

.bike__sans,
.bike__serif-wrap {
  grid-area: 1 / 1;
}

.bike__serif-wrap {
  width: 0;
}

.bike__serif {
  display: inline-block;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-stretch: normal;
  font-variation-settings: normal;
  letter-spacing: 0;
  transform-origin: 0 100%;
  opacity: 0;
}

.fx {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------------------------------------------
   "view list" — left, vertically centered. Both
   words share one grid cell and slide past each
   other in step with the list panel.
--------------------------------------------- */

.list-toggle {
  position: fixed;
  top: 50%;
  left: max(var(--gutter), 24px);
  z-index: 20;
  display: inline-grid;
  overflow: hidden;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--toggle-size);
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  text-align: left;
  transform: translate(0, -50%);
  transition: transform var(--slide), opacity 0.25s var(--ease-out);
}

.list-toggle:hover {
  opacity: 0.7;
}

.list-toggle:focus-visible {
  outline: var(--line-w) solid var(--line);
  outline-offset: 4px;
}

.list-toggle__word {
  grid-area: 1 / 1;
  transition: transform var(--slide);
}

.list-toggle__word[data-word="close"] {
  transform: translateX(100%);
}

.is-list-open .list-toggle {
  transform: translate(-20px, -50%);
}

.is-list-open .list-toggle__word[data-word="open"] {
  transform: translateX(-100%);
}

.is-list-open .list-toggle__word[data-word="close"] {
  transform: translateX(0);
}

/* ---------------------------------------------
   List — plain names right next to the toggle,
   centred on its line with names above and below,
   feathered at the top and bottom.
--------------------------------------------- */

.bike-list {
  position: fixed;
  /* Centred on the toggle's line, as far up as down (--list-half, set in
     main.js). The padding lets the first and last names reach the line. */
  top: calc(50% - var(--list-half, 200px));
  height: calc(var(--list-half, 200px) * 2);
  left: calc(max(var(--gutter), 24px) - 20px + var(--toggle-w, 90px) + 24px);
  right: var(--gutter);
  z-index: 15;
  overflow-y: auto;
  padding: calc(var(--list-half, 200px) - var(--list-size) * 0.65) 0;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.7s;
  /* Feathered at both ends. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 96px, #000 calc(100% - 96px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 96px, #000 calc(100% - 96px), transparent);
  scrollbar-width: none;
}

.bike-list::-webkit-scrollbar {
  display: none;
}

.is-list-open .bike-list {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s;
}

.bike-list__item {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s var(--ease-out), transform 0.7s var(--ease-out);
}

.is-list-open .bike-list__item {
  opacity: 1;
  transform: translateX(0);
  transition-delay: calc(var(--i, 0) * 25ms + 150ms);
}

.bike-list__item a {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--list-size);
  font-weight: 400;
  line-height: 1.3;
  transition: opacity 0.25s var(--ease-out);
}

.bike-list__item a:hover {
  opacity: 0.5;
}

.bike-list__item.is-current a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------------------------------------------
   Info — the garage text over the whole screen,
   in the serif, full width between the gutters.
--------------------------------------------- */

.info {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow-y: auto;
  padding: calc(var(--topbar-h) + 24px) var(--gutter) 48px;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease-out), visibility 0s linear 0.45s;
}

.is-info-open .info {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s var(--ease-out), visibility 0s;
}

.info__text {
  font-family: var(--font-serif);
  font-size: var(--info-size, 60px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.info__text + .info__text {
  margin-top: 0.6em;
}

.is-info-open .list-toggle {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  :root {
    --info-size: 40px;
  }
}

@media (max-width: 600px) {
  :root {
    --info-size: 28px;
    --list-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-ring {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }

  .list-toggle,
  .list-toggle__word,
  .bike-list,
  .bike-list__item,
  .info {
    transition-duration: 0s;
    transition-delay: 0s;
  }
}
