/* Telveden — The Cup Atlas
   Source of truth for every token. _design/index.html links this exact file.
   Palette: warm throughout, never monochrome. Copper is action only. */

:root {
  color-scheme: light only;

  /* ---- colour ---- */
  --cream:      #FAF5EE;  /* page */
  --warm-white: #FFFDF8;  /* raised surface */
  --sand:       #F0E7DA;  /* quiet band, section change */
  --copper:     #B07D4B;  /* accent: action and annotation only */
  --copper-ink: #8E6234;  /* copper on cream, for text that must pass AA */
  --espresso:   #3B2A1F;  /* primary text */
  --espresso-2: #55402F;  /* secondary text */
  --taupe:      #7C6547;  /* captions, meta — darkened from #8B7355, which failed AA on cream (4.14:1) */
  --rule:       color-mix(in oklab, var(--espresso) 14%, transparent);
  --rule-soft:  color-mix(in oklab, var(--espresso) 8%, transparent);

  /* ---- type ---- */
  --font-display: "Alegreya", Georgia, serif;
  --font-text: "Alegreya Sans", system-ui, sans-serif;
  --font-hand: "Caveat", cursive;

  /* fluid scale, ratio ~1.28 */
  --step--1: clamp(0.86rem, 0.84rem + 0.10vw, 0.94rem);
  --step-0:  clamp(1.04rem, 1.00rem + 0.18vw, 1.18rem);
  --step-1:  clamp(1.22rem, 1.12rem + 0.48vw, 1.50rem);
  --step-2:  clamp(1.55rem, 1.30rem + 1.20vw, 2.25rem);
  --step-3:  clamp(2.10rem, 1.60rem + 2.40vw, 3.40rem);
  --step-4:  clamp(2.70rem, 1.85rem + 4.00vw, 5.00rem);

  /* ---- space ---- */
  --sp-3xs: 0.25rem;
  --sp-2xs: 0.5rem;
  --sp-xs:  0.75rem;
  --sp-sm:  1rem;
  --sp-md:  clamp(1.2rem, 2vw, 1.9rem);
  --sp-lg:  clamp(2rem, 4vw, 3.5rem);
  --sp-xl:  clamp(3.2rem, 7vw, 6rem);
  --sp-2xl: clamp(4.5rem, 11vw, 9rem);
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --measure: 62ch;
  --shell: 78rem;

  /* ---- shape ---- */
  --r-sharp: 2px;   /* buttons, inputs */
  --r-soft: 10px;   /* images, media */
  --r-round: 999px; /* pills only, used once */

  /* ---- motion ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur-base: 320ms;
  --dur-slow: 620ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--espresso);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.018em;
  margin: 0;
}
h1, .display-xl { font-size: var(--step-4); }
h2, .display-lg { font-size: var(--step-3); }
h3, .display-md { font-size: var(--step-2); }

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.prose { font-family: var(--font-display); font-size: var(--step-0); line-height: 1.66; }
.lede { font-size: var(--step-1); color: var(--espresso-2); max-width: 40ch; }
.meta { font-size: var(--step--1); color: var(--taupe); }
.hand { font-family: var(--font-hand); color: var(--copper-ink); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--rule); }
a:hover { color: var(--copper-ink); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--copper-ink); outline-offset: 3px; }

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: var(--gutter); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2xs);
  font-family: var(--font-text); font-size: var(--step-0); font-weight: 500;
  padding: 0.7em 1.5em; border-radius: var(--r-sharp); border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn--primary { background: var(--copper); color: var(--warm-white); border-color: var(--copper); }
.btn--primary:is(:hover, .is-hover) { background: var(--copper-ink); border-color: var(--copper-ink); color: var(--warm-white); }
.btn--primary:is(:focus-visible, .is-focus) { outline: 2px solid var(--espresso); outline-offset: 3px; }
.btn--primary:is(:active, .is-active) { transform: translateY(1px); }
.btn--secondary { background: transparent; color: var(--espresso); border-color: var(--rule); }
.btn--secondary:is(:hover, .is-hover) { border-color: var(--copper); color: var(--copper-ink); }
.btn[disabled], .btn.is-disabled { opacity: 0.45; pointer-events: none; }

.link-quiet { text-decoration: none; border-bottom: 1px solid var(--rule); }
.link-quiet:hover { border-bottom-color: var(--copper); color: var(--copper-ink); }

/* ---- symbol tile: uniform frame, irregular mark ---- */
.sym { display: block; text-align: center; text-decoration: none; color: inherit; }
.sym__frame { display: grid; place-items: center; aspect-ratio: 1; padding: 12%; }
.sym__frame img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  transition: transform var(--dur-base) var(--ease-out);
}
.sym:hover .sym__frame img, .sym:focus-visible .sym__frame img { transform: scale(1.07) rotate(-1.5deg); }
.sym__name { display: block; font-family: var(--font-display); font-size: var(--step-0); margin-top: var(--sp-3xs); }
.sym:hover .sym__name { color: var(--copper-ink); }

