/*
 * Rack theme for the web: the iOS app's look, carried over value for value.
 *
 * Source of truth is ArtSongTranspositions/Views/RackTheme.swift plus the
 * card and row views that use it (RackFolioCard in ContentView.swift,
 * WorkRow in CatalogBrowseView.swift, TierCard in TierSelectionView.swift).
 * If a value changes in the app, change it here too.
 *
 * One deliberate difference: text colours. The app's gold (#B3833D) and
 * muted grey (#8C8273) measure 2.8-3.5:1 against the parchment, below the
 * 4.5:1 WCAG AA minimum for normal text. Libraries buying e-resources often
 * ask for WCAG 2.1 AA (and a VPAT), so on the web those two colours are used
 * for rules, borders, fills and large display text only, and body-size text
 * uses the darker --gold-text / --muted-text below (5.1:1 and 5.3:1 on cards).
 */

@font-face {
  font-family: "Oswald";
  src: url("assets/Oswald-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* RackTheme colours, exact (Swift RGB fractions x 255) */
  --background: #F1EADB;   /* RackTheme.background */
  --card: #FBF7F0;         /* RackTheme.cardBackground */
  --card-border: #D8CAB3;  /* RackTheme.cardBorder */
  --ink: #251F1B;          /* RackTheme.ink */
  --gold: #B3833D;         /* RackTheme.gold: borders, fills, large text */
  --muted: #8C8273;        /* RackTheme.muted: rules, placeholder, large text */
  --maroon: #762E25;       /* RackTheme.maroon */

  /* Web-only, for text under ~24px (see header) */
  --gold-text: #8A6224;
  --muted-text: #6F665B;

  /*
   * Type. The app uses Apple's own faces: New York (.serif), SF Pro
   * (.default), SF Rounded (.rounded). Apple's licence doesn't allow
   * embedding them on a website, so each stack asks for the system face
   * first (Safari on Apple devices gets the real thing) and falls back to
   * the nearest open font.
   */
  --font-serif: ui-serif, "New York", "Source Serif 4", Georgia, serif;
  /* Italic titles in PT Serif (Jonathan, 2026-11-14): New York's italic read as
     too florid. Same face on every device; upright serif is unchanged. */
  --font-serif-italic: "PT Serif", Georgia, serif;
  --font-sans: system-ui, -apple-system, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  /* Tracked-capital labels and section headings (Jonathan, 2026-10-17: trying
     Figtree so they look the same on every device, not the system face). */
  --font-eyebrow: "Figtree", var(--font-sans);
  --font-rounded: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --font-display: "Oswald", "Arial Narrow", sans-serif;   /* bundled Oswald-Bold */

  /* Radii used across the app */
  --radius-card: 14px;
  --radius-panel: 12px;
  --radius-field: 10px;
  --radius-button: 8px;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 16px/1.4 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-text); }
/* Focus ring in --gold-text, not --gold: WCAG 1.4.11 asks 3:1 for the
   indicator, and --gold is only 2.8:1 on the page background (gold-text is
   4.6:1). Changed 2026-10-05 for an accessibility vetting (SPSCC). */
:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 2px; }

/* "Skip to content": the first stop on every page for keyboard users,
   hidden until it is focused. */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 1000; padding: 10px 16px;
  background: var(--ink); color: var(--background); font: 600 15px/1 var(--font-sans);
  border-radius: 6px; text-decoration: none; }
.skip-link:focus, .skip-link:focus-visible { top: 12px; outline: 2px solid var(--gold-text); outline-offset: 2px; }
/* The skip target is a container, focused only so the next Tab starts there. */
#content:focus { outline: none; }

/* ---- Text styles (Font.rack*) ---- */

.display        { font-family: var(--font-serif); font-weight: 400; }
.display-italic { font-family: var(--font-serif-italic); font-weight: 400; font-style: italic; }

