/* ==========================================================================
   site.css — Phase 2 skeleton chrome (team 06).
   Functional-first, plain. EVERY color is var(--*) from tokens.css —
   tools/check-tokens.mjs is the gate. Red budget: this skeleton uses no
   solid red at all (no real actions exist yet to spend it on).
   ========================================================================== */

* { box-sizing: border-box; }

html {
  font-family: var(--font-ui);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
}

/* ---- Focus: always visible (DESIGN_SYSTEM §5) --------------------------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---- Layout ------------------------------------------------------------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

main.container {
  padding-top: var(--space-6);
  padding-bottom: var(--space-9);
  min-height: 55vh;
}

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: calc(-1 * var(--space-10));
  z-index: var(--z-toast);
  background: var(--panel-3);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: var(--space-2);
}

/* ---- Header (component contract: DESIGN_SYSTEM §6) ---------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display-sm);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.nav-list {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-list a,
.cart-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* hit target floor, DESIGN_SYSTEM §5 (44px since Phase 5) */
  padding: 0 var(--space-3);
  color: var(--text-dim);
  text-decoration: none;
  text-transform: uppercase;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  border-radius: var(--radius);
  border-bottom: 2px solid transparent;
}

.nav-list a:hover,
.cart-link:hover {
  color: var(--text);
  background: var(--panel-2);
}

.nav-list a[aria-current="page"],
.cart-link[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--line-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* ---- Type --------------------------------------------------------------- */
h1 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular); /* Bebas ships 400 only — never fake-bold */
  font-size: var(--fs-display-md);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  margin: var(--space-4) 0 var(--space-4);
}

h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display-sm);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  margin: var(--space-6) 0 var(--space-3);
}

p { margin: 0 0 var(--space-4); }
ul { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
li { margin-bottom: var(--space-2); }

a { color: var(--text); }

code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-1);
}

.lede { color: var(--text-dim); font-size: var(--fs-md); }

/* ---- Honest labelled notice (constitution rule 1 allow-listed state) ---- */
.notice {
  display: grid;
  gap: var(--space-2);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
}

.notice--pending { border-left-color: var(--warn); }

.notice-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
}

.notice p { margin: 0; color: var(--text-dim); }

/* ---- Empty state (gallery/search: honest, never fake counts) ------------ */
.empty-state {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-dim);
  margin: var(--space-5) 0;
}
.empty-state p { margin: 0; }

/* ---- Sub-navigation (gallery sections) ---------------------------------- */
.subnav-list {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  flex-wrap: wrap;
}
.subnav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
  text-decoration: none;
  text-transform: uppercase;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
}
.subnav-list a:hover { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.subnav-list a[aria-current="page"] { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }

/* ---- Forms & buttons ---------------------------------------------------- */
label {
  display: block;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-1);
}

input[type="text"],
input[type="search"],
input[type="email"],
select {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  width: 100%;
  max-width: 32rem;
}

input:focus-visible,
select:focus-visible {
  border-color: var(--line-2);
}

.btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-5);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
}
.btn:hover { background: var(--panel-3); }

.theme-toggle {
  font: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-2); }
.theme-toggle[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-4);
}
fieldset:disabled label,
fieldset:disabled legend { color: var(--text-faint); } /* disabled-only use of --text-faint */
fieldset:disabled input,
fieldset:disabled .btn { cursor: not-allowed; }
legend {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 var(--space-2);
}

.form-row { margin-bottom: var(--space-4); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-dim);
  font-size: var(--fs-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  padding-top: var(--space-6);
  padding-bottom: var(--space-5);
}

