/* ============================================================
   Brabble Trading Corporation — codex design system
   Black carries structure, typography drives hierarchy.
   Mobile-first; scales up at 640 / 900px.
   ============================================================ */

:root {
  /* codex color tokens */
  --primary:   #000000;
  --secondary: #FFFFFF;
  --surface:   #FFFFFF;
  --text:      #111827;
  --success:   #16A34A;
  --warning:   #D97706;
  --danger:    #DC2626;

  /* derived neutrals */
  --muted:     #6B7280;
  --line:      #E5E7EB;
  --alt-bg:    #FAFAFA;

  /* codex spacing scale 4/8/12/16/24/32 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;

  /* codex radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  /* fonts */
  --sans: "Open Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --maxw: 1080px;
  --pad: var(--s-4);          /* horizontal gutter (mobile) */
}

@media (min-width: 640px) { :root { --pad: var(--s-6); } }

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- mono label utility (codex label-caps) ---------- */
.eyebrow, .kicker, .nav__links a, .product__status,
.foot__meta, .card__num, .product__link {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============================ NAV ============================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--pad);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav__brand { display: flex; align-items: center; gap: var(--s-2); }
.brand__logo { display: block; width: 30px; height: 30px; border-radius: 7px; }
.brand__mark { color: var(--primary); font-size: 0.9rem; line-height: 1; }
.brand__name { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; }

.nav__links { display: flex; gap: var(--s-6); }
.nav__links a { color: var(--muted); transition: color 0.15s; }
.nav__links a:hover { color: var(--primary); }

/* hamburger (hidden on desktop) */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 9px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--primary);
  transition: transform 0.2s, opacity 0.2s;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================ LAYOUT ======================== */
section { width: 100%; }

.hero, .band {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px var(--pad);
}
@media (min-width: 900px) { .hero, .band { padding: 96px var(--pad); } }

.band--alt { max-width: none; background: var(--alt-bg); border-block: 1px solid var(--line); }
.band--alt > * { max-width: var(--maxw); margin-inline: auto; }

.band--cta { text-align: center; }
.band--cta .band__title,
.band--cta .band__lede { margin-inline: auto; }

/* ============================ HERO ========================== */
.eyebrow { color: var(--muted); display: block; margin-bottom: var(--s-6); }

.hero__title {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.07;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-6);
}

.accent { color: var(--success); }

.hero__lede {
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: var(--s-8);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: 48px; }

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  padding-top: var(--s-8);
  border-top: 1px solid var(--line);
}
.hero__stats dt { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.hero__stats dd { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ============================ BUTTONS ======================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-md);
  border: 1px solid var(--primary);
  transition: transform 0.12s, background 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--primary); color: var(--secondary); }
.btn--solid:hover { background: #1f2937; }
.btn--ghost { background: transparent; color: var(--primary); }
.btn--ghost:hover { background: var(--primary); color: var(--secondary); }
.btn--lg { font-size: 1.05rem; padding: var(--s-4) var(--s-8); font-family: var(--mono); }

@media (max-width: 480px) {
  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { width: 100%; }
}

/* ============================ BANDS ========================= */
.kicker { color: var(--muted); display: block; margin-bottom: var(--s-4); }

.band__title {
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-bottom: var(--s-6);
  max-width: 22ch;
}

.band__lede { font-size: clamp(1.05rem, 2vw, 1.15rem); color: var(--muted); max-width: 62ch; margin-bottom: var(--s-8); }

.prose { font-size: 1.05rem; color: #374151; }

/* ============================ GRIDS ========================= */
.grid { display: grid; gap: var(--s-6); }

@media (min-width: 640px) {
  .grid { gap: var(--s-8); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-6);
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card__num { color: var(--muted); display: block; margin-bottom: var(--s-4); }
.card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: var(--s-3); letter-spacing: -0.01em; }
.card p { color: var(--muted); font-size: 0.98rem; }

/* ============================ TIMELINE ====================== */
.timeline {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
  margin-top: var(--s-4);
}
.tl { position: relative; }
.tl__node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.45);
}
.tl__node svg { display: block; }
.tl__step {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: var(--s-4) 0 var(--s-1);
}
.tl__title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.tl__desc { color: var(--muted); font-size: 0.95rem; max-width: 30ch; }

/* mobile: vertical timeline with connector on the left */
@media (max-width: 759px) {
  .tl { padding-left: 68px; min-height: 48px; }
  .tl__node { position: absolute; left: 0; top: 0; }
  .tl__step { margin-top: 0; }
  .tl:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 52px;
    height: calc(100% - 52px + var(--s-6));
    width: 2px;
    background: var(--line);
  }
}

