/* ============================================================
   Berta Landing System — shared styles for all marketing pages
   Layered on top of workbook.css (variables + fonts)
   ============================================================ */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { background: #000; overflow-x: hidden; }
body { font-family: var(--sans); color: var(--text); }

a { color: inherit; }

/* Prevent flex/grid children from forcing horizontal overflow on narrow viewports */
.m,
.nav,
.ph,
.grid-3,
.grid-2,
.grid-4,
.foot {
  min-width: 0;
}

.m {
  max-width: 1320px;
  margin: 0 auto;
  /* Safe-area: notched phones / home indicators */
  padding:
    max(32px, env(safe-area-inset-top, 0px))
    max(clamp(16px, 4vw, 48px), env(safe-area-inset-right, 0px))
    max(120px, env(safe-area-inset-bottom, 0px))
    max(clamp(16px, 4vw, 48px), env(safe-area-inset-left, 0px));
  color: var(--text);
}
.m-narrow { max-width: 960px; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px; margin-bottom: 48px;
  position: relative; z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--display); font-weight: 700;
  font-size: 18px; letter-spacing: -0.01em; color: var(--text);
  text-decoration: none;
}
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand .sub {
  font-family: var(--mono); font-weight: 400; font-size: 10px;
  letter-spacing: 0.2em; color: var(--text-3); text-transform: uppercase;
  margin-left: 2px;
}
.nav-links {
  display: flex; flex-wrap: wrap; gap: 28px; row-gap: 12px; align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-2);
}
.nav-links a { color: var(--text-2); text-decoration: none; touch-action: manipulation; }
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--gold); }
.nav-cta {
  background: var(--gold); color: var(--bg) !important;
  padding: 10px 16px; text-decoration: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 500;
  touch-action: manipulation;
}

/* Horizontal scroll for wide comparison / data tables on small screens */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
}
.table-scroll table {
  min-width: 640px;
}
.table-scroll table.compare-tbl {
  min-width: 520px;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.ph {
  border-bottom: 1px solid var(--rule-2);
  padding: 48px 0 72px;
  display: grid; grid-template-columns: 1fr 360px;
  gap: 64px; align-items: end;
}
.ph-crumb {
  display: inline-flex; gap: 10px; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 28px;
}
.ph-crumb .d { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.ph h1 {
  font-family: var(--display); font-weight: 700;
  font-size: 96px; line-height: 0.9; letter-spacing: -0.045em;
  margin: 0 0 20px;
}
.ph h1 .gold { color: var(--gold); font-style: italic; font-weight: 500; }
.ph h1 .sig  { color: var(--sig);  font-style: italic; font-weight: 500; }
.ph h1 .tech { color: var(--tech); font-style: italic; font-weight: 500; }
.ph p.lede {
  font-family: var(--sans); font-size: 18px; line-height: 1.5;
  color: var(--text-2); max-width: 620px; font-weight: 300; margin: 0;
}
.ph-side {
  border-left: 1px solid var(--rule-2); padding-left: 28px;
}
.ph-side .row { padding: 12px 0; border-bottom: 1px solid var(--rule-2); }
.ph-side .row:last-child { border-bottom: none; }
.ph-side .k {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 4px;
}
.ph-side .v {
  font-family: var(--display); font-weight: 600; font-size: 18px;
  letter-spacing: -0.01em;
}
.ph-side .v small {
  font-family: var(--sans); font-weight: 400; font-size: 12px;
  color: var(--text-2); margin-left: 6px;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.sec { padding: 96px 0 0; }
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 40px; gap: 32px;
}
.sec-head h2 {
  font-family: var(--display); font-weight: 600; font-size: 44px;
  letter-spacing: -0.025em; margin: 0; max-width: 640px; line-height: 1;
}
.sec-head h2 .gold { color: var(--gold); font-style: italic; font-weight: 500; }
.sec-head .counter {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--text-3); white-space: nowrap;
}
.sec-head .counter .gold { color: var(--gold); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary, .btn-ghost, .btn-small {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; padding: 14px 22px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; border: 0;
}
.btn-primary { background: var(--gold); color: var(--bg); touch-action: manipulation; }
.btn-primary:hover { background: #d8b656; }
.btn-ghost   { border: 1px solid var(--rule-2); color: var(--text); background: transparent; touch-action: manipulation; }
.btn-ghost:hover { border-color: var(--text); }
.btn-small   { padding: 10px 16px; font-size: 10px; }

/* ============================================================
   CARDS
   ============================================================ */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--rule-2); border: 1px solid var(--rule-2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: var(--rule-2); border: 1px solid var(--rule-2); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: var(--rule-2); border: 1px solid var(--rule-2); }

.cell {
  background: var(--bg); padding: 32px 28px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 260px; text-decoration: none; color: var(--text);
  transition: background 0.2s;
}
.cell:hover { background: var(--panel); }
.cell-top { display: flex; justify-content: space-between; align-items: center; }
.cell-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold);
}
.cell-title {
  font-family: var(--display); font-weight: 600; font-size: 22px;
  line-height: 1.1; letter-spacing: -0.015em; margin: 4px 0 0;
}
.cell-desc {
  font-family: var(--sans); font-size: 13.5px; line-height: 1.55;
  color: var(--text-2); flex: 1;
}
.cell-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; border-top: 1px solid var(--rule-2);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  color: var(--text-3);
}

/* ============================================================
   FOOTER
   ============================================================ */
