/* APEX PC Build — shared tokens + public storefront */

/* --- Theme tokens ----------------------------------------------------
   Dark is the base, so the site still looks right if JavaScript never runs.
   Light is applied two ways, matching how the Django admin does it:
     [data-theme="light"]            an explicit choice from the toggle
     prefers-color-scheme: light     the OS preference, unless dark was chosen
   That means data-theme="auto" (the default) follows the operating system.
   The light values are spelled out twice because CSS cannot share one
   declaration block between a selector and a media query. */

:root {
  /* Shape and type, theme independent */
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Dark palette */
  color-scheme: dark;
  --bg-deep: #070a0f;
  --bg: #0a0d13;
  --bg-elev: #121822;
  --bg-elev-2: #182030;
  --line: #232c3d;
  --line-soft: #1a212e;
  --line-strong: #33455f;
  --text: #e8edf7;
  --muted: #8b97ad;
  --muted-2: #7b89a3;
  --accent: #45c8f1;
  --accent-2: #7b6cff;
  --on-accent: #08121c;
  --accent-line: rgba(69, 200, 241, 0.4);
  --accent-tint: rgba(69, 200, 241, 0.07);
  --accent-soft: rgba(69, 200, 241, 0.35);
  --focus: rgba(69, 200, 241, 0.4);
  --pos: #37d07f;
  --pos-line: rgba(55, 208, 127, 0.42);
  --pos-soft: rgba(55, 208, 127, 0.3);
  --neg: #ff6b6b;
  --neg-line: rgba(255, 107, 107, 0.42);
  --neg-soft: rgba(255, 107, 107, 0.3);
  --warn: #ffb340;
  --warn-line: rgba(255, 179, 64, 0.42);
  --header-bg: rgba(10, 13, 19, 0.9);
  --badge-bg: rgba(10, 13, 19, 0.82);
  --placeholder: #3c4a63;
  --chip-text: #b9c4d8;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #e9ecf3;
  --bg: #f7f8fc;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef1f7;
  --line: #d7dde9;
  --line-soft: #e9edf4;
  --line-strong: #aeb9cc;
  --text: #131a26;
  --muted: #5b6779;
  --muted-2: #606b7d;
  --accent: #0c7297;
  --accent-2: #5b48d6;
  --on-accent: #ffffff;
  --accent-line: rgba(13, 127, 168, 0.38);
  --accent-tint: rgba(13, 127, 168, 0.08);
  --accent-soft: rgba(13, 127, 168, 0.32);
  --focus: rgba(13, 127, 168, 0.35);
  --pos: #0f7949;
  --pos-line: rgba(16, 128, 77, 0.38);
  --pos-soft: rgba(16, 128, 77, 0.28);
  --neg: #c02b2b;
  --neg-line: rgba(192, 43, 43, 0.34);
  --neg-soft: rgba(192, 43, 43, 0.26);
  --warn: #945e0a;
  --warn-line: rgba(150, 96, 10, 0.38);
  --header-bg: rgba(247, 248, 252, 0.9);
  --badge-bg: rgba(255, 255, 255, 0.88);
  --placeholder: #aab4c6;
  --chip-text: #3f4b60;
  --shadow: 0 8px 24px rgba(20, 30, 50, 0.09);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-deep: #e9ecf3;
    --bg: #f7f8fc;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef1f7;
    --line: #d7dde9;
    --line-soft: #e9edf4;
    --line-strong: #aeb9cc;
    --text: #131a26;
    --muted: #5b6779;
    --muted-2: #606b7d;
    --accent: #0c7297;
    --accent-2: #5b48d6;
    --on-accent: #ffffff;
    --accent-line: rgba(13, 127, 168, 0.38);
    --accent-tint: rgba(13, 127, 168, 0.08);
    --accent-soft: rgba(13, 127, 168, 0.32);
    --focus: rgba(13, 127, 168, 0.35);
    --pos: #0f7949;
    --pos-line: rgba(16, 128, 77, 0.38);
    --pos-soft: rgba(16, 128, 77, 0.28);
    --neg: #c02b2b;
    --neg-line: rgba(192, 43, 43, 0.34);
    --neg-soft: rgba(192, 43, 43, 0.26);
    --warn: #945e0a;
    --warn-line: rgba(150, 96, 10, 0.38);
    --header-bg: rgba(247, 248, 252, 0.9);
    --badge-bg: rgba(255, 255, 255, 0.88);
    --placeholder: #aab4c6;
    --chip-text: #3f4b60;
    --shadow: 0 8px 24px rgba(20, 30, 50, 0.09);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }

/* --- Header ---------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
/* The logo is a shield crest cut out on transparency, so it gets no frame.
   drop-shadow follows the artwork's real silhouette (box-shadow would draw a
   rectangle around it), giving the crest a faint edge-light on dark headers and
   a little depth on light ones. */
.brand-badge {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px;
  transition: transform 0.25s ease;
}
.brand-logo {
  height: 42px; width: auto; max-width: 44px;
  object-fit: contain; display: block;
  filter: drop-shadow(0 0 9px var(--accent-soft)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transition: filter 0.25s ease;
}
.brand:hover .brand-badge { transform: translateY(-1px) scale(1.05); }
.brand:hover .brand-logo {
  filter: drop-shadow(0 0 15px var(--accent)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

/* Two-line wordmark: the name over a letterspaced descender line. Both halves
   come from SITE_NAME, split on the first space by the context processor. */
.brand-word { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.brand-word .lead { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-word .sub {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.22em; color: var(--accent);
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 800; color: var(--on-accent);
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; font-size: 0.92rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav .staff-link {
  border: 1px solid var(--line);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  color: var(--accent);
}

/* Condition of a single component, on the spec sheet. New parts earn a tint;
   everything else stays quiet so the table does not turn into a traffic light. */
.cond {
  display: inline-block; margin-left: 0.45rem;
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 0.1rem 0.42rem; border-radius: 999px; vertical-align: 1px;
  border: 1px solid var(--line); color: var(--muted);
}
.cond.new { color: var(--pos); border-color: var(--pos-line); }
.cond.refurb, .cond.open_box { color: var(--accent); border-color: var(--accent-line); }
.cond.faulty { color: var(--neg); border-color: var(--neg-line); }

/* --- Theme switch ---------------------------------------------------- */

.theme-toggle {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-elev-2); color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-toggle svg {
  width: 16px; height: 16px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
/* The icon shows the theme you are in: moon in the dark, sun in the light. */
.theme-toggle .icon-light { display: none; }
:root[data-theme="light"] .theme-toggle .icon-light { display: block; }
:root[data-theme="light"] .theme-toggle .icon-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-light { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-dark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-badge, .brand:hover .brand-badge { transition: none; transform: none; }
  .brand-logo { transition: none; }
}

/* --- Hero ------------------------------------------------------------ */

.hero {
  padding: 3.2rem 0 2rem;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 3rem;
  /* The medallion's bloom is drawn outside its box and would otherwise widen
     the page by ~27px at desktop widths. `clip` stops that without making this
     a scroll container the way `hidden` would. */
  overflow-x: clip;
}
.hero-copy { min-width: 0; }
/* A large, crisp medallion rather than a washed-out watermark: the logo is the
   full stop at the end of the headline, not wallpaper behind it. */
.hero-badge { position: relative; flex: none; display: grid; place-items: center; }
/* A diffuse bloom behind the crest, so it reads as lit rather than pasted on. */
.hero-badge::before {
  content: ""; position: absolute; inset: -22%;
  border-radius: 50%; background: radial-gradient(circle, var(--accent-tint), transparent 68%);
}
.hero-badge img {
  position: relative; height: 210px; width: auto; max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 36px var(--accent-soft)) drop-shadow(0 16px 28px rgba(0, 0, 0, 0.45));
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 0; }
  .hero-badge { display: none; }
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  line-height: 1.1;
  margin: 0 0 0.7rem;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); max-width: 60ch; font-size: 1.02rem; margin: 0; }
.hero-stats { display: flex; gap: 2rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-stats div { font-size: 0.85rem; color: var(--muted); }
.hero-stats b { display: block; font-size: 1.4rem; color: var(--text); font-weight: 700; }

/* --- Filter bar ------------------------------------------------------ */

.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  padding: 0.85rem; margin: 1.5rem 0 2rem;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters input[type="search"], .filters select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem; font: inherit; font-size: 0.9rem;
}
.filters input[type="search"] { flex: 1 1 220px; }
.filters label { font-size: 0.85rem; color: var(--muted); }

.btn {
  display: inline-block; font: inherit; font-size: 0.9rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  padding: 0.5rem 0.95rem; border-radius: var(--radius-sm); cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent); border: 0; font-weight: 700;
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-lg { padding: 0.7rem 1.3rem; font-size: 1rem; }

/* --- Build grid ------------------------------------------------------ */

.grid {
  display: grid; gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  padding-bottom: 3rem;
}
.card {
  position: relative;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}
/* The photo leads the card, so it gets the lift on hover too. */
.card:hover .card-media img { transform: scale(1.04); }
/* Square tiles. Photos of a tower are portrait (20 of the 24 imported so far,
   median exactly 3:4), so `cover` trims about an eighth off the top and bottom
   to fill the square. That is a fraction of what the old 4:3 frame cut, and the
   whole photo is still there on the listing page, where the gallery uses
   `contain` and crops nothing. */
.card-media {
  aspect-ratio: 1 / 1; background: var(--bg-elev-2);
  position: relative; overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* Cases stand in the middle of the shot, so trim evenly from both ends. */
  object-position: center;
  transition: transform 0.4s ease;
}
.card-media .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--placeholder); font-size: 2.4rem; font-weight: 800; letter-spacing: 0.1em;
}
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.card-body h3 a { color: var(--text); }
.card-head { color: var(--muted); font-size: 0.88rem; margin: 0; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.15rem; }
.chip {
  font-family: var(--mono); font-size: 0.72rem;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  color: var(--chip-text); padding: 0.2rem 0.45rem; border-radius: 6px;
  /* Spec lines copied from a listing can be very long. Clip them so one wordy
     part does not make its card twice the height of the others. */
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-foot {
  margin-top: auto; padding-top: 0.7rem;
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
}
/* Price is the thing a buyer scans for, so it gets the accent colour and the
   most weight on the card. A discount shows what it was, struck through. */
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.45rem; }
.price .now {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em;
  color: var(--accent); line-height: 1.1;
}
.price .was {
  font-size: 0.95rem; font-weight: 600; color: var(--muted);
  text-decoration: line-through; text-decoration-thickness: 1.5px;
}
.price .save {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pos); border: 1px solid var(--pos-line);
  padding: 0.12rem 0.4rem; border-radius: 999px;
}
.price small {
  flex-basis: 100%;
  font-size: 0.72rem; color: var(--muted); font-weight: 500;
}

/* The corner flash. Opposite the status badge so the two never collide. */
.flash {
  position: absolute; top: 0.7rem; right: 0.7rem;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem; border-radius: 999px;
  background: var(--pos); color: var(--on-accent);
  box-shadow: 0 4px 12px -4px var(--pos);
}

/* On sale, the price takes the positive colour — the same green as the flash
   and as the detail page, so the three read as one signal. */
.card.on-sale { border-color: var(--pos-line); }
.card.on-sale:hover { border-color: var(--pos); }
.card.on-sale .price .now { color: var(--pos); }

@media (prefers-reduced-motion: reduce) {
  .card, .card-media img { transition: none; }
  .card:hover { transform: none; }
  .card:hover .card-media img { transform: none; }
}

.badge {
  position: absolute; top: 0.7rem; left: 0.7rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem; border-radius: 999px;
  background: var(--badge-bg); border: 1px solid var(--line); color: var(--text);
  backdrop-filter: blur(4px);
}
.badge.for_sale { color: var(--pos); border-color: var(--pos-line); }
.badge.reserved { color: var(--warn); border-color: var(--warn-line); }
.badge.sold { color: var(--muted); }

.empty {
  padding: 3rem 1rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 3rem;
}

/* --- Detail page ----------------------------------------------------- */

.detail { display: grid; gap: 2.2rem; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); padding: 2rem 0 3rem; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }

.crumbs { color: var(--muted); font-size: 0.85rem; padding-top: 1.2rem; }
.detail h1 { font-size: clamp(1.5rem, 3.5vw, 2.15rem); margin: 0.5rem 0 0.4rem; letter-spacing: -0.02em; }
.detail .lede { color: var(--muted); margin: 0 0 1.3rem; font-size: 1.02rem; }

.gallery { display: grid; gap: 0.6rem; }

/* A fixed frame, because listing photos arrive in wildly different shapes —
   portrait phone shots next to landscape ones. `contain` letterboxes them
   instead of cropping, and the page never jumps as you flick through. */
.gallery .frame {
  /* Same reasoning as the cards, but capped: at full column width a 3:4 frame
     would be taller than most screens. */
  position: relative; aspect-ratio: 4 / 5; max-height: 640px; overflow: hidden;
  background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.gallery .frame img {
  position: absolute; inset: 0; display: none;
  width: 100%; height: 100%; object-fit: contain;
}
.gallery .frame img.is-active { display: block; }

.gallery .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--badge-bg); color: var(--text);
  cursor: pointer; opacity: 0.75; transition: opacity 0.15s ease, border-color 0.15s ease;
}
.gallery .nav:hover { opacity: 1; border-color: var(--accent); }
.gallery .nav:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; opacity: 1; }
.gallery .nav.prev { left: 0.7rem; }
.gallery .nav.next { right: 0.7rem; }
.gallery .nav svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.gallery .thumbs { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.gallery .thumb {
  display: block; line-height: 0; border-radius: var(--radius-sm);
  border: 1px solid var(--line); overflow: hidden; cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.15s ease;
  opacity: 0.65;
}
.gallery .thumb:hover { opacity: 1; border-color: var(--line-strong); }
.gallery .thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery .thumb.is-active { opacity: 1; border-color: var(--accent); }
.gallery .thumb img {
  width: 88px; height: 66px; object-fit: cover; display: block;
  background: var(--bg-elev-2);
}

@media (prefers-reduced-motion: reduce) {
  .gallery .nav, .gallery .thumb { transition: none; }
}

@media (max-width: 520px) {
  .gallery .thumb img { width: 68px; height: 52px; }
}
.gallery .no-photo {
  aspect-ratio: 4 / 5; max-height: 640px; border: 1px dashed var(--line); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--placeholder); font-weight: 700; letter-spacing: 0.1em;
}

