/* THE ROOM — component styles. Transcribed from the design in prompts/00-scaffold.md; tokens only. */

/* ── Base ───────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  /* Anything scrolled into view (focus, the skip link) lands below the sticky header, ring included. */
  scroll-padding-top: calc(var(--header-h) + var(--focus-width) + var(--focus-offset));
  /* Where scrollbars take space, keep the vertical one there from the start: the feed counts columns before
     its first rows make the page scroll, and the width must not change under it. (Overlay scrollbars, as on
     iPhone and most Macs, are unaffected.) */
  overflow-y: scroll;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  letter-spacing: var(--ls-body);
  font-weight: var(--fw-regular);
  text-transform: uppercase;
}

h1,
h2,
p,
ul {
  margin: 0;
}

h1,
h2 {
  font: inherit;
}

ul {
  padding: 0;
  list-style: none;
}

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

a:hover,
button:hover {
  opacity: var(--hover-opacity);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

/* Site-wide input size: 16px at phone width, so iPhone Safari never zooms on focus. */
input,
select,
textarea {
  font-size: var(--fs-input);
}

/* Checkboxes and radios in ink, not the browser's blue (owner, 2026-11-28). */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-ink);
}

/* Site-wide placeholder color (owner, 2026-11-28). Firefox dims placeholders by default: undo it. */
::placeholder {
  color: var(--color-ink-muted);
  opacity: 1;
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-ink);
  outline-offset: var(--focus-offset);
}

#view:focus {
  outline: none;
}

/* Rings that would be cut off: header items and the skip link touch the viewport edge (the phone header's
   first row starts at y=0), so their ring sits inside; a focused tile rises above the next row. */
.skip-link:focus-visible,
.header-link:focus-visible,
.wordmark:focus-visible {
  outline-offset: calc(-1 * var(--focus-width));
}

.grid-item:focus-within {
  position: relative;
  z-index: 1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: calc(var(--z-header) + 1);
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--header-pad-x);
  background: var(--color-paper);
  transform: translateY(-100%);
}

.skip-link:focus {
  transform: none;
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-paper);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--header-gap);
  row-gap: 0;
  padding: 0 var(--header-pad-x);
  min-height: var(--header-min-h);
}

.header-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--nav-gap);
  row-gap: 0;
  flex: 1 1 var(--header-group-basis);
}

.header-group--right {
  justify-content: flex-end;
}

/* --tap-reach pads short links out to 44px at phone width and the matching negative margin takes the
   space back, so the layout never moves. The active link's 1px line is drawn as a background sized to
   the text, in the bottom border's row, so it doesn't grow with the reach. */
.header-link {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  border-bottom: var(--rule) solid transparent;
  padding-inline: var(--tap-reach);
  margin-inline: calc(-1 * var(--tap-reach));
}

.header-group--left .header-link[aria-current="page"] {
  background: linear-gradient(var(--color-ink), var(--color-ink)) center bottom / calc(100% - 2 * var(--tap-reach)) var(--rule) no-repeat border-box;
}

.wordmark {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  margin-inline: auto;
  font-size: var(--fs-wordmark);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wordmark);
}

.wordmark-text {
  margin-right: calc(-1 * var(--ls-wordmark));
}

/* ── Home ───────────────────────────────────────────────── */

.home {
  padding: var(--home-pad);
}

.banner {
  background: var(--color-banner);
  color: var(--color-banner-ink);
  min-height: var(--banner-min-h);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--banner-pad);
}

.banner-title {
  font-size: var(--fs-banner);
  line-height: var(--lh-banner);
  letter-spacing: var(--ls-display);
  font-weight: var(--fw-regular);
  max-width: var(--banner-max-w);
  text-transform: none;
}

.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--doors-min)), 1fr));
  column-gap: var(--col-gap);
  row-gap: 0;
  padding: var(--doors-pad);
}

.door {
  display: block;
  padding: var(--door-pad);
  text-align: center;
  font-size: var(--fs-door);
  font-weight: var(--fw-light);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-door);
}

.editorial {
  display: flex;
  flex-wrap: wrap;
  gap: var(--editorial-gap);
  align-items: flex-start;
  padding-bottom: var(--editorial-pad-bottom);
}

.editorial-copy {
  flex: 1 1 var(--editorial-copy-basis);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--editorial-copy-gap);
}

