/* =====================================================================
   Gorilla Vapes Intelligence — branded styles
   Brand source of truth: /brand-guidelines.html
   Mirrors the retail storefront: stencil PNG wordmark, Oswald headings,
   Inter body, black + signature red (#ff0541) on white.
   ===================================================================== */

:root {
  /* Brand */
  --gv-red: #ff0541;
  --gv-red-hover: #d3003f;
  --gv-black: #000000;
  --gv-white: #ffffff;
  --gv-off-white: #f7f8f8;
  --gv-border: #e6e8e9;
  --gv-tertiary-bg: #f2f3f4;
  --gv-secondary-text: #67737c;
  --gv-dark-surface: #202020;
  --gv-accent-gradient: linear-gradient(105deg, rgba(71, 29, 29, 1), rgba(211, 0, 63, 1) 100%);

  /* Functional status colors */
  --status-ok: #1a8870;
  --status-warn: #b8741f;
  --status-danger: #c0102d;
  --status-pending: #2256a3;

  /* Spacing & radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  /* Typography */
  --font-head: "Oswald", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--gv-off-white);
  color: var(--gv-black);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--gv-red);
  text-decoration: none;
  font-weight: 600;
}
a:hover { text-decoration: underline; }

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--gv-off-white);
  border: 1px solid var(--gv-border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--gv-black);
}
pre {
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar — white, mirroring the storefront header */
.sidebar {
  background: var(--gv-white);
  color: var(--gv-black);
  border-right: 1px solid var(--gv-border);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-mark {
  display: block;
  margin-bottom: 8px;
}
.brand-mark img {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
}

.brand-sub {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gv-secondary-text);
  margin: 4px 0 28px;
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  color: var(--gv-black);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
}
.nav a:hover {
  background: var(--gv-off-white);
  text-decoration: none;
}
.nav a.active {
  color: var(--gv-black);
  background: rgba(255, 5, 65, 0.08);
  border-left-color: var(--gv-red);
}

.nav-section {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gv-secondary-text);
  padding: 18px 12px 6px;
}

.main {
  padding: 40px 48px 80px;
  max-width: 1180px;
  background: var(--gv-off-white);
  min-width: 0;
  overflow-x: hidden;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--gv-black);
  margin: 0 0 8px;
}
h1 { font-size: 36px; letter-spacing: -0.02em; }
h2 {
  font-size: 22px;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gv-black);
  display: inline-block;
}
h3 { font-size: 16px; margin: 22px 0 10px; }

.subtitle {
  font-family: var(--font-body);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gv-secondary-text);
  font-size: 15px;
  margin: 0 0 32px;
  max-width: 720px;
}

/* ---------- Banner ---------- */

.banner {
  background: var(--gv-accent-gradient);
  color: var(--gv-white);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.banner h1 { color: var(--gv-white); margin: 0; }
.banner p { margin: 8px 0 0; color: rgba(255, 255, 255, 0.85); font-weight: 500; }
.banner::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

/* ---------- Cards ---------- */

.card {
  background: var(--gv-white);
  border: 1px solid var(--gv-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: rgba(255, 5, 65, 0.35);
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.18);
}
.card h3 { margin-top: 0; }

/* Auto-flow grids: one column on phones, two on tablets, three when there is room.
   `minmax(min(<breakpoint>, 100%), 1fr)` keeps the layout liquid (no wasted columns,
   no horizontal overflow at any viewport). */
.cards-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}
.cards-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}
.cards-2 > *,
.cards-3 > * { min-width: 0; }

/* ---------- Key/value description list ---------- */

.kv {
  display: grid;
  /* Liquid label column: shrinks down to its content, never below 110px,
     never wider than its longest term. The value column always claims the rest.
     This survives narrow card containers (cards-3, sidebar-adjacent layouts)
     without forcing horizontal scroll. */
  grid-template-columns: minmax(110px, max-content) 1fr;
  gap: 8px 16px;
  font-size: 14px;
  margin: 0;
}
.kv dt {
  color: var(--gv-secondary-text);
  font-weight: 600;
  min-width: 0;
}
.kv dd {
  margin: 0;
  color: var(--gv-black);
  min-width: 0;
  overflow-wrap: anywhere;
}
/* When a kv list is rendered inside a `.cards-3` cell, the cell is typically
   narrow (240–340px) at intermediate viewports, so stack the list vertically
   — labels above values — to keep dd content readable. We use a viewport
   media query rather than container queries to avoid the
   `container-type` declaration requirement. */