.panel {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.3rem;
}
.panel h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin: 0 0 0.9rem; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.spec-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 0.82rem;
  padding: 0.55rem 1rem 0.55rem 0; vertical-align: top; white-space: nowrap; width: 1%;
}
.spec-table td { padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); }
.spec-table tr:last-child td, .spec-table tr:last-child th { border-bottom: 0; }
.spec-table .sub { display: block; color: var(--muted); font-size: 0.82rem; font-family: var(--mono); }

.prose p { margin: 0 0 0.9rem; }
.prose p:last-child { margin-bottom: 0; }

.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.ticks li { padding-left: 1.4rem; position: relative; font-size: 0.92rem; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--pos); font-weight: 700; }

.buy-box { position: sticky; top: 5rem; }
.buy-box .amount {
  font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  color: var(--accent);
}
.buy-box .amount.discounted { color: var(--pos); }
.buy-box .sale-line {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem;
}
.buy-box .sale-line .off {
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: var(--pos); color: var(--on-accent);
}
.buy-box .sale-line .was {
  font-size: 1rem; font-weight: 600; color: var(--muted);
  text-decoration: line-through; text-decoration-thickness: 1.5px;
}
.buy-box .saving { margin: 0.25rem 0 0; font-size: 0.85rem; font-weight: 600; color: var(--pos); }
.buy-box .meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.buy-box .sold-note { color: var(--warn); font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; font-size: 0.9rem; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }

/* --- Forms ----------------------------------------------------------- */

form.stack { display: grid; gap: 0.7rem; }
form.stack label { font-size: 0.82rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
form.stack input, form.stack textarea, form.stack select {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem; font: inherit; font-size: 0.92rem;
}
form.stack input:focus, form.stack textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
form.stack .errorlist { color: var(--neg); font-size: 0.82rem; list-style: none; padding: 0; margin: 0.2rem 0 0; }
form.stack .helptext { color: var(--muted); font-size: 0.78rem; }

.messages { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.5rem; }
.messages li {
  padding: 0.7rem 1rem; border-radius: var(--radius-sm); font-size: 0.92rem;
  border: 1px solid var(--line); background: var(--bg-elev);
}
.messages li.success { border-color: var(--pos-line); color: var(--pos); }
.messages li.error { border-color: var(--neg-line); color: var(--neg); }

/* --- Footer ---------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line); margin-top: 2rem; padding: 2rem 0 3rem;
  color: var(--muted); font-size: 0.88rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }

.section-title { font-size: 1.15rem; margin: 2.5rem 0 1rem; }

/* --- The shopfront on a phone ---------------------------------------- */
/*
   At 375px the brand lockup plus the nav is wider than the content column, so
   the header is allowed to wrap onto a second line rather than push the page
   sideways. Tap targets go to 44px, which is the smallest a thumb reliably hits.
*/

@media (max-width: 600px) {
  .site-header .wrap { flex-wrap: wrap; gap: 0.5rem 0.9rem; padding: 0.7rem 0; }
  .site-nav { margin-left: auto; gap: 0.9rem; }
  .site-nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-nav .staff-link { min-height: 36px; }

  .brand-word .lead { font-size: 1rem; }
  .brand-word .sub { font-size: 0.55rem; letter-spacing: 0.18em; }

  .crumbs a, .site-footer a { display: inline-flex; align-items: center; min-height: 40px; }

  .hero { padding: 2rem 0 1.4rem; }
  .hero-stats { gap: 1.4rem; }

  /* Filters stack rather than squeezing four controls onto one line. */
  .filters { gap: 0.5rem; }
  .filters input[type="search"], .filters select, .filters .btn { width: 100%; min-height: 44px; }
}

/* --- Facebook Marketplace link --------------------------------------- */
/*
   Used twice: as a button under the hero, and as a plain link in the footer.
   The `.btn` classes do the heavy lifting on the hero; these rules only handle
   the mark and the spacing.
*/

.fb-link { display: inline-flex; align-items: center; gap: 0.5rem; }
.fb-link svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* The hero button. Marketplace is where the sales actually happen, so it gets
   real prominence rather than being buried in the footer. */
.hero .fb-link {
  margin-top: 1.4rem;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--line-strong);
}
.hero .fb-link:hover {
  border-color: var(--accent); color: var(--accent);
  text-decoration: none;
}
.hero .fb-link svg { width: 20px; height: 20px; }

/* The footer copy. */
.site-footer .fb-link { margin-top: 0.15rem; font-size: 0.9rem; }

/* --- Custom build request -------------------------------------------- */

.request-hero { grid-template-columns: 1fr; padding-bottom: 1rem; }
.request-hero .hero-copy { max-width: 62ch; }

.request-layout {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.3rem; align-items: start; padding-bottom: 3rem;
}
@media (max-width: 860px) { .request-layout { grid-template-columns: 1fr; } }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* A currency mark tucked inside the budget field. */
.prefixed { position: relative; }
.prefixed i {
  position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
  font-style: normal; color: var(--muted);
}
.prefixed input { padding-left: 1.7rem !important; }

/* Also defined in manage.css, but the public pages do not load that file. */
.hint { color: var(--muted); font-size: 0.82rem; margin: 0.3rem 0 0; }

.steps { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.6rem; font-size: 0.92rem; }
.steps li { color: var(--muted); }
.steps b { color: var(--text); font-weight: 600; }

ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
ul.plain li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.92rem; }
ul.plain .dim { color: var(--muted); }