.editorial-title {
  font-size: var(--fs-editorial);
  font-weight: var(--fw-light);
  letter-spacing: var(--ls-editorial);
  line-height: var(--lh-editorial);
}

.editorial-serif {
  font-family: var(--font-serif);
  font-size: var(--fs-serif);
  font-weight: var(--fw-regular);
  line-height: var(--lh-serif);
  letter-spacing: var(--ls-serif);
  text-transform: none;
  color: var(--color-ink-serif);
}

.button-outline {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: var(--tap);
  padding: 0 var(--button-pad-x);
  border: var(--rule) solid var(--color-ink);
  border-radius: var(--radius-button);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--section-head-gap);
  padding: var(--section-head-pad);
  border-top: var(--rule) solid var(--color-ink);
}

.section-title {
  font-weight: var(--fw-medium);
}

.section-link {
  text-decoration: underline;
  text-decoration-thickness: var(--rule);
  text-underline-offset: var(--underline-offset);
}

/* ── Stage ──────────────────────────────────────────────── */

.stage {
  flex: 1 1 var(--stage-basis);
  min-width: 0;
  min-height: var(--stage-min-h);
  position: relative;
  background: var(--stage-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.stage.is-dragging {
  cursor: grabbing;
}

.stage-scene {
  perspective: var(--stage-perspective);
  width: var(--stage-box-w);
  height: var(--stage-box-h);
  position: relative;
}

.stage-object {
  width: var(--stage-box-w);
  height: var(--stage-box-h);
  position: relative;
  transform-style: preserve-3d;
}

.stage-face {
  position: absolute;
  inset: 0;
}

.stage-face--front {
  background: var(--face-front);
  transform: translateZ(var(--stage-depth));
}

.stage-face--back {
  background: var(--face-back);
  transform: rotateY(180deg) translateZ(var(--stage-depth));
}

.stage-face--right {
  background: var(--face-right);
  transform: rotateY(90deg) translateZ(var(--stage-depth));
}

.stage-face--left {
  background: var(--face-left);
  transform: rotateY(-90deg) translateZ(var(--stage-depth));
}

.stage-hint {
  position: absolute;
  top: var(--stage-inset);
  left: var(--stage-inset);
}

.stage-caption {
  position: absolute;
  left: var(--stage-inset);
  bottom: var(--stage-inset);
  display: flex;
  flex-direction: column;
  gap: var(--stage-caption-gap);
}

.stage-artist {
  font-weight: var(--fw-medium);
}

.stage-piece {
  color: var(--color-ink-soft);
}

/* ── Grid and tiles ─────────────────────────────────────── */

.grid {
  display: grid;
  column-gap: var(--col-gap);
  row-gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.grid--home {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile-min-home)), 1fr));
}

.grid--shop {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile-min-shop)), 1fr));
}

.grid-item {
  min-width: 0;
  animation: tile-rise var(--rise-duration) var(--rise-ease) both;
}

.grid-item--instant {
  animation: none;
}

@keyframes tile-rise {
  from {
    opacity: 0;
    transform: translateY(var(--rise-distance));
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--tile-ratio);
}

.tile-object {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--color-standin);
  box-shadow: var(--shadow-standin);
  font-size: var(--fs-standin);
  letter-spacing: var(--ls-standin);
  color: var(--color-ink-faint);
}

.tile-object--clothing {
  width: var(--obj-clothing-w);
  height: var(--obj-clothing-h);
  border-radius: var(--obj-clothing-r);
}

.tile-object--art {
  width: var(--obj-art-w);
  height: var(--obj-art-h);
  border-radius: var(--obj-art-r);
}

.tile-object--objects {
  width: var(--obj-objects-w);
  height: var(--obj-objects-h);
  border-radius: var(--obj-objects-r);
}

.tile-object--jewelry {
  width: var(--obj-jewelry-w);
  height: var(--obj-jewelry-h);
  border-radius: var(--obj-jewelry-r);
}

.tile-badge {
  position: absolute;
  top: var(--badge-inset);
  font-size: var(--fs-badge);
}

.tile-badge--3d {
  left: var(--badge-inset);
}

.tile-badge--new {
  right: var(--badge-inset);
}