.footer-heading {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 var(--space-3);
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-list li { margin-bottom: var(--space-2); }
.footer-list a { color: var(--text-dim); text-decoration: none; }
.footer-list a:hover { color: var(--text); text-decoration: underline; }

.footer-status { margin: 0; }

.footer-meta {
  border-top: 1px solid var(--line);
  padding-top: var(--space-4);
  padding-bottom: var(--space-5);
}
.footer-meta p { margin: 0; }

/* ---- Search page: filter rail + results (team 09, Phase 3 SEARCH) -------
   DESIGN_SYSTEM.md §6 "Filter rail" contract: --panel surface, right --line,
   --z-sticky; section labels --fs-xs --ls-caps --text-dim; active chip =
   --red-tint bg + --red-text text + --line-2 border (tint, not solid — red
   budget); chips/hit targets >= 40px. Collapsing to a drawer on mobile is a
   JS enhancement deferred to the polish phase (Phase 5) — the no-JS base
   case stacks the rail above the results, fully usable. */

.search-layout {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 56rem) {
  .search-layout { grid-template-columns: minmax(0, 1fr); }
}

.filter-rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-right-color: var(--line-2);
  border-radius: var(--radius);
  padding: var(--space-4);
  position: sticky;
  top: var(--space-4);
  z-index: var(--z-sticky);
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
}
@media (max-width: 56rem) {
  .filter-rail { position: static; max-height: none; }
}

.filter-section {
  padding: var(--space-3) var(--space-3);
  margin-bottom: var(--space-4);
}
.filter-section legend,
.filter-rail label,
.filter-rail .range-label {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
}
.filter-rail .range-label {
  display: block;
  margin-bottom: var(--space-1);
}
.filter-note {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin: 0 0 var(--space-3);
}
fieldset:disabled .filter-note { color: var(--text-faint); } /* disabled-only use of --text-faint */

.filter-rail input[type="number"],
.filter-rail select {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  width: 100%;
}
.filter-rail select:focus-visible,
.filter-rail input:focus-visible {
  border-color: var(--line-2);
}

.range-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.filter-reset {
  color: var(--text-dim);
  font-size: var(--fs-sm);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.filter-reset:hover { color: var(--text); }

/* Active-filter chips: link removes the filter (no-JS base case). */
.active-filters { margin-bottom: var(--space-4); }
.active-filters-label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-2);
}
.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip-list li { margin-bottom: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  background: var(--red-tint);
  color: var(--red-text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  text-decoration: none;
}
.chip:hover { border-color: var(--red-text); }
.chip-x { font-size: var(--fs-md); line-height: 1; }

/* ==========================================================================
   Gallery + detail + home (team 06, Phase 3 GALLERY/UI wiring).
   DESIGN_SYSTEM.md §6 contracts: image-neutral cards (--panel/--line chrome,
   NO red), aspect-preserved thumbs, chips per the filter-rail contract,
   detail view carries THE one solid-red action, EXIF in mono.
   ========================================================================== */

/* ---- Primary action: the ONE solid red per view (red budget, §2).
   Sits on --surface in both themes: --red passes 3:1 non-text there (dark)
   and is text-capable on light; label --on-red = 6.02:1 on --red. Hover
   uses --red-ui, which holds >=3.3:1 on every dark surface. */
.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: var(--on-red);
}
.btn-primary:hover {
  background: var(--red-ui);
  border-color: var(--red-ui);
  color: var(--on-red);
}

/* ---- Gallery filter chips (category = real DB rows; orientation = enum) - */
.gallery-filters {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
  display: grid;
  gap: var(--space-2);
}
.chip-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.chip-row .chip-list { margin: 0; }
.chip-row .filter-note { margin: 0; }
.chip-row-label {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  min-width: 6.5rem;
}
.chip-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* hit target floor, DESIGN_SYSTEM §5 (44px since Phase 5) */
  padding: 0 var(--space-3);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  color: var(--text-dim);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.chip-toggle:hover {
  background: var(--panel-2);
  border-color: var(--line-2);
  color: var(--text);
}
/* Active chip = tint + red text + emphasized hairline (filter-rail contract:
   tint, never solid — the red budget stays with actions). */
.chip-toggle[aria-current="true"] {
  background: var(--red-tint);
  border-color: var(--line-2);
  color: var(--red-text);
}

