/* ============================================================
   GES LABS BFN — design system (light theme)
   Colour scheme taken from the company logo: red + silver/grey
   on white, with near-black text.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --red:        #D01820;   /* brand primary (logo) */
  --red-dark:   #A9131A;   /* hover / pressed */
  --red-tint:   #FBEAEB;   /* pale red wash */
  --ink:        #1C1E22;   /* primary text */
  --ink-soft:   #474C54;   /* secondary text */
  --muted:      #767C86;   /* tertiary / mono labels */
  --line:       #E2E4E8;   /* hairline borders */
  --line-strong:#CFD3D9;
  --surface:    #FFFFFF;   /* cards / panels */
  --bg:         #F4F5F7;   /* page background */
  --bg-alt:     #ECEEF1;   /* alternating sections */
  --silver:     #AEB4BC;   /* logo silver */
  --silver-lt:  #D6D9DE;

  --ok:   #1E874B;   /* available */
  --warn: #B26A00;   /* reserved */
  --off:  #8A9099;   /* sold */

  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --measure: 68ch;
  --radius: 3px;
  --shadow-sm: 0 1px 2px rgba(28,30,34,0.05), 0 1px 3px rgba(28,30,34,0.06);
  --shadow-md: 0 4px 14px rgba(28,30,34,0.08), 0 2px 6px rgba(28,30,34,0.05);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* The [hidden] attribute must always win, even over a class that sets its
   own `display` (e.g. .admin-login { display: grid }) — otherwise toggling
   `.hidden = true/false` in JS silently stops working. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

a { color: inherit; }

section p a,
.page-head p a { color: var(--red); text-decoration: none; }
section p a:hover,
.page-head p a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}

p { max-width: var(--measure); color: var(--ink-soft); }

.mono { font-family: var(--font-mono); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------- layout shell ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 20px; } }

/* ---------- nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand img { height: 40px; width: auto; display: block; }

.brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  color: var(--red);
}
.brand .brand-text small {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}
/* legacy fallback dot — unused in light theme */
.brand .dot { display: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  border-radius: var(--radius);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-alt); }
.nav-links a.current { color: var(--ink); position: relative; }
.nav-links a.current::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  background: var(--red);
}

.nav-links a.tracker-link {
  border: 1px solid var(--red);
  color: var(--red);
  font-weight: 500;
}
.nav-links a.tracker-link:hover { background: var(--red); color: #fff; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 70px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
}

/* ---------- panel / bracketed frame ---------- */

.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.bracket { position: relative; padding: 30px; }
.bracket .bc-tl, .bracket .bc-tr, .bracket .bc-bl, .bracket .bc-br {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--red);
  opacity: 0.7;
}
.bracket .bc-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.bracket .bc-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.bracket .bc-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.bracket .bc-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.94rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--red-dark); }

.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }

.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- hero ---------- */

.hero {
  padding: 80px 0 72px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: #f4f5f7 url("img/hero-bg.svg") center / cover no-repeat;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(244,245,247,0.94) 0%, rgba(244,245,247,0.62) 38%, rgba(244,245,247,0.05) 78%, rgba(244,245,247,0) 100%),
    linear-gradient(180deg, rgba(244,245,247,0) 0%, rgba(244,245,247,0) 70%, var(--bg) 100%);
}

.hero-logo {
  display: block;
  height: clamp(96px, 15vw, 150px);
  width: auto;
  margin-bottom: 26px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  max-width: 16ch;
  color: var(--ink);
}
.hero h1 .accent { color: var(--red); }

.hero p.lead {
  font-size: 1.15rem;
  max-width: 52ch;
  margin-top: 18px;
  color: var(--ink-soft);
}

.hero-actions { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }

.readout-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 60px;
  box-shadow: var(--shadow-sm);
}

.readout-cell { background: var(--surface); padding: 20px 22px; }
.readout-cell .val { font-family: var(--font-mono); font-size: 1.55rem; color: var(--red); font-weight: 500; }
.readout-cell .lbl { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

@media (max-width: 640px) {
  .readout-row { grid-template-columns: 1fr; }
  .hero { padding-top: 52px; }
  .hero-logo { height: clamp(78px, 22vw, 104px); margin-bottom: 20px; }
  .hero-eyebrow { font-size: 0.68rem; letter-spacing: 0; overflow-wrap: break-word; }
}

/* ---------- sections ---------- */

section { padding: 76px 0; }
section#about { background: var(--surface); border-bottom: 1px solid var(--line); }
section#workflow { background: var(--bg); }

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--red);
  white-space: nowrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }

