/* Pili's website in the Gallery language (DESIGN.md): photos hang on a quiet wall, wall
   labels speak, glass is only for controls, and the red dot only ever means kept.
   Tokens match Pili/Design/Gallery.swift. */

@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --wall: #F7F7F5;
  --ink: #111111;
  --label: #5F5F5A;
  --hairline: #E2E2DC;
  --alcove: #EDECE7;
  --red-dot: #D7261E;
  --sky: #6F8090;
  --land: #111111;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shade: rgba(17, 17, 17, 0.10);
  --photo-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 12px 32px rgba(0, 0, 0, 0.10);
  --photo-edge: transparent;
  --measure: 34rem;
  --page: 72rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #161615;
    --ink: #F2F2EE;
    --label: #A3A39C;
    --hairline: #2A2A28;
    --alcove: #21211F;
    --red-dot: #E5483F;
    --sky: #8797A6;
    --land: #CFCFC9;
    --glass: rgba(60, 60, 58, 0.55);
    --glass-edge: rgba(255, 255, 255, 0.10);
    --glass-shade: rgba(0, 0, 0, 0.30);
    --photo-shadow: none;
    --photo-edge: var(--hairline);
  }
}

@media (prefers-contrast: more) {
  :root { --label: #3F3F3B; --alcove: #E6E5DF; }
  @media (prefers-color-scheme: dark) {
    :root { --label: #C8C8C2; --alcove: #262624; }
  }
}

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

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

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  padding: 0.5rem 1rem; background: var(--ink); color: var(--wall); border-radius: 999px; z-index: 10;
}
.skip:focus { top: 0.75rem; }

.page { width: min(100% - 2 * var(--gutter), var(--page)); margin-inline: auto; }

/* Type, after Gallery.Typeface. */

.display {
  font-weight: 600;
  font-size: clamp(2.6rem, 6.4vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.headline {
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0;
  text-wrap: balance;
}
.title { font-weight: 600; font-size: 1.125rem; line-height: 1.3; margin: 0; }
.lede { color: var(--label); font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.5; max-width: var(--measure); margin: 0; text-wrap: pretty; }
.body { color: var(--label); max-width: var(--measure); margin: 0; text-wrap: pretty; }
.room {
  font-weight: 600; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--label); margin: 0 0 1rem;
}

/* Wall labels: number, date, one observation. */

.wall-label { font-size: 0.875rem; line-height: 1.35; }
.wall-label b { display: block; font-weight: 600; color: var(--ink); font-size: 0.9375rem; }
.wall-label span { display: block; color: var(--label); }
.wall-label i { display: block; color: var(--label); }

.kept { display: inline-flex; align-items: center; gap: 0.45em; font-weight: 600; color: var(--ink); white-space: nowrap; }
.kept[hidden] { display: none; }
.kept::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--red-dot); }

/* Hung photos: uncropped, a soft shadow in light, a hairline in dark. */

.hung { box-shadow: var(--photo-shadow); outline: 1px solid var(--photo-edge); outline-offset: -1px; background: var(--hairline); }

/* Glass, for controls only. */

.glass, .prominent {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0.7rem 1.35rem; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none;
  cursor: pointer; border: 0; -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease, background-color 160ms ease, opacity 160ms ease;
}
.glass {
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: inset 0 0 0 1px var(--glass-edge), 0 6px 18px var(--glass-shade);
}
.prominent {
  color: var(--wall); background: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 22px var(--glass-shade);
}
.glass:active, .prominent:active { transform: scale(0.97); }
.glass .kept::before { width: 0.6em; height: 0.6em; }
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--alcove); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Header and footer. */

.site-header { padding-block: 1.5rem; }
.site-header .page { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; font-weight: 500; }
.site-header nav a { text-decoration: none; color: var(--label); }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }

.wordmark { display: inline-block; line-height: 0; }
.wordmark img { display: block; }