.sym-grid {
  display: grid; gap: var(--sp-lg) var(--sp-md);
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
}

/* ---- article row ---- */
.row {
  display: grid; gap: var(--sp-2xs) var(--sp-lg); grid-template-columns: 1fr;
  padding-block: var(--sp-md); border-bottom: 1px solid var(--rule-soft);
  text-decoration: none;
}
@media (min-width: 46rem) { .row { grid-template-columns: 3.5rem 1fr auto; align-items: baseline; } }
.row__no { font-size: var(--step--1); color: var(--copper-ink); }
.row__title { font-family: var(--font-display); font-size: var(--step-1); }
.row:hover .row__title { color: var(--copper-ink); }

/* ---- bands ---- */
.band-sand { background: var(--sand); }
.band-warm { background: var(--warm-white); }

/* ---- motion ---- */
.reveal { opacity: 1; }
.js .reveal { opacity: 0; transform: translateY(12px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- page shell ---- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--warm-white); color: var(--espresso);
  padding: var(--sp-2xs) var(--sp-sm); border: 1px solid var(--copper);
}
.skip:focus { left: var(--gutter); top: var(--sp-2xs); }

.masthead { border-bottom: 1px solid var(--rule-soft); }
.masthead__in {
  max-width: var(--shell); margin-inline: auto; padding: var(--sp-md) var(--gutter);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-md); flex-wrap: wrap;
}
.brand { text-decoration: none; display: block; }
.brand__name {
  display: block; font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1; letter-spacing: -0.01em;
  color: var(--copper-ink);
}
.brand__tag { display: block; font-size: var(--step--1); color: var(--taupe); margin-top: 0.25rem; }
.brand:hover .brand__name { color: var(--espresso); }

.nav { display: flex; align-items: center; gap: clamp(0.5rem, 1.6vw, 1.4rem); font-size: var(--step--1); }
/* 44px minimum touch target: the links are short, so the box is grown rather
   than the type. Height comes from min-height, not padding, so the baseline
   stays where the masthead's flex alignment puts it. */
.nav a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding-inline: 0.35rem;
  text-decoration: none; color: var(--taupe);
}
.nav a:hover { color: var(--copper-ink); }
.nav__cta { color: var(--espresso); border-bottom: 1px solid var(--copper); padding-bottom: 2px; }

.foot { border-top: 1px solid var(--rule); margin-top: var(--sp-xl); }
/* A page ending on a full-bleed image meets the footer rule directly: the
   usual breathing space would read as a stray cream band under the photo. */
/* General sibling, not adjacent: the install bar sits between main and the
   footer, which silently broke the `+` version of this rule. */
main:has(> .closing:last-child) ~ .foot { margin-top: 0; }
.foot__in { padding-block: var(--sp-lg) var(--sp-xl); }
.foot__word { color: var(--copper-ink); margin-bottom: var(--sp-md); }
.foot__nav { display: flex; flex-wrap: wrap; gap: 0 var(--sp-sm); font-size: var(--step--1); margin-bottom: var(--sp-sm); }
.foot__nav a {
  display: inline-flex; align-items: center;
  min-height: 44px; min-width: 44px; padding-inline: 0.35rem;
  text-decoration: none; color: var(--taupe);
}
.foot__nav a:hover { color: var(--copper-ink); }
.foot__legal { max-width: 54ch; }

/* ---- persistent install bar ----
   The atlas is 16,000px of search-landing content whose only CTA sat at 96%
   depth. This is the conversion path for a visitor who arrives mid-page from a
   symbol query, reads one entry and would otherwise leave. It hides itself when
   the page's own closing CTA is on screen, so the two never stack. */
.installbar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
  padding: var(--sp-2xs) var(--gutter);
  background: color-mix(in oklab, var(--warm-white) 94%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
  transform: translateY(110%);
  transition: transform var(--dur-base) var(--ease-out);
}
.installbar.is-on { transform: none; }
.installbar__line { margin: 0; font-size: var(--step--1); color: var(--espresso-2); }
@media (prefers-reduced-motion: reduce) {
  .installbar { transition: none; }
}
@media (max-width: 30rem) {
  .installbar__line { display: none; }
}
