/* ═══════════════════════════════════════════════════════════════
   brand.binteca.com — the Binteca brand portal.

   Tokens are the same ones the product uses (bintweb src/index.css), so the
   portal is itself an example of the identity it hands out. Space Grotesk is
   self-hosted from fonts/ rather than fetched from a CDN — the portal has to
   render correctly on a machine that cannot reach the internet, which is the
   same machine a designer is often on.
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/SpaceGrotesk-Variable.ttf') format('truetype-variations');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --ink: #11120f;
  --paper: #f4f5f0;
  --white: #fff;
  --blue: #0b63f3;
  --green: #14a36f;
  --line: #d6d8d1;
  --muted: #60635b;
  --radius: 0;
  --pad: max(28px, calc((100vw - 1320px) / 2));

  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

/* ── Shared devices ──────────────────────────────────────────── */
.eyebrow {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); margin: 0;
}
/* flex-start + a nudge keeps the rule on the first line when the label wraps;
   align-items:center would float it into the middle of a two-line label. */
.eyebrow::before {
  content: ''; width: 28px; height: 1px; background: currentColor;
  flex: none; margin-top: .62em;
}

.button {
  min-height: 46px; padding: 0 22px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.button:hover { background: var(--blue); border-color: var(--blue); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.button.compact { min-height: 36px; padding: 0 14px; font-size: 12.5px; }

.section-pad { padding-left: var(--pad); padding-right: var(--pad); }

/* ── Header ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  min-height: 72px;
  background: rgba(244, 245, 240, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.topbar-brand img { height: 30px; width: auto; display: block; }
.topbar-brand span {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted);
  padding-left: 14px; border-left: 1px solid var(--line);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search {
  position: relative; display: flex; align-items: center;
}
.search input {
  width: 260px; height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); background: var(--white); border-radius: 0;
  font-size: 14px; outline: none; transition: border-color .18s ease;
}
.search input:focus { border-color: var(--blue); }
.search svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted); }

/* ── Hero ────────────────────────────────────────────────────── */
.hero { padding-top: 68px; padding-bottom: 56px; border-bottom: 1px solid var(--line); }
.hero h1 {
  font-size: clamp(40px, 5.4vw, 76px); line-height: 1.0; font-weight: 700;
  letter-spacing: -.02em; margin: 22px 0 22px; max-width: 15ch;
}
.hero h1 em { font-style: normal; color: var(--blue); }
.hero p { max-width: 62ch; font-size: 18px; line-height: 1.65; color: var(--muted); margin: 0; }
.hero-meta {
  margin-top: 34px; display: flex; flex-wrap: wrap; gap: 10px 34px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.hero-meta b { color: var(--ink); font-weight: 600; }

/* ── Download packs ──────────────────────────────────────────── */
.packs { padding-top: 48px; padding-bottom: 48px; }
.packs-grid {
  margin-top: 26px; display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  background: var(--line); border: 1px solid var(--line);
}
.pack {
  background: var(--paper); padding: 24px 22px 22px;
  display: flex; flex-direction: column; gap: 8px;
  transition: background .18s ease;
}
.pack:hover { background: var(--white); }
.pack.primary { background: var(--ink); color: #fff; }
.pack.primary .pack-blurb { color: #a8aaa4; }
.pack.primary .pack-size { color: #8f918b; }
.pack.primary:hover { background: #1b1c18; }
.pack h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.pack-blurb { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); flex: 1; }
.pack-size { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pack-go { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-top: 6px; }
.pack-go svg { width: 14px; height: 14px; }

/* ── Filters ─────────────────────────────────────────────────── */
.filters {
  position: sticky; top: 72px; z-index: 30;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 16px; padding-bottom: 16px;
  background: rgba(244, 245, 240, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.filter {
  height: 34px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
  font-size: 12.5px; font-weight: 500; letter-spacing: .02em;
  transition: all .16s ease;
}
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-count { margin-left: auto; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ── Asset grid ──────────────────────────────────────────────── */
.grid {
  padding-top: 40px; padding-bottom: 64px;
  display: grid; gap: 26px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card { display: flex; flex-direction: column; cursor: pointer; }
/* The preview is painted as a background image, not an <img>. An SVG in an
   <img> is a replaced element whose intrinsic sizing object-fit cannot be
   relied on across engines — square masters escaped the card. background-size:
   contain inside a content-box origin always letterboxes correctly. */
.card-preview {
  position: relative; aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background-color: var(--white);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-origin: content-box;
  padding: 26px;
  transition: border-color .18s ease;
}
.card:hover .card-preview { border-color: var(--ink); }
.card-preview.on-dark { background-color: var(--ink); border-color: var(--ink); }
.card-body { padding-top: 14px; display: flex; flex-direction: column; gap: 5px; }
.card-body h3 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.005em; }
.card-meta { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-note { font-size: 12.5px; color: var(--blue); line-height: 1.45; }

.empty { padding: 80px 0; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 20px; margin: 0 0 8px; }

/* ── Palette ─────────────────────────────────────────────────── */
.band { border-top: 1px solid var(--line); padding-top: 56px; padding-bottom: 56px; }
.band h2 {
  font-size: clamp(30px, 3.4vw, 44px); font-weight: 700;
  letter-spacing: -.02em; margin: 18px 0 14px;
}
.band > p { max-width: 62ch; color: var(--muted); line-height: 1.65; margin: 0 0 32px; font-size: 16px; }

.swatches { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); background: var(--line); border: 1px solid var(--line); }
.swatch { background: var(--paper); }
.swatch-chip { height: 108px; border-bottom: 1px solid var(--line); }
.swatch-info { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.swatch-info b { font-size: 14.5px; font-weight: 600; }
.swatch-copy {
  font-size: 12.5px; letter-spacing: .04em; color: var(--muted);
  cursor: pointer; border: none; background: none; padding: 2px 0; text-align: left;
  display: flex; align-items: center; gap: 6px;
}
.swatch-copy:hover { color: var(--blue); }
.swatch-use { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 4px; }

/* ── Typography specimen ─────────────────────────────────────── */
.type-specimen { border: 1px solid var(--line); background: var(--white); padding: 34px; }
.type-name { font-size: clamp(44px, 6vw, 92px); font-weight: 700; letter-spacing: -.03em; line-height: 1; margin: 0; }
.type-row { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 20px; }
.type-row span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.type-row p { margin: 8px 0 0; font-size: clamp(15px, 2vw, 25px); line-height: 1.3; word-break: break-word; }
.type-row p.w700 { font-weight: 700; }
.type-row p.w500 { font-weight: 500; }

/* ── Rules list ──────────────────────────────────────────────── */
.rules { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); background: var(--line); border: 1px solid var(--line); }
.rule-card { background: var(--paper); padding: 26px 24px; }
.rule-card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.rule-card h3::before { content: ''; width: 9px; height: 9px; background: var(--blue); flex: none; }
.rule-card.no h3::before { background: #e84c38; }
.rule-card ul { margin: 0; padding-left: 18px; }
.rule-card li { font-size: 13.5px; line-height: 1.65; color: var(--muted); margin-bottom: 7px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(17, 18, 15, .62); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal[open], .modal.is-open { display: flex; }
.modal-box {
  background: var(--paper); border: 1px solid var(--ink);
  width: min(920px, 100%); max-height: 88vh; overflow: auto;
  display: grid; grid-template-columns: 1.1fr .9fr;
}
.modal-visual {
  min-height: 340px;
  background-color: var(--white);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-origin: content-box;
  padding: 34px;
  border-right: 1px solid var(--line);
}
.modal-visual.on-dark { background-color: var(--ink); }
.modal-side { padding: 28px 26px; display: flex; flex-direction: column; gap: 4px; }
.modal-side h3 { margin: 8px 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.015em; }
.modal-close {
  position: absolute; top: 20px; right: 24px;
  width: 36px; height: 36px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.modal-path {
  font-size: 12px; color: var(--muted); word-break: break-all;
  cursor: pointer; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.modal-path:hover { color: var(--blue); }
.dl-title { margin-top: 18px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.dl-list { margin-top: 10px; display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.dl {
  background: var(--paper); padding: 11px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; transition: background .14s ease;
}
.dl:hover { background: var(--white); color: var(--blue); }
.dl b { font-weight: 600; }
.dl span { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }

/* ── Toast ───────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px;
  font-size: 13px; font-weight: 500;
  animation: rise .22s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── Footer ──────────────────────────────────────────────────── */
footer { background: var(--ink); color: #fff; padding-top: 48px; padding-bottom: 26px; }
.footer-top { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 34px; }
.footer-top img { height: 34px; }
.footer-top p { max-width: 46ch; color: #a8aaa4; line-height: 1.65; margin: 14px 0 0; font-size: 14px; }
.footer-links { display: flex; gap: 26px; flex-wrap: wrap; font-size: 13.5px; }
.footer-links a:hover { color: var(--blue); }
.footer-bottom { border-top: 1px solid #33342f; padding-top: 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 12px; color: #8f918b; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 860px) {
  .modal-box { grid-template-columns: 1fr; }
  .modal-visual { border-right: none; border-bottom: 1px solid var(--line); }
  .search input { width: 170px; }
  .topbar-brand span { display: none; }
  .filters { top: 64px; }
  .topbar { min-height: 64px; }
}
@media (max-width: 560px) {
  :root { --pad: 20px; }
  .search { display: none; }
  .hero { padding-top: 46px; padding-bottom: 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
