/*
  Val Davis: design tokens and component primitives.

  The primitives follow the behaviour and structure of shadcn/ui (MIT, https://ui.shadcn.com), which
  builds on Radix UI (MIT): Button variants, Badge, Separator, Skeleton, Sheet, Dialog, form fields with
  inline errors, Alert/Toast, Toggle group. They are ported by hand to plain CSS and vanilla JS
  (public/js/components.js) and restyled for a quiet gallery: hairline borders, 0-2px radii, no heavy
  shadows. The private studio (studio.css) uses the same tokens with a softer, more app-like finish.
*/

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-full-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Gallery shell: warm neutrals so the paintings carry the colour. */
  --paper: #fbfaf6;
  --porcelain: #f4f0e8;
  --porcelain-deep: #ebe5da;
  --stone: #b8b0a4;
  --hairline: #ddd6ca;
  --ink: #1d1d1b;
  --ink-2: #44413c; /* secondary text: 10.2:1 on paper */
  --muted: #6b655c; /* tertiary text: 5.6:1 on paper, 5.1:1 on porcelain */
  --clay: #9b6a4a; /* rules and small details only, never body text */

  /* Collection cues: rules, active states, tiny details. Not backgrounds, not text. */
  --water: #607d91;
  --earth: #b8893b;
  --colour: #8f5b7d;

  --available: #3f6b4f;
  --danger: #a3392b; /* error text: 5.9:1 on paper */
  --focus: #1d1d1b;

  --font-text: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", ui-serif, Georgia, serif;
  --display-weight: 400;
  --display-tracking: -0.01em;
  --display-settings: normal;

  --radius: 2px;
  --radius-sm: 1px;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1360px;
  --section: clamp(72px, 10vw, 152px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Identity studies switch only the display type; the shell stays identical. */
[data-identity="2"] {
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --display-weight: 360;
  --display-tracking: -0.015em;
  --display-settings: "SOFT" 100, "WONK" 0, "opsz" 96;
}
[data-identity="3"] {
  --font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 300;
  --display-tracking: -0.03em;
}

/* ---- Base ---------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  display: block;
  max-width: 100%;
}
/* <picture> only chooses the format; layout belongs to its <img>. */
picture {
  display: contents;
}
img {
  height: auto;
}
a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-variation-settings: var(--display-settings);
  letter-spacing: var(--display-tracking);
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
/* Keeps a short phrase on one line (a size, "Ready to hang", the © line's second sentence). */
.nowrap {
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus {
  top: 16px;
}
.muted {
  color: var(--muted);
}
[role="list"] {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---- Button (shadcn Button: default / secondary / ghost / link; sizes default, lg, icon) ------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 500 0.9375rem/1 var(--font-text);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    border-color 0.2s;
}
.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover {
  background: #33312d;
}
.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn--secondary:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn--ghost {
  background: transparent;
  color: inherit;
}
.btn--ghost:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.btn--lg {
  min-height: 52px;
  padding: 0 28px;
  font-size: 1rem;
}
.btn--icon {
  width: 44px;
  padding: 0;
}
.btn--icon svg {
  width: 24px;
  height: 24px;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}
/* Text links with an arrow and a 44px-tall hit area. No underline at rest (Tyler, 2026-10-10): the
   arrow marks them as links; hover and keyboard focus bring back a quiet underline and nudge the arrow. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 44px;
  font-weight: 500;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.link-arrow:hover,
.link-arrow:focus-visible {
  text-decoration-line: underline;
}
.link-arrow::after {
  content: "→";
}
.link-arrow:hover::after,
.link-arrow:focus-visible::after {
  transform: translateX(3px);
}
@media (prefers-reduced-motion: no-preference) {
  .link-arrow::after {
    transition: transform 0.25s var(--ease-out);
  }
}
.link-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
  text-decoration-color: var(--stone);
}

/* ---- Badge (shadcn Badge): status, never decoration ------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 7px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font: 500 0.75rem/1.5 var(--font-text);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  vertical-align: middle;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stone);
}
.badge--available::before {
  background: var(--available);
}
.badge--sold::before {
  background: var(--clay);
}

/* ---- Separator, Skeleton -------------------------------------------------------------------- */

.separator {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--hairline);
}
.skeleton {
  background: var(--porcelain-deep);
}

/* ---- Sheet (shadcn Sheet / Radix Dialog): focus trapped, Escape closes, focus restored -------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: rgb(29 29 27 / 0.32);
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet[hidden] {
  display: none;
}
.sheet.is-open {
  opacity: 1;
}
.sheet__panel {
  width: min(380px, 88vw);
  height: 100%;
  overflow-y: auto;
  background: var(--paper);
  padding: 16px var(--gutter) 32px;
  transform: translateX(24px);
  transition: transform 0.35s var(--ease-out);
}
.sheet.is-open .sheet__panel {
  transform: none;
}

/* ---- Dialog (lightbox) ------------------------------------------------------------------------ */

.dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 56px 16px 16px;
  background: var(--paper); /* solid: nothing of the page shows behind (Tyler, 2026-10-10) */
}
.dialog[hidden] {
  display: none;
}
.dialog__close {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ---- Form fields (shadcn Label / Input / Select / Textarea + inline message) ------------------ */

.field {
  display: grid;
  gap: 6px;
}
.label {
  font: 500 0.9375rem/1.4 var(--font-text);
}
.hint {
  font-size: 0.875rem;
  color: var(--muted);
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.4 var(--font-text);
}
.textarea {
  min-height: 160px;
  resize: vertical;
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--ink);
}
[aria-invalid="true"] {
  border-color: var(--danger);
}
.field__error {
  color: var(--danger);
  font-size: 0.875rem;
}
.field__error:empty {
  display: none;
}

/* ---- Alert / Toast ---------------------------------------------------------------------------- */

.alert {
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--porcelain);
}
.alert--error {
  border-left-color: var(--danger);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 14px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
}

/* ---- Toggle group (collection filter) --------------------------------------------------------- */

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}
.toggle-group a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.toggle-group a[aria-current] {
  color: var(--ink);
  border-bottom-color: currentColor;
}

/* ---- Development review note ------------------------------------------------------------------ */

.review-flag {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 8px;
  border: 1px dashed var(--clay);
  border-radius: var(--radius);
  color: #7a4f33;
  font: 500 0.75rem/1.4 var(--font-text);
}
