/* The page friends see: Closetboard's look (black & white, Instrument Serif
   headings, soft grey tiles behind each piece), on its own. */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-italic.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f3f2;
  --surface-3: #e9e9e7;
  --ink: #0b0b0b;
  --ink-2: #565656;
  --ink-3: #9a9a9a;
  --line: #ebebea;
  --accent: #0b0b0b;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --card-bg: #f4f4f3;
  --garment-shadow: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.09)) drop-shadow(0 12px 16px rgba(0, 0, 0, 0.07));
  --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --display: 'Instrument Serif', 'Times New Roman', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --surface: #121212;
    --surface-2: #1b1b1b;
    --surface-3: #262626;
    --ink: #f4f4f4;
    --ink-2: #b4b4b4;
    --ink-3: #727272;
    --line: #232323;
    --accent: #f4f4f4;
    --accent-ink: #0b0b0b;
    --danger: #f97066;
    --card-bg: #161616;
    --garment-shadow: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)) drop-shadow(0 12px 16px rgba(0, 0, 0, 0.3));
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: clamp(38px, 9vw, 56px);
  line-height: 1.02;
}

h1 em,
.wordmark {
  font-style: italic;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.wordmark {
  font-size: 24px;
}

.countdown {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px calc(120px + env(safe-area-inset-bottom));
}

.intro {
  display: grid;
  gap: 12px;
  padding: 18px 0 26px;
}

.lede {
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
  max-width: 34em;
}

.note {
  margin: 4px 0 0;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--surface-2);
  font-size: 15px;
  max-width: 34em;
}

.note b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 4px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  max-width: 420px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.input,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  /* 16px or more, or iPhones zoom the page in when you tap the field. */
  font-size: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s ease;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  border-color: var(--ink);
}

.input.missing {
  border-color: var(--danger);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
  margin-bottom: 26px;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 18px;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.piece {
  display: grid;
  gap: 8px;
  align-content: start;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.pic {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: none;
  padding: 10%;
  border-radius: 20px;
  background: var(--card-bg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--garment-shadow);
}

.pic:active {
  transform: scale(0.975);
}

.piece.chosen .pic {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.tick {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 15px;
  transform: scale(0);
  transition: transform 0.22s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.piece.chosen .tick {
  transform: scale(1);
}

.piece .meta {
  display: grid;
  gap: 1px;
  padding: 0 4px;
}

.piece .meta b {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
}

.piece .meta span {
  font-size: 12.5px;
  color: var(--ink-2);
}

.segmented {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  flex: 1 1 auto;
  min-height: 34px;
  min-width: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 0 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}

.segmented button:active {
  transform: scale(0.95);
}

.segmented button.on {
  background: var(--accent);
  color: var(--accent-ink);
}

.segmented button.on.no {
  background: var(--surface-3);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}

.bar-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-inner .summary {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink-2);
}

.bar-inner .summary b {
  color: var(--ink);
}

.error {
  color: var(--danger);
  font-size: 13.5px;
  margin: 0 0 12px;
}

.empty {
  text-align: center;
  padding: 72px 16px;
  color: var(--ink-2);
  display: grid;
  gap: 12px;
  justify-items: center;
}

.empty h1 {
  color: var(--ink);
  font-size: 40px;
}

.empty p {
  margin: 0;
  max-width: 26em;
}

.done-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  text-align: left;
}

.done-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-2);
}

.done-list img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--card-bg);
  padding: 4px;
}

.done-list .what {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--ink);
}

.done-list .chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}

.loading {
  display: grid;
  place-items: center;
  min-height: 50vh;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}

.btn .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--accent-ink) 30%, transparent);
  border-top-color: var(--accent-ink);
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.fade-in {
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- first come, first served ---------- */

.left {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--ink-2);
}

.piece .meta .held {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.piece.reserved .pic {
  cursor: default;
  opacity: 0.38;
  filter: grayscale(0.6);
}

.piece.reserved .pic:active {
  transform: none;
}

.piece.reserved .meta b {
  color: var(--ink-2);
}

.piece.reserved .meta .held {
  display: inline-flex;
  align-self: start;
  justify-self: start;
  margin-top: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
}

.note.taken {
  color: var(--ink);
  text-align: center;
}

/* ---------- photos: fade in when they arrive, framed or cut out ---------- */

.pic {
  --shimmer: rgba(255, 255, 255, 0.55);
  background-image: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.pic:has(img.loaded),
.pic.failed {
  background-image: none;
  animation: none;
}

.pic img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pic img.loaded {
  opacity: 1;
}

.pic-failed {
  position: absolute;
  inset: auto 0 12px;
  font-size: 12px;
  color: var(--ink-2);
  display: none;
}

.pic.failed .pic-failed {
  display: block;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}

@media (prefers-color-scheme: dark) {
  .pic {
    --shimmer: rgba(255, 255, 255, 0.06);
  }
}

/* Framed photos already have the tile and the shadow in them. */
.framed .pic {
  --shimmer: rgba(255, 255, 255, 0.55);
  padding: 0;
  background-color: #f4f4f3;
}

.framed .pic img {
  object-fit: cover;
  filter: none;
}

.framed .done-list img {
  padding: 0;
  object-fit: cover;
  background: #f4f4f3;
}

.done-list img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.done-list img.loaded {
  opacity: 1;
}

.lend-for {
  justify-self: start;
  margin: 2px 0 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 600;
}

.empty .lend-for {
  justify-self: center;
}

/* ---------- home page and privacy policy ---------- */

.doc {
  max-width: 680px;
  padding-top: 18px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.doc h1 {
  margin-bottom: 14px;
}

.doc h2 {
  margin: 30px 0 8px;
  font-size: 26px;
}

.doc p,
.doc li {
  font-size: 15.5px;
  line-height: 1.6;
}

.doc p {
  margin: 0 0 12px;
}

.doc ul {
  margin: 0 0 12px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.doc a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc code {
  font-size: 13.5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
}

.doc .muted {
  color: var(--ink-2);
}

.doc .lede {
  font-size: 17px;
}

.doc-links {
  margin-top: 32px !important;
  font-weight: 600;
}

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