/* ---- Asset grid: responsive, aspect-preserving, image-neutral ----------- */
.asset-grid {
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.asset-grid > li { margin-bottom: 0; }
.asset-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
}
.asset-card a:hover {
  background: var(--panel-2);
  border-color: var(--line-2);
}
.asset-card img {
  display: block;
  width: 100%;
  height: auto; /* real width/height attrs preserve the aspect ratio */
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.asset-card-nothumb {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--space-10);
  padding: var(--space-4);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  border-bottom: 1px dashed var(--line-2);
}
.asset-card-title {
  display: block;
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
}
.asset-card-meta {
  display: block;
  padding: 0 var(--space-3) var(--space-3);
  color: var(--text-dim);
  font-size: var(--fs-sm);
}

/* Lazy-load polish (js/gallery.js): only images NOT yet painted when JS runs
   get .img-fade, so the no-JS render is identical minus the fade. Durations
   are motion tokens — reduced-motion collapses them at token level. */
.img-fade { opacity: 0; }
.img-fade.img-ready { opacity: 1; transition: opacity var(--dur) var(--ease); }

/* ---- Asset detail view (§6 "Detail view") ------------------------------- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
  gap: var(--space-6);
  align-items: start;
  margin-bottom: var(--space-6);
}
@media (max-width: 56rem) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
}
.detail-media {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.detail-media img,
.detail-media video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.detail-media .notice { margin: 0; }
.detail-info > h2:first-child { margin-top: 0; }

/* EXIF: data renders in mono at --fs-sm (§6 detail-view contract). */
.exif-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  margin: 0 0 var(--space-4);
}
.exif-table th,
.exif-table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
}
.exif-table th {
  color: var(--text-dim);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

/* ---- Home hero: type-only, token-built (no stock imagery until curation
        supplies real work). ------------------------------------------------ */
.hero {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-6);
}
.hero-kicker {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 var(--space-2);
}
.hero-title {
  font-size: var(--fs-display-xl);
  margin: 0 0 var(--space-4);
}
.hero-lede {
  color: var(--text-dim);
  font-size: var(--fs-lg);
  max-width: 62ch;
  margin: 0 0 var(--space-5);
}
.hero-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.hero-actions .btn { text-decoration: none; }

/* Screen-reader-only helper (range pair inputs carry hidden labels). */
.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;
}

/* ==========================================================================
   Phase 5 — a11y / responsive pass (teams 11+06).
   ========================================================================== */

/* ---- Responsive table wrapper -------------------------------------------
   Every data table (cart, checkout review, order items, licensing tiers,
   EXIF, admin lists) sits inside .table-scroll so a narrow viewport scrolls
   the TABLE region, never the page body. The markup adds role="region" +
   aria-label + tabindex="0" so keyboard users can reach and scroll it. */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--space-4);
}
.table-scroll:focus-visible { box-shadow: var(--focus-ring); }
.table-scroll > table { margin: 0; width: 100%; border-collapse: collapse; }
.table-scroll th,
.table-scroll td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
}
.table-scroll thead th {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: var(--fw-semibold);
  border-bottom: 1px solid var(--line-2);
}
.table-scroll tfoot th,
.table-scroll tfoot td {
  font-weight: var(--fw-bold);
  border-top: 1px solid var(--line-2);
}

/* ---- Narrow viewports (360px class) -------------------------------------
   The header stays CSS-only: flex-wrap already stacks wordmark, nav and
   actions into rows; below 30rem the paddings tighten so all five targets
   fit without horizontal scroll while keeping the 44px hit floor. */
@media (max-width: 30rem) {
  .header-row { gap: var(--space-2) var(--space-1); }
  .nav-list { gap: var(--space-1); }
  .nav-list a,
  .cart-link,
  .theme-toggle { padding: 0 var(--space-2); }
  .hero { padding-top: var(--space-6); }
}
