/* ============================================================================
   bigcoat.co — stylesheet
   Implements Lynne's design spec (2026-06-27) + Joe's sign-off amendments:
   (1) Newsreader (not Fraunces) for titles & modal commentary;
   (2) 2-column grid on phones;
   (3) Brand accent = MUSTARD #E8B931 (matches the shared favicon set), not the
       spec's terracotta. Mustard is light, so the accent splits into a bright
       shade for fills and a dark shade (--accent-deep) for text/lines/focus on
       the light ground — see the token block for the AA reasoning.
   The quietest site in the family — the work is the only loud thing. The accent
   is structural ONLY (focus, active tag, for-sale mark, buy button). Warm paper
   ground, near-invisible chrome, print-not-UI imagery (no shadows, no rounded
   corners on images).
   ========================================================================== */

/* ----------------------------------------------------------------- Tokens */
:root {
  /* Colour (§1.2) — near-monochrome warm; imagery brings all the colour. */
  --ground:      #FAF8F4;   /* page — warm paper, never screen-white */
  --ground-2:    #F1EDE6;   /* tile/skeleton fill while images load */
  --ink:         #211E1B;   /* primary text — warm near-black */
  --ink-soft:    #6B645B;   /* captions, meta, tag labels (AA on ground) */
  --ink-faint:   #938B80;   /* tertiary — placeholder text, inactive UI */
  --hairline:    #E5DDD0;   /* dividers, filter-bar underline */
  /* Accent — mustard, the brand colour (matches the shared favicon set).
     STRUCTURAL ONLY (focus rings, active-tag fill, for-sale marker, buy button).
     Mustard is light, so the role splits by background to keep AA:
       --accent       bright mustard — for FILLS only; dark ink text sits on it.
                      #E8B931 on the paper ground is ~1.7:1, so it is NEVER used
                      as text or a thin line on the light ground.
       --accent-deep  dark mustard — for anything on the LIGHT ground: focus
                      rings, accent-as-text, the buy-button outline + label, the
                      active-thumb border. #8A5F06 on #FAF8F4 ≈ 5.3:1 (AA text).
     Text on the bright-mustard fills is --ink (≈9:1 on mustard), not white
     (#fff on mustard is only ~1.8:1). */
  --accent:      #E8B931;   /* bright mustard — fills only */
  --accent-deep: #8A5F06;   /* dark mustard — on-light text / lines / focus rings */
  --scrim:       rgba(20,18,16,0.92);  /* modal backdrop */

  /* Type families (§1.3, amended) */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Type scale (§1.3) */
  --t-wordmark:    clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --t-modal-title: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  --t-tile-title:  1.0625rem;   /* 17 */
  --t-body:        1.0625rem;   /* 17 */
  --t-meta:        0.875rem;    /* 14 */
  --t-tag:         0.8125rem;   /* 13 */
  --t-overline:    0.75rem;     /* 12 */

  /* Spacing — 8px base (§1.4) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-8: 48px; --space-12: 64px;
  --space-20: 96px;

  /* Grid (§1.4 / §2.2) */
  --tile-gap:    clamp(8px, 1.2vw, 16px);
  --page-gutter: clamp(16px, 4vw, 64px);
  --grid-max:    1800px;
  --header-h:    56px;
  --measure:     66ch;          /* modal reading column */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Focus ring — terracotta, never removed (§4 accessibility) */
/* Focus ring uses the DARK mustard — bright mustard would be near-invisible on
   the paper ground. --accent-deep stays clearly visible and AA as a UI line. */
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

a { color: inherit; }

/* =====================================================================
   STICKY HEADER (§2.1) — thin warm bar, hairline, frosted backdrop
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--ground);
  border-bottom: 1px solid var(--hairline);
}
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-header {
    background: color-mix(in srgb, var(--ground) 88%, transparent);
    -webkit-backdrop-filter: saturate(1) blur(10px);
    backdrop-filter: saturate(1) blur(10px);
  }
}
.header-inner {
  max-width: var(--grid-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  display: flex;
  align-items: center;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-wordmark);
  line-height: 1;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-decoration: none;
}

/* =====================================================================
   FILTER / SEARCH BAR (§2.5) — sticky under the header
   ===================================================================== */
.filterbar {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: var(--ground);
  border-bottom: 1px solid var(--hairline);
}
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .filterbar {
    background: color-mix(in srgb, var(--ground) 90%, transparent);
    -webkit-backdrop-filter: saturate(1) blur(10px);
    backdrop-filter: saturate(1) blur(10px);
  }
}
.filterbar-inner {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: var(--space-3) var(--page-gutter);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.search-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 1 280px;
  min-width: 200px;
  border-bottom: 1px solid var(--hairline);
  padding: 6px 2px;
}
.search-field:focus-within { border-bottom-color: var(--ink); }
.search-icon { fill: none; stroke: var(--ink-faint); stroke-width: 1.4; stroke-linecap: round; }
#search {
  border: 0;
  background: transparent;
  font: 500 var(--t-tag)/1.2 var(--sans);
  letter-spacing: 0.02em;
  color: var(--ink);
  width: 100%;
}
#search::placeholder { color: var(--ink-faint); }
#search:focus { outline: none; }