@media (max-width: 1280px) {
  .cards-3 .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .cards-3 .kv dt {
    margin-top: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .cards-3 .kv dt:first-child { margin-top: 0; }
}

/* ---------- Tags / status chips ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--gv-tertiary-bg);
  color: var(--gv-secondary-text);
  border: 1px solid var(--gv-border);
  margin-right: 6px;
  white-space: nowrap;
}
.tag.ok       { color: var(--status-ok);      background: rgba(26, 136, 112, 0.08);  border-color: rgba(26, 136, 112, 0.25); }
.tag.warn     { color: var(--status-warn);    background: rgba(184, 116, 31, 0.08);  border-color: rgba(184, 116, 31, 0.25); }
.tag.danger   { color: var(--status-danger);  background: rgba(192, 16, 45, 0.08);   border-color: rgba(192, 16, 45, 0.25); }
.tag.pending  { color: var(--status-pending); background: rgba(34, 86, 163, 0.08);   border-color: rgba(34, 86, 163, 0.25); }
.tag.brand    { color: var(--gv-white);       background: var(--gv-red);             border-color: var(--gv-red); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--gv-red); color: var(--gv-white); }
.btn-primary:hover { background: var(--gv-black); text-decoration: none; }
.btn-outline { background: transparent; color: var(--gv-black); border-color: var(--gv-black); }
.btn-outline:hover { background: var(--gv-black); color: var(--gv-white); text-decoration: none; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--gv-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gv-white);
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gv-border);
  vertical-align: top;
}
thead th {
  background: var(--gv-off-white);
  color: var(--gv-secondary-text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gv-off-white); }

/* ---------- Misc ---------- */

.muted { color: var(--gv-secondary-text); }
.small { font-size: 13px; }

.glossary dt {
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-size: 16px;
  margin-top: 18px;
  color: var(--gv-black);
}
.glossary dd {
  margin: 4px 0 0;
  color: var(--gv-secondary-text);
  font-size: 14px;
  max-width: 760px;
}

.flow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
  font-size: 13px;
  line-height: 1.55;
  color: var(--gv-black);
  background: var(--gv-white);
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--gv-border);
  border-left: 3px solid var(--gv-red);
  overflow-x: auto;
}

/* Brand swatches (used on /brand-guidelines.html) */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 14px 0 24px;
}
.swatch {
  border: 1px solid var(--gv-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gv-white);
}
.swatch-color {
  height: 96px;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.swatch-meta {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--gv-secondary-text);
}
.swatch-meta .name {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gv-black);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.swatch-meta code { background: transparent; border: none; padding: 0; font-size: 12px; }

.type-sample {
  border: 1px solid var(--gv-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 10px 0 18px;
  background: var(--gv-white);
}
.type-sample .meta {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gv-secondary-text);
  margin-bottom: 8px;
}

/* Logo on brand-guidelines page */
.logo-stage {
  background: var(--gv-white);
  padding: 56px 32px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gv-border);
}
.logo-stage img { max-width: 100%; height: auto; }
.logo-stage.dark { background: var(--gv-black); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--gv-border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #cdd0d3; }

/* =====================================================================
   Responsive — tablet then mobile
   - <= 1024px: tighter sidebar
   - <=  860px: sidebar moves to top, content full width
   - <=  600px: tighter spacing, larger tap targets, table h-scroll
   ===================================================================== */

@media (max-width: 1024px) {
  .layout { grid-template-columns: 220px 1fr; }
  .main { padding: 32px 28px 64px; }
  h1 { font-size: 30px; }
  .cards-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  /* Stack: header on top, content below */
  .layout {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    width: 100%;
    padding: 14px 18px;
    background: var(--gv-white);
    border-right: none;
    border-bottom: 1px solid var(--gv-border);
    box-shadow: 0 2px 6px -4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }

  .brand-mark { margin: 0; }
  .brand-mark img { max-width: 160px; }
  .brand-sub { display: none; }

  .nav-section {
    display: inline-block;
    padding: 0 8px 0 0;
    color: var(--gv-secondary-text);
    font-size: 10px;
    align-self: center;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav a {
    padding: 8px 12px;
    border-left: none;
    border-radius: 999px;
    border: 1px solid var(--gv-border);
    font-size: 13px;
    background: var(--gv-white);
  }
  .nav a:hover { background: var(--gv-off-white); }
  .nav a.active {
    background: var(--gv-red);
    color: var(--gv-white);
    border-color: var(--gv-red);
  }

  .main {
    padding: 24px 20px 60px;
    max-width: 100%;
  }

  h1 { font-size: 26px; }
  h2 { font-size: 19px; }
  .banner { padding: 22px 24px; }
  .banner::after { display: none; }

  .cards-2,
  .cards-3 { grid-template-columns: 1fr; gap: 12px; }

  .kv {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .kv dt {
    margin-top: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .kv dd { font-size: 14px; }
  .kv dt:first-child { margin-top: 0; }

  /* Tables scroll horizontally rather than overflow */
  table { display: block; overflow-x: auto; white-space: nowrap; }

  pre.flow {
    font-size: 11px;
    padding: 12px 14px;
  }
}

@media (max-width: 600px) {
  body { font-size: 14px; }

  .main { padding: 20px 16px 56px; }

  h1 { font-size: 22px; letter-spacing: -0.01em; }
  h2 {
    font-size: 17px;
    margin: 28px 0 12px;
    padding-bottom: 6px;
  }
  h3 { font-size: 15px; }

  .banner {
    padding: 18px 20px;
    border-radius: 8px;
  }
  .banner h1 { font-size: 22px; }
  .banner p { font-size: 14px; }

  .card {
    padding: 16px 16px;
    border-radius: 8px;
  }

  /* Larger tap targets per iOS HIG */
  .nav a { padding: 9px 14px; font-size: 13px; min-height: 36px; }
  .btn { padding: 12px 18px; min-height: 44px; }

  .swatch-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .swatch-color { height: 72px; padding: 8px 10px; font-size: 11px; }

  .type-sample { padding: 14px 16px; }
  .type-sample > div { font-size: clamp(14px, 5vw, 32px) !important; }

  .logo-stage { padding: 32px 20px; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* iOS standalone mode (added to home screen): respect notch */
@supports (padding: max(0px)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