.foot {
  margin-top: 120px; padding-top: 32px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px;
  border-top: 1px solid var(--rule-2);
}
.foot .brand { margin-bottom: 14px; }
.foot .tagline {
  font-family: var(--sans); font-size: 13px; color: var(--text-3);
  line-height: 1.5; max-width: 280px;
}
.foot h5 {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
  color: var(--text-3); text-transform: uppercase; margin: 0 0 14px;
  font-weight: 500;
}
.foot a {
  display: block; font-family: var(--sans); font-size: 13px;
  color: var(--text-2); text-decoration: none; padding: 4px 0;
}
.foot a:hover { color: var(--text); }
.foot-bottom {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--rule-2);
  display: flex; justify-content: space-between; gap: 32px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--text-3); text-transform: uppercase;
}

/* Trading name + legal — use below main footer blurb on all marketing pages */
.foot-trading {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  line-height: 1.65;
  max-width: 640px;
  margin: 0 0 16px;
  text-transform: none;
}
.foot-trading a {
  color: var(--text-2);
  text-decoration: none;
}
.foot-trading a:hover {
  color: var(--gold);
}

/* ============================================================
   LEGAL BLOCK — company registration, address, phone
   Rendered on every landing page, directly above foot-bottom
   ============================================================ */
.legal {
  margin-top: 48px; padding: 24px 0;
  border-top: 1px solid var(--rule-2);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--text-3); line-height: 1.7;
  display: grid; grid-template-columns: 1fr auto; gap: 32px;
  align-items: start;
}
.legal strong { color: var(--text-2); font-weight: 500; letter-spacing: 0.12em; }
.legal .tel {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--text-2); white-space: nowrap;
}
.legal .tel a { color: var(--text-2); text-decoration: none; }
.legal .tel a:hover { color: var(--gold); }

@media (max-width: 700px) {
  .legal { grid-template-columns: 1fr; }
  .foot-bottom { flex-direction: column; gap: 8px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold);
}
.rule-gold { height: 2px; background: var(--gold); border: 0; margin: 0; }
.chip {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 3px 8px;
  border: 1px solid var(--rule-2); color: var(--text-2);
}
.chip.gold { border-color: var(--gold); color: var(--gold); }
.chip.tech { border-color: var(--tech); color: var(--tech); }
.chip.sig  { border-color: var(--sig);  color: var(--sig);  }
.chip.live { border-color: #22c55e; color: #22c55e; }
.chip.warn { border-color: var(--warn); color: var(--warn); }

/* --- Mobile / tablet: nav (hamburger) — add .nav-cb + .nav-burger + .nav-links in HTML --- */
.nav-cb {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border: 1px solid var(--rule-2);
  background: var(--panel);
  padding: 0 10px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.nav-burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* Hamburger below 901px — tablets/portrait avoid cramped link rows */
@media (min-width: 901px) {
  .nav {
    align-items: center;
  }
  .nav-cb,
  .nav-burger {
    display: none !important;
  }
  .nav-links {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    width: auto !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .nav-links a {
    border: 0 !important;
    padding: 0 !important;
  }
}

@media (max-width: 900px) {
  .nav-burger {
    display: none;
  }
  .nav:has(.nav-cb) .nav-burger {
    display: flex;
    order: 2;
  }
  .nav:has(.nav-cb) {
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    row-gap: 0;
  }
  .nav:has(.nav-cb) .brand {
    flex: 1;
    min-width: 0;
  }
  .nav:has(.nav-cb) .nav-links {
    display: none;
    order: 10;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 12px 0 4px;
    margin-top: 12px;
    border-top: 1px solid var(--rule-2);
  }
  .nav:has(.nav-cb) .nav-links a {
    padding: 14px 4px;
    border-bottom: 1px solid var(--rule-2);
  }
  .nav:has(.nav-cb) .nav-links a:last-child {
    border-bottom: 0;
  }
  .nav:has(.nav-cb) .nav-cb:checked ~ .nav-links {
    display: flex;
  }
  .nav:has(.nav-cb) .nav-cta {
    text-align: center;
  }
  /* Pages not yet using hamburger: wrap links */
  .nav:not(:has(.nav-cb)) {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .nav:not(:has(.nav-cb)) .nav-links {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px 18px;
    row-gap: 12px;
  }
}

@media (max-width: 900px) {
  .ph {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-bottom: 48px;
  }
  .ph h1 {
    font-size: clamp(40px, 10vw, 64px);
  }
  .ph-side {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--rule-2);
    padding-top: 28px;
  }
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .foot {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .sec-head {
    flex-wrap: wrap;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .m {
    padding-bottom: max(80px, env(safe-area-inset-bottom, 0px));
  }
  .sec {
    padding-top: 48px;
  }
  .nav {
    margin-bottom: 28px;
    padding-bottom: 12px;
  }
  .ph {
    padding-top: 28px;
    padding-bottom: 40px;
  }
  .ph h1 {
    font-size: clamp(32px, 10vw, 52px);
    line-height: 0.95;
  }
  .ph p.lede {
    font-size: 16px;
    line-height: 1.55;
  }
  .sec-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .sec-head h2 {
    font-size: clamp(26px, 7.5vw, 40px);
    line-height: 1.05;
  }
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .foot {
    grid-template-columns: 1fr;
    margin-top: 72px;
    gap: 28px;
  }
  .foot-bottom {
    flex-wrap: wrap;
    word-break: break-word;
  }
  .foot-bottom > div {
    min-width: 0;
  }
  .foot-trading {
    font-size: 9px;
    letter-spacing: 0.04em;
  }
  .legal .tel {
    white-space: normal;
  }
  .cell {
    min-height: 0;
  }
  .btn-primary,
  .btn-ghost,
  .btn-small {
    min-height: 44px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .ph h1 {
    font-size: clamp(28px, 9vw, 44px);
  }
}
