/* ==========================================================================
   Living Exhibits — shared design tokens & components (museum-gold dark)
   Single source of truth for every page under web/. Zero-build, plain CSS.

   Contrast (WCAG AA, checked against --bg #14120E):
     --ink    #F0EADC  ~14.9:1   --muted  #A79C86  ~6.9:1
     --accent #E8B44C  ~9.9:1    --teal   #3FA08D  ~5.9:1
     --line   #6A604C  ~3.0:1    (WCAG 1.4.11 minimum for a UI boundary)
   All pass AA for normal text.

   NOTE: unity/LivingExhibits Theme.cs mirrors these tokens — mirror any
   colour change there too.
   ========================================================================== */

:root {
  /* color */
  --bg: #14120E;
  --surface: #1C1914;
  --ink: #F0EADC;
  --muted: #A79C86;
  --line: #6A604C;               /* 3.02:1 on --bg — borders you can see */
  --line-soft: #322D22;          /* decorative rules only, never a boundary */
  --accent: #E8B44C;
  --accent-deep: #C4922E;
  --teal: #3FA08D;
  --on-accent: #211A08;          /* text on gold */
  --accent-wash: rgba(232, 180, 76, 0.10);       /* gold tint under outlined chrome */
  --accent-wash-strong: rgba(232, 180, 76, 0.20);
  --surface-raised: #262117;     /* pressed / hover surface */
  --scrim: rgba(0, 0, 0, 0.72);  /* glass chrome over camera */
  --scrim-strong: rgba(0, 0, 0, 0.85);
  --hairline: rgba(255, 255, 255, 0.45);  /* chrome border over a photograph */
  --danger: #E08573;

  /* type — rem scale on a 17px base */
  --font-serif: "Iowan Old Style", Palatino, Georgia, serif;
  --font-sans: -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", sans-serif;
  --text-sm: 0.882rem;                          /* 15px — smallest UI text */
  --text-base: 1rem;                            /* 17px */
  --text-lg: 1.118rem;                          /* 19px */
  --text-xl: clamp(1.294rem, 1rem + 1.2vw, 1.53rem);    /* 22–26px */
  --text-2xl: clamp(1.647rem, 1.2rem + 2vw, 2rem);      /* 28–34px */
  --text-hero: clamp(2.235rem, 1.6rem + 3.4vw, 3.53rem);/* 38–60px */

  /* spacing & radius */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* elevation — the only shadows in the product */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --elev-2: 0 6px 18px rgba(0, 0, 0, 0.45);
  --elev-3: 0 26px 60px rgba(0, 0, 0, 0.55);
  --glow-accent: 0 0 40px rgba(232, 180, 76, 0.22);

  /* motion — every transition in the product refers to these */
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-spring: cubic-bezier(0.2, 1.6, 0.4, 1);
  --press-scale: 0.97;

  /* interaction */
  --tap-min: 48px;               /* minimum touch target */
  --focus-ring: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent);
}

* { box-sizing: border-box; }
/* components set their own display, which would otherwise beat the UA rule */
[hidden] { display: none !important; }
html { font-size: 106.25%; /* 17px base */ }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur-base) var(--ease-out); }
a:hover { text-decoration: underline; }

/* Shared response layer: everything tappable eases and gives under the finger. */
.btn, .pill, .card--tappable, .field, .seg, summary {
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:active, .pill:active, .card--tappable:active, .seg:active {
  transform: scale(var(--press-scale));
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:active { background: var(--surface-raised); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-primary:active { background: var(--accent-deep); }
.btn-primary { box-shadow: var(--elev-1); }
.btn-primary:hover { box-shadow: var(--elev-2); }
/* Outlined gold — the visible secondary action beside a primary CTA.
   Reads as a real button (soft depth + gold tint), never as a text link. */
.btn-outline {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
  box-shadow: var(--elev-1);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn-outline:hover { border-color: var(--accent); background: var(--accent-wash-strong);
                     box-shadow: var(--elev-2); }
.btn-outline:active { background: var(--accent-wash-strong); box-shadow: var(--elev-1); }
/* trailing arrow: leans forward on hover, still on reduced motion */
.btn .arrow { font-size: 1.05em; line-height: 1;
              transition: transform var(--dur-base) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .btn:hover .arrow { transform: none; } }
.btn-glass {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-color: var(--hairline);
  color: #fff;
}
.btn-glass:active { background: var(--scrim-strong); }
/* Quiet destructive action — never gold, never shouty. */
.btn-quiet-danger { border-color: var(--line); color: var(--danger); }
.btn-quiet-danger:hover { border-color: var(--danger); }
.btn-quiet-danger.armed { background: var(--danger); border-color: var(--danger); color: var(--bg); }

/* ---------- pills (compact chrome buttons over camera) ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--scrim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.pill:active { background: var(--scrim-strong); }
.pill[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* ---------- segmented control ---------- */
.segrow {
  display: inline-flex; gap: var(--space-1); padding: var(--space-1);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); flex-wrap: wrap;
}
.seg {
  min-height: var(--tap-min); padding: 0 var(--space-5);
  border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--muted);
  font-family: inherit; font-size: var(--text-base); font-weight: 600; cursor: pointer;
}
.seg:hover { color: var(--ink); }
.seg[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
/* When the segments cannot fit side by side, stack them as full-width rows
   instead of wrapping inside the pill outline. */
@media (max-width: 560px) {
  .segrow {
    display: flex; flex-direction: column; align-items: stretch;
    width: 100%; border-radius: var(--radius-md);
  }
  .seg { width: 100%; text-align: center; }
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--elev-1);
}
.card--tappable { cursor: pointer; }
.card--tappable:hover { border-color: var(--accent); }
.card--tappable:active { background: var(--surface-raised); }

/* ---------- fields ---------- */
.field {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-base);
}
.field::placeholder { color: var(--muted); }
.field:focus { border-color: var(--accent); outline: none; }

/* ---------- loading skeletons ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-raised) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skelshimmer 1.4s var(--ease-out) infinite;
  border-radius: var(--radius-sm);
}
@keyframes skelshimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- range slider (big thumb, ≥48px row) ---------- */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: var(--tap-min);
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"].slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  margin-top: -13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--on-accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
input[type="range"].slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
}
input[type="range"].slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--on-accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* ---------- small helpers ---------- */
.muted { color: var(--muted); }
.nomargin { margin: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* transforms are not durations — the press spring has to be switched off */
  .btn:active, .pill:active, .card--tappable:active, .seg:active { transform: none !important; }
  .skel { animation: none !important; background: var(--surface-raised); }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #C9BFA9;
    --line: #8C8068;
    --line-soft: #6A604C;
    --hairline: rgba(255, 255, 255, 0.75);
    --scrim: rgba(0, 0, 0, 0.86);
    --scrim-strong: rgba(0, 0, 0, 0.94);
  }
  .btn, .pill, .card, .field { border-width: 2px; }
}