/* desktop: horizontal timeline with connector between nodes */
@media (min-width: 760px) {
  .timeline { grid-template-columns: repeat(3, 1fr); gap: var(--s-8); margin-top: var(--s-8); }
  .tl:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 23px;
    left: 56px;
    width: calc(100% - 56px + var(--s-8));
    height: 2px;
    background: var(--line);
    z-index: 0;
  }
}

/* ============================ PRODUCTS ====================== */
.products { display: grid; gap: var(--s-6); grid-template-columns: 1fr; }

@media (min-width: 640px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .products { grid-template-columns: repeat(3, 1fr); } }

.product {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.product:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.25);
}

/* browser-frame preview */
.product__frame { background: var(--alt-bg); border-bottom: 1px solid var(--line); }
.product__bar {
  display: flex;
  gap: 6px;
  padding: 10px var(--s-3);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.product__bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line);
}
.product__shot {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top left;
  transition: transform 0.4s ease;
}
.product:hover .product__shot { transform: scale(1.03); }

/* logo-panel variant (e.g. login-walled products) */
.logo-panel {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  background: linear-gradient(160deg, #F4F8FF 0%, #E7EEFB 100%);
}
.logo-panel__mark {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #2563EB;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.55);
  transition: transform 0.3s ease;
}
.logo-panel__mark svg { display: block; }
.product:hover .logo-panel__mark { transform: translateY(-3px); }
.logo-panel__name { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }

/* real-logo image variant */
.logo-panel--img { padding: var(--s-6); }
.logo-panel__img {
  max-width: 84%;
  max-height: 80%;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.product:hover .logo-panel__img { transform: translateY(-3px) scale(1.02); }

/* brand backgrounds (real logos are transparent) */
.logo-panel--vdeal { background: linear-gradient(160deg, #FFF7ED 0%, #FDE7CF 100%); padding: 0; }
/* vDeal icon ships with wide transparent margins — let it fill the frame */
.logo-panel--vdeal .logo-panel__img { max-width: 100%; max-height: 100%; }
.logo-panel--treecodex { background: linear-gradient(160deg, #F0FBF2 0%, #DCF3E2 100%); }
.logo-panel__sub {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* lock badge on a gated card */
.product__frame { position: relative; }
.product__lock {
  position: absolute;
  top: calc(var(--s-3) + 32px);
  right: var(--s-3);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px var(--s-2);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  backdrop-filter: blur(4px);
}
.product__lock svg { display: block; }

/* ============================ EMAIL GATE ==================== */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}
.gate.is-open { visibility: visible; opacity: 1; }

.gate__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(3px);
}

.gate__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s;
}
.gate.is-open .gate__dialog { transform: none; }

.gate__close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 32px;
  height: 32px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.gate__close:hover { color: var(--primary); background: var(--alt-bg); }

.gate__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--s-4);
  border-radius: 14px;
  background: #2563EB;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 10px 24px -8px rgba(37, 99, 235, 0.55);
}
.gate__title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: var(--s-2); }
.gate__lede { color: var(--muted); font-size: 0.95rem; margin-bottom: var(--s-6); }

.gate__form { display: flex; flex-direction: column; gap: var(--s-3); }
.gate__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
}
.gate__input:focus { outline: none; border-color: var(--primary); }
.gate__input[aria-invalid="true"] { border-color: var(--danger); }
.gate__form .btn { width: 100%; }
.gate__fine { color: var(--muted); font-size: 0.78rem; margin-top: var(--s-4); }

.product__body { display: flex; flex-direction: column; flex: 1; padding: var(--s-6); }
.product__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.product__name { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }

.product__status {
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: var(--r-sm);
  padding: 2px var(--s-2);
  font-size: 0.62rem;
  white-space: nowrap;
}
.product__status--pending { color: var(--warning); border-color: var(--warning); }

.product__desc { color: var(--muted); font-size: 0.96rem; flex: 1; margin-bottom: var(--s-4); }
.product__link { color: var(--primary); }

/* ============================ FOOTER ======================== */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-8) var(--pad) 56px;
  border-top: 1px solid var(--line);
}
.foot__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.foot__row--small { margin-top: var(--s-6); padding-top: var(--s-6); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.foot__meta { color: var(--muted); }

/* ============================ MOBILE NAV ==================== */
@media (max-width: 760px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px -16px rgba(0, 0, 0, 0.3);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav__links.is-open { max-height: 240px; }
  .nav__links a {
    padding: var(--s-4) var(--pad);
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
  }
}

/* ============================ MOTION ======================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