/* Tag pills row — scrolls horizontally on mobile, never wraps to a wall */
.tagrow {
  display: flex;
  gap: var(--space-2);
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}
.tagrow::-webkit-scrollbar { display: none; }
.tag-pill {
  flex: 0 0 auto;
  font: 500 var(--t-tag)/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.tag-pill:hover { border-color: var(--ink-faint); color: var(--ink); }
.tag-pill[aria-pressed="true"] {
  background: var(--accent);          /* bright mustard fill */
  border-color: var(--accent-deep);  /* dark edge so the pill reads on light */
  color: var(--ink);                 /* ink on mustard ≈ 9:1; white would fail */
}
.tag-pill[aria-pressed="true"] .x { margin-left: 6px; opacity: 0.7; }
.clear-all {
  flex: 0 0 auto;
  font: 500 var(--t-tag)/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  padding: 7px 2px;
}

/* =====================================================================
   THE MASONRY GRID (§2.2) — CSS columns, NOT a JS library.
   2 / 3 / 4 / 5 columns up the breakpoints (mobile = 2 per Joe's amendment).
   ===================================================================== */
.grid-wrap {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: var(--space-8) var(--page-gutter) var(--space-20);
}
.grid {
  column-count: 2;                 /* mobile: 2 (amendment) */
  column-gap: var(--tile-gap);
}
@media (min-width: 600px)  { .grid { column-count: 3; } }
@media (min-width: 1000px) { .grid { column-count: 4; } }
@media (min-width: 1500px) { .grid { column-count: 5; } }

/* A tile is a column item: must avoid breaking across columns. */
.tile {
  break-inside: avoid;
  margin: 0 0 var(--tile-gap);
  display: inline-block;           /* belt-and-braces for column break behaviour */
  width: 100%;
  position: relative;
}
.tile.is-hidden { display: none; }

/* featured tiles get a touch more visual weight via a hairline frame of air */
.tile.featured { /* reserved hook; columns can't truly span — kept subtle */ }

.tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  background: var(--ground-2);     /* skeleton fill before the image paints */
}
.tile-link img {
  width: 100%;
  height: auto;
  /* print-on-a-wall: no radius, no shadow, no border on the imagery */
}

/* FOR SALE marker (§2.4) — mustard fill, top-left. Ink text (not white) so it
   reads on the bright mustard (ink≈9:1; white would be ~1.8:1). */
.tile-sale {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font: 600 var(--t-overline)/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--accent);
  padding: 5px 8px;
  pointer-events: none;
}

/* ---- Tile caption (§2.3) ----
   Default: hover-reveal on pointer; always-on on touch. Per-item override via
   caption: always | none. */

/* always-on caption sits BELOW the image, on the paper */
.tile-cap {
  margin: var(--space-2) 2px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tile-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-tile-title);
  line-height: 1.25;
  color: var(--ink);
}
.tile-sub {
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--t-meta);
  color: var(--ink-soft);
}

/* hover-reveal: title fades up over a soft bottom gradient, on pointer only */
@media (hover: hover) {
  .tile[data-caption="hover"] .tile-cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    padding: var(--space-6) var(--space-3) var(--space-3);
    background: linear-gradient(to top, rgba(20,18,16,0.55), transparent);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
  }
  .tile[data-caption="hover"] .tile-title { color: #fff; }
  .tile[data-caption="hover"] .tile-sub { color: rgba(255,255,255,0.82); }
  .tile[data-caption="hover"]:hover .tile-cap,
  .tile[data-caption="hover"]:focus-within .tile-cap {
    opacity: 1;
    transform: none;
  }
}
/* touch / no-hover: a hover-mode tile shows its caption always-on, below */
@media (hover: none) {
  .tile[data-caption="hover"] .tile-cap { /* inherits the below-image default */ }
}

/* caption: none — pure image, no label ever */
.tile[data-caption="none"] .tile-cap { display: none; }

/* =====================================================================
   EMPTY STATE (§2.5)
   ===================================================================== */