.two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: start;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.cap-list { list-style: none; margin: 0; padding: 0; }
.cap-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.cap-list li:last-child { border-bottom: none; }
.cap-list .cap-name { color: var(--ink); }
.cap-list .cap-code { font-family: var(--font-mono); color: var(--muted); font-size: 0.85rem; }

/* ---------- workflow ---------- */

.workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
@media (max-width: 900px) { .workflow { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .workflow { grid-template-columns: 1fr; } }

.wf-step { border-top: 3px solid var(--red); padding-top: 16px; }
.wf-step .wf-num { font-family: var(--font-mono); color: var(--red); font-size: 0.85rem; font-weight: 500; }
.wf-step h3 { font-size: 1.05rem; margin-top: 10px; }
.wf-step p { font-size: 0.92rem; }

/* ---------- listings ---------- */

.search-input {
  display: block;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  border-radius: var(--radius);
  margin-bottom: 18px;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--red); }
/* remove the native magnifier/clear-x chrome so it matches our other inputs */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }

.filter-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.filter-pill:hover { border-color: var(--silver); }
.filter-pill.active { border-color: var(--red); color: var(--red); background: var(--red-tint); }

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.listing-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.listing-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.listing-media {
  aspect-ratio: 4/3;
  background: var(--bg-alt);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.listing-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-media .placeholder-icon { color: var(--silver); opacity: 0.8; }

.status-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  border: 1px solid currentColor;
}
.status-available { color: var(--ok); }
.status-reserved  { color: var(--warn); }
.status-sold      { color: var(--off); }

.listing-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.listing-title {
  display: block;
  font-family: var(--font-head);
  font-size: 1.02rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.listing-title:hover { color: var(--red); }
.listing-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted);
}
.listing-desc { font-size: 0.88rem; color: var(--ink-soft); flex: 1; }
.listing-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.listing-price { font-family: var(--font-mono); font-size: 1.1rem; color: var(--red); font-weight: 500; }
.listing-sold-note { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

.gallery-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-block;
}
.gallery-thumb:hover { border-color: var(--red); }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 500; }

.field input,
.field select,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-radius: var(--radius);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { resize: vertical; min-height: 110px; }

.file-drop {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  background: var(--bg);
}
.file-drop:hover { border-color: var(--red); color: var(--ink-soft); }

.form-note { font-size: 0.82rem; color: var(--muted); margin-top: 14px; }

.form-status {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 12px 14px;
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  background: #ecf6f0;
  color: #14663a;
  display: none;
}
.form-status.visible { display: block; }
.form-status.error { border-color: var(--red); background: var(--red-tint); color: var(--red-dark); }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 56px 0 40px;
  margin-top: 40px;
}

.footer-brand img { height: 46px; width: auto; margin-bottom: 16px; display: block; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }

.footer-grid h4 {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 14px 0;
  font-weight: 400;
}
.footer-grid p, .footer-grid a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.8;
}
.footer-grid a:hover { color: var(--red); }

.footer-bottom {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- page hero (secondary pages) ---------- */

.page-head {
  padding: 56px 0 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.page-head .hero-eyebrow { margin-bottom: 14px; color: var(--red); }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: none; }
.page-head p { margin-top: 14px; }

/* ---------- inline status badge (order lookup) ---------- */

.badge-inline {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.badge-inline.status-awaiting_payment { color: var(--warn); }
.badge-inline.status-pop_received { color: var(--red); }
.badge-inline.status-confirmed { color: var(--ok); }
.badge-inline.status-cancelled { color: var(--off); }

/* ---------- map embed ---------- */

.map-embed {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 0;
}
.map-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ---------- honeypot ---------- */

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- buy dialog ---------- */

.buy-dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 440px;
  width: 92vw;
  box-shadow: var(--shadow-md);
}
.buy-dialog::backdrop { background: rgba(28, 30, 34, 0.45); backdrop-filter: blur(2px); }
.buy-dialog h3 { font-size: 1.15rem; margin-bottom: 4px; }
.buy-dialog .buy-sub { font-family: var(--font-mono); color: var(--red); font-size: 0.9rem; margin: 0 0 18px; }
.buy-dialog .field { margin-bottom: 12px; }
.buy-dialog .buy-note { font-size: 0.82rem; color: var(--muted); margin: 14px 0 0; max-width: none; }
.buy-dialog .buy-note a { color: var(--red); text-decoration: none; }
.buy-dialog .buy-note a:hover { text-decoration: underline; }
.buy-dialog .form-status { margin-top: 12px; }
.buy-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 480px) {
  .buy-actions { flex-direction: column-reverse; }
  .buy-actions .btn { width: 100%; justify-content: center; }
}