.tile-meta {
  display: flex;
  flex-direction: column;
  gap: var(--tile-meta-gap);
  padding: var(--tile-meta-pad);
}

.tile-title {
  color: var(--color-ink-soft);
  text-transform: none;
}

.feed-sentinel {
  height: var(--rule);
}

.feed-status {
  color: var(--color-ink-muted);
  text-align: center;
  padding: var(--status-pad);
}

/* ── Shop ───────────────────────────────────────────────── */

.shop {
  display: flex;
  flex-wrap: wrap;
  gap: var(--shop-gap);
  padding: var(--shop-pad);
  align-items: flex-start;
}

.shop-filters {
  flex: 0 0 var(--side-left-w);
  order: 1;
  display: flex;
  flex-direction: column;
  gap: var(--side-stack-gap);
  padding-top: var(--side-pad-top);
}

.shop-results {
  flex: 1 1 0;
  min-width: 0;
  order: 2;
}

.shop-sort {
  flex: 0 0 var(--side-right-w);
  order: 3;
  display: flex;
  flex-direction: column;
  gap: var(--side-stack-gap);
  padding-top: var(--side-pad-top);
  position: sticky;
  top: var(--side-sticky-top);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: var(--check-gap);
  min-height: var(--check-min-h);
  cursor: pointer;
}

.filter-check input {
  margin: 0;
  width: var(--check-size);
  height: var(--check-size);
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: var(--side-list-gap);
}

.side-title {
  font-weight: var(--fw-medium);
  margin-bottom: var(--side-title-gap);
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: var(--side-list-gap);
}

.side-link {
  display: flex;
  align-items: center;
  min-height: var(--side-link-min-h);
  padding-inline: var(--tap-reach);
  margin-inline: calc(-1 * var(--tap-reach));
}

.shop-sort .side-link {
  min-height: var(--sort-link-min-h);
}

.side-link[aria-current] {
  text-decoration: underline;
  text-decoration-thickness: var(--rule);
  text-underline-offset: var(--underline-offset);
}

.side-link--maker {
  text-transform: none;
}

.side-search {
  display: block;
  width: 100%;
  margin-top: var(--field-gap);
  min-height: var(--field-min-h);
  padding: 0 var(--field-pad-x);
  border: 0;
  border-radius: 0;
  background: var(--color-field);
  text-transform: none;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Stub ───────────────────────────────────────────────── */

.stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--stub-gap);
  padding: var(--stub-pad);
  text-align: center;
}

.stub-title {
  font-weight: var(--fw-regular);
}

.stub-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  text-decoration: underline;
  text-decoration-thickness: var(--rule);
  text-underline-offset: var(--underline-offset);
}

/* ── Phone (max-width 900px) ────────────────────────────── */

@media (max-width: 900px) {
  /* The header stacks: links, the wordmark centered on its own row, account links. (Wrapping freely left
     the wordmark pushed right on row 1 between ~534 and ~877px.) */
  .header-group {
    flex-basis: 100%;
  }

  .shop-filters,
  .shop-sort,
  .shop-results {
    flex: 1 1 100%;
    order: 0;
  }

  .shop-sort {
    position: static;
  }

  .side-list {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: var(--side-row-gap);
    row-gap: 0;
  }

  .side-link,
  .shop-sort .side-link {
    min-height: var(--tap);
  }

  .filter-check {
    min-height: var(--tap);
  }

  .section-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
  }
}

/* ── Forced colors (Windows High Contrast) ──────────────── */

/* Forced colors paint the links' transparent bottom borders and drop the active line's background:
   hide the borders in the canvas color and give only the current page its line. */
@media (forced-colors: active) {
  .header-link {
    border-bottom-color: Canvas;
  }

  .header-group--left .header-link[aria-current="page"] {
    border-bottom-color: CanvasText;
  }
}

/* ── Short desktop windows ─────────────────────────────── */

/* The pinned Sort/Colors column needs about 480px of height (72px top + its ~405px). In a shorter window
   (a laptop at 150% zoom is ~911x432) its last colors could never be reached, so it scrolls with the page.
   Media queries can't read tokens: 520px is literal, like the 900px breakpoint. */
@media (min-width: 901px) and (max-height: 520px) {
  .shop-sort {
    position: static;
  }
}

/* ── Reduced motion ─────────────────────────────────────── */

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