.site-footer { padding-block: 5rem 3rem; color: var(--label); font-size: 0.875rem; }
.site-footer .page { display: grid; gap: 1.5rem; }
.site-footer .wordmark { justify-self: start; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-footer nav a:hover { text-decoration: underline; }
.site-footer p { margin: 0; max-width: 40rem; }

/* Home: the hero and its kept wall. */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero { padding-block: clamp(1.5rem, 4vw, 3.5rem) clamp(5rem, 10vw, 9rem); }
.hero .page { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(3rem, 6vw, 5rem); }
.hero-words { display: grid; gap: 1.5rem; align-items: end; }
@media (min-width: 900px) { .hero-words { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 4rem; } }
.hero-side { display: grid; gap: 1.25rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.hero-actions small { color: var(--label); font-size: 0.9375rem; }
.store-link[aria-disabled="true"] { cursor: default; }

/* The kept wall: one set hung around a common centre line. The kept photo hangs a
   little larger with "Kept" under its lower right; the rest rest at 60%, as the
   filmstrip dims photos to be deleted. */

.wall { display: grid; gap: 2rem; }
.wall-works { display: flex; align-items: flex-end; justify-content: space-between; gap: clamp(0.75rem, 2.5vw, 2rem); }
.work {
  all: unset; box-sizing: border-box; display: grid; gap: 0.7rem; cursor: pointer;
  transition: opacity 280ms ease; -webkit-tap-highlight-color: transparent;
}
.work:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; border-radius: 2px; }
.work img { width: auto; transition: height 340ms ease; }
.w1 img { height: clamp(5.75rem, 21vw, 18.75rem); }
.w2 img { height: clamp(5rem, 18vw, 16rem); }
.w3 img { height: clamp(5.4rem, 19.5vw, 17rem); }
.w4 img { height: clamp(4.75rem, 17vw, 15rem); }
.work.is-kept img { height: clamp(7rem, 26vw, 22.5rem); }
.wall.is-chosen .work:not(.is-kept) { opacity: 0.6; }
.work:hover img { box-shadow: var(--photo-shadow), 0 0 0 1px var(--hairline); }
.work-label { display: flex; justify-content: space-between; align-items: start; gap: 0.75rem; text-align: left; }
.work .kept { visibility: hidden; font-size: 0.9375rem; }
.work.is-kept .kept { visibility: visible; }
/* On a phone the set hangs two by two, every photo at full column width. */
@media (max-width: 640px) {
  .wall-works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1rem; align-items: end; }
  .work img, .work.is-kept img, .w1 img, .w2 img, .w3 img, .w4 img { width: 100%; height: auto; }
  .work .wall-label span { display: none; }
  .work .kept { font-size: 0.875rem; }
}
.wall-outcome { max-width: 34rem; }
.wall-outcome b { font-size: 1rem; }

/* The dot arrives, once, as the page opens: the set hangs, No. 1 grows a little, the
   dot appears under its lower right, then "Kept", and the others step back. Choosing
   another photo stops it. With Reduce Motion the page opens on the last frame. */

@media (prefers-reduced-motion: no-preference) {
  .wall:not(.is-touched) .work.is-kept img { transform-origin: bottom center; animation: kept-grow 1400ms ease both; }
  .wall:not(.is-touched) .work:not(.is-kept) { animation: step-back 1400ms ease both; }
  .wall:not(.is-touched) .work.is-kept .kept { animation: kept-arrive 1400ms ease both; }
  .wall:not(.is-touched) .work.is-kept .kept::before { animation: dot-arrive 1400ms ease both; }
}
@keyframes kept-grow { 0%, 35% { transform: scale(0.84); } 100% { transform: scale(1); } }
@keyframes step-back { 0%, 35% { opacity: 1; } 100% { opacity: 0.6; } }
@keyframes kept-arrive { 0%, 45% { color: transparent; } 100% { color: var(--ink); } }
@keyframes dot-arrive { 0%, 40% { transform: scale(0); } 60% { transform: scale(1.25); } 75%, 100% { transform: scale(1); } }

/* Rooms: each part of Pili, separated by space. */

.rooms { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(6rem, 12vw, 10rem); }
.room-intro { display: grid; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.split { display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split.flip > :first-child { order: 2; }
}

/* A session: a gallery wall drifting slowly past. */

.drift { overflow: hidden; padding-block: 1.5rem 2rem; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.drift-row { display: flex; align-items: center; gap: 1.5rem; width: max-content; animation: drift 90s linear infinite; }
.drift-row img { height: 9rem; width: auto; }
/* Varied heights, like frames hung around a common centre line (DriftingWall). */
.drift-row img:nth-child(8n + 1) { height: 8rem; }
.drift-row img:nth-child(8n + 2) { height: 10.5rem; }
.drift-row img:nth-child(8n + 3) { height: 8.5rem; }
.drift-row img:nth-child(8n + 4) { height: 9.5rem; }
.drift-row img:nth-child(8n + 5) { height: 11rem; }
.drift-row img:nth-child(8n + 6) { height: 7.5rem; }
.drift-row img:nth-child(8n + 7) { height: 10rem; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .drift-row { animation: none; }
  .drift { overflow-x: auto; }
}

/* Suggestions: works and their labels. */

.notes { display: grid; gap: clamp(2rem, 4vw, 3rem); }
@media (min-width: 700px) { .notes { grid-template-columns: repeat(3, 1fr); align-items: end; } }
.note { display: grid; gap: 0.9rem; margin: 0; }
/* The notes without a photo here read as one line under the row. */
.notes-more { grid-column: 1 / -1; margin-top: clamp(0.5rem, 2vw, 1.5rem); }
@media (min-width: 700px) {
  .notes-more i { display: inline; }
  .notes-more i + i::before { content: "·"; margin-inline: 0.6em; font-style: normal; }
}

/* Ready to delete: each photo beside the one kept. */

.pairs { display: grid; gap: 1.75rem; }
.pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.pair figure { margin: 0; display: grid; gap: 0.5rem; }
/* As in the app, "Kept" hangs under the lower right of the photo it marks. */
.pair figure .kept { justify-self: end; }
.pair .wall-label { grid-column: 1 / -1; }
.confirm { display: grid; gap: 0.75rem; margin-top: 1rem; }
.confirm .prominent { width: 100%; }
.confirm p { margin: 0; color: var(--label); font-size: 0.875rem; text-align: center; }

/* More to review, and the alcove for On This Day. */

.alcove { background: var(--alcove); padding-block: clamp(4rem, 8vw, 6rem); }
.more { display: grid; gap: clamp(2.5rem, 5vw, 3.5rem); }
@media (min-width: 800px) { .more { grid-template-columns: repeat(2, 1fr); } }
.more figure { margin: 0; display: grid; gap: 1rem; }
.more .works { display: flex; align-items: end; gap: 0.9rem; min-height: 9rem; }
.more .works img { height: clamp(4.5rem, 14vw, 8rem); width: auto; }
.more .works img.tall { height: clamp(5.25rem, 16.5vw, 9.5rem); }
.more .works .rest { opacity: 0.6; }
/* "Kept" hangs under the kept photo's lower right without lifting it off the line. */
.more .kept-work { position: relative; }
.more .kept-work .kept { position: absolute; right: 0; top: calc(100% + 0.5rem); font-size: 0.875rem; }
.more figure:has(.kept-work) figcaption { margin-top: 1.75rem; }

/* The closing room: everything kept on the page, the visitor's pick first. */

.picks-room .room-intro { max-width: 46rem; }
.picks { display: flex; flex-wrap: wrap; align-items: flex-end; gap: clamp(1.25rem, 3vw, 2.5rem); margin-bottom: clamp(3rem, 6vw, 4.5rem); }
.picks-label { flex-basis: 100%; grid-column: 1 / -1; }
.pick { margin: 0; display: grid; gap: 0.7rem; }
.pick img { height: clamp(6rem, 13vw, 11rem); width: auto; }
.pick:first-child img { height: clamp(8rem, 17vw, 15rem); }
.pick .kept { font-size: 0.9375rem; }
@media (max-width: 640px) {
  .picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .pick img, .pick:first-child img { height: auto; width: 100%; }
  /* Too narrow for the caption and "Kept" side by side: "Kept" stays directly under
     the photo's lower right, and the caption follows. */
  .pick .work-label { flex-wrap: wrap; row-gap: 0.35rem; }
  .pick .kept { order: -1; flex-basis: 100%; justify-content: flex-end; }
}
.price { gap: 1.25rem; }

/* Promises: privacy and pricing. */

.promise { display: grid; gap: 1.25rem; }
.promise > * { max-width: 46rem; }
.terms-label { margin-top: 0.5rem; }

/* Legal and support pages. */

.doc { padding-block: 2rem 2rem; }
.doc .page { max-width: 44rem; }
.doc h1 { margin-bottom: 0.75rem; }
.doc .updated { color: var(--label); font-size: 0.875rem; margin: 0 0 3rem; }
.doc h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 3rem 0 0.75rem; }
.doc h3 { font-size: 1.0625rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.doc p, .doc li { color: var(--label); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc ul { padding-left: 1.25rem; }
.doc li + li { margin-top: 0.4rem; }
.doc .summary { font-size: 1.15rem; color: var(--ink); max-width: 38rem; }
.doc .contact { margin-top: 1rem; }
.faq { display: grid; gap: 2.25rem; margin-top: 3rem; }
.faq section h2 { margin: 0 0 0.5rem; }
.faq section p { margin: 0.5rem 0 0; }

.not-found { padding-block: 4rem 2rem; display: grid; gap: 1.5rem; }