/* rackEyebrow: tracked uppercase label. Tracking is in pt in SwiftUI; 1.5pt
   at 13.75pt is ~0.11em, 1.2pt at 11pt is ~0.11em, so one em value covers both. */
.eyebrow {
  font-family: var(--font-eyebrow);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
/* rackEyebrowSoft: section headers such as "Available Keys" (not uppercased in the app) */
.eyebrow-soft {
  font-family: var(--font-rounded);
  font-weight: 600;
  color: var(--gold-text);
}
.oswald { font-family: var(--font-display); font-weight: 700; }

.muted { color: var(--muted-text); }

/* ---- Buttons ---- */

/* RackPillButtonStyle: tier pills, collection chips */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 14px/1 var(--font-sans);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.pill[aria-pressed="true"], .pill.is-selected { background: var(--ink); border-color: var(--ink); color: var(--card); }
/* The static "N PLANS" label: outlined in ink, semibold, not a choice */
.pill.is-static { border-color: var(--ink); font-weight: 600; cursor: default; }
.pill:active { opacity: 0.7; }

/* RackFilledButtonStyle: the primary action on a screen */
.button-filled {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%;
  font: 600 15px/1 var(--font-sans);
  padding: 12px 24px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--card);
  cursor: pointer;
}
.button-filled:active { opacity: 0.8; }
/* The gold "Current Plan" state on a tier card */
.button-filled.is-current { background: var(--gold-text); cursor: default; }

/* RackOutlineButtonStyle: secondary actions on a card */
.button-outline {
  flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  font: 600 13px/1 var(--font-sans);
  white-space: nowrap;
  padding: 8px 10px;
  border: 1px solid currentColor; border-radius: var(--radius-button);
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.button-outline.is-gold { color: var(--gold-text); }
.button-outline:active { opacity: 0.6; }

/* RackCountPill: "1 / 3 active" */
.count-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 13px/1 var(--font-sans);
  color: var(--maroon);
  padding: 7px 14px;
  border: 1px solid rgb(118 46 37 / 0.5);
  border-radius: 999px;
}
.count-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--maroon); }

/* WorkRow badges */
.badge {
  display: inline-block;
  font: 700 10px/1 var(--font-sans);
  letter-spacing: 0.08em;
  color: var(--card);
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--gold-text);
  vertical-align: 2px;
}
.badge.is-maroon { background: var(--maroon); }

/* ---- Cards ---- */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
}

/* RackFolioCard, filled */
.folio-card { padding: 16px; display: grid; gap: 6px; }
.folio-card .eyebrow { font-size: 13.75px; color: var(--gold-text); }
.folio-card .title { font: italic 400 20px/1.25 var(--font-serif-italic); }
.folio-card .key { font: 400 26px/1.2 var(--font-serif); }
.folio-card .actions { display: flex; gap: 8px; margin-top: 6px; }

/* RackFolioCard, empty slot: dashed border, gold "Add a Title" */
.folio-card.is-empty {
  border-style: dashed;
  color: var(--gold-text);
  text-align: center;
  padding: 28px 16px;
  font: 500 28px/1.2 var(--font-sans);
  cursor: pointer;
}

/* WorkRow: a catalog entry */
.work-row { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--card-border); }
.work-row .title { font: 500 18px/1.3 var(--font-serif); }  /* upright: song titles aren't italic on the site */
.work-row .detail { font-size: 13px; color: var(--muted-text); }
.work-row .meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted-text); }

/* TierCard */
.tier-card { padding: 16px 18px; display: grid; gap: 8px; }
.tier-card.is-current { border: 2px solid var(--gold); }
.tier-card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tier-card .name { font: italic 400 22px/1.2 var(--font-serif-italic); }
.tier-card .count { font-size: 14px; color: var(--gold-text); }
.tier-card .tagline { font-size: 15px; }
.tier-card .blurb { font-size: 13px; color: var(--muted-text); }