.empty-state {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink-soft);
  text-align: center;
  padding: var(--space-20) 0;
}
.link-btn {
  font: inherit;
  color: var(--accent-deep);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  padding: 0;
}

/* =====================================================================
   FOOTER (§2.1) — one quiet line
   ===================================================================== */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: var(--space-8) var(--page-gutter);
  text-align: center;
}
.site-footer p {
  margin: 0;
  font-size: var(--t-meta);
  color: var(--ink-soft);
}
.site-footer a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--hairline);
  transition: text-decoration-color .15s ease;
}
.site-footer a:hover { text-decoration-color: var(--ink-soft); }
.site-footer .dot { color: var(--ink-faint); margin: 0 0.5em; }

/* Shared family footer (the cross-site favicon row) is a direct <body> child here,
   and bigcoat gutters every component itself rather than padding <body>. Give the
   family footer the same page gutter as its siblings. (The shared snippet stays
   byte-identical across all four sites; this single host rule handles bigcoat's
   no-body-padding layout — exactly the per-site placement note in Lynne's §5.) */
.family-footer { padding-inline: var(--page-gutter); }

/* =====================================================================
   MODAL (§2.4) — lightbox-or-article, focus-trapped, hash-routed
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--ground);
  padding: clamp(var(--space-5), 4vw, var(--space-12));
  -webkit-overflow-scrolling: touch;
}
.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 2;
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ground);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  cursor: pointer;
}
.modal-close svg { stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; }
.modal-close:hover { border-color: var(--ink); }

/* ---- modal content (built by app.js) ---- */
.m-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-modal-title);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.m-sub {
  font-family: var(--sans);
  font-size: var(--t-meta);
  color: var(--ink-soft);
  margin: var(--space-2) 0 0;
}
.m-overline {
  font: 600 var(--t-overline)/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 var(--space-2);
}

/* gallery-led layout: big stage + counter + nav arrows + thumb strip */
.m-stage {
  position: relative;
  background: var(--ground-2);
  margin: var(--space-4) 0 0;
}
.m-stage img { width: 100%; height: auto; max-height: 72vh; object-fit: contain; margin: 0 auto; }
.m-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ground) 85%, transparent);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  cursor: pointer;
}
.m-nav svg { stroke: var(--ink); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m-nav.prev { left: var(--space-3); }
.m-nav.next { right: var(--space-3); }
.m-counter {
  font: 500 var(--t-meta)/1 var(--sans);
  color: var(--ink-soft);
  margin: var(--space-3) 0 0;
}
.m-thumbs {
  display: flex;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.m-thumbs::-webkit-scrollbar { display: none; }
.m-thumb {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  padding: 0;
  border: 1px solid var(--hairline);
  background: var(--ground-2);
  cursor: pointer;
  overflow: hidden;
}
.m-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* active thumb: dark-mustard border (bright mustard would vanish on the light
   modal panel). 2px so the selection reads clearly. */
.m-thumb[aria-current="true"] { border-color: var(--accent-deep); border-width: 2px; }

.m-head { margin: var(--space-5) 0 0; }
.m-body {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--ink);
  max-width: var(--measure);
  margin: var(--space-4) 0 0;
}
.m-body p { margin: 0 0 var(--space-4); }
.m-body p:last-child { margin-bottom: 0; }
.m-body a { color: var(--accent-deep); text-underline-offset: 0.18em; }

/* article-led: two-column on desktop (images | measured text) */
.m-article { display: block; }
@media (min-width: 880px) {
  .m-article {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-8);
    align-items: start;
  }
  .m-article .m-head { margin-top: 0; }
}
.m-article .m-imgs img { width: 100%; height: auto; margin: 0 0 var(--tile-gap); background: var(--ground-2); }

/* buy button (§2.4) — mustard OUTLINE, quiet, price beside.
   Outline + label use dark mustard so they read on the light panel; on hover it
   fills bright mustard with ink text (white-on-mustard would fail AA). */
.m-buy {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-5) 0 0;
  flex-wrap: wrap;
}
.m-buy-btn {
  font: 500 var(--t-tag)/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  background: transparent;
  border: 1px solid var(--accent-deep);
  border-radius: 4px;
  padding: 11px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.m-buy-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.m-price { font-size: var(--t-meta); color: var(--ink-soft); }

/* =====================================================================
   MOTION (§4) — honour reduced-motion. Kill fades + hover transitions.
   ===================================================================== */
.tile, .tile-cap, .grid { transition: opacity .25s ease; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* body scroll lock while a modal is open (toggled by app.js) */
body.modal-open { overflow: hidden; }
