/* =========================================================
   $AGENCY Holder Crates · base layer
   Tokens, reset, typography, layout primitives, nav, buttons
   ========================================================= */

:root {
  /* Surface: AGENCY runs on near-black (#050505 theme color) */
  --bg: #050505;
  --bg-1: #0a0a09;
  --bg-2: #10100f;
  --bg-3: #171715;
  --line: #1e1e1c;
  --line-2: #2c2c29;
  --line-3: #3d3d39;

  /* Ink */
  --fg: #ededE6;
  --fg-2: #b4b4ab;
  --fg-3: #8a8a82;

  /* Signal (used sparingly: live dot, focus) */
  --signal: #9be28f;

  /* Tier tones (always paired with a text label) */
  --t-copper: #d0855a;
  --t-bronze: #b9935e;
  --t-silver: #c4c8cc;
  --t-gold: #e2c46a;
  --t-platinum: #e9eef2;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 60px;
  --radius: 2px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure, pre, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--fg); color: var(--bg); }

/* ---------- Focus ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ---------- Utilities ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--fg); color: var(--bg); padding: 10px 14px;
  font-family: var(--font-mono); font-size: 13px; transition: top .15s var(--ease);
}
.skip-link:focus { top: 12px; }

.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.inline-link { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.inline-link:hover { text-decoration-color: var(--fg); }

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  line-height: .9;
}
.h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.tags {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
}

/* Section header: "01 · Your Crate" + title + right link (AGENCY pattern) */
.section { padding-block: clamp(64px, 9vw, 120px); border-top: 1px solid var(--line); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 16px 32px; margin-bottom: clamp(28px, 4vw, 48px);
}
.section-head .kicker { display: block; margin-bottom: 14px; }
.section-head .intro { max-width: 60ch; margin-top: 14px; color: var(--fg-2); }
.section-head .head-link {
  font-family: var(--font-mono); font-size: 13px; color: var(--fg-2);
  padding: 6px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.section-head .head-link:hover { color: var(--fg); border-color: var(--fg); }

/* ---------- Status tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--line-2); color: var(--fg-2); border-radius: var(--radius);
  white-space: nowrap;
}
.tag-locked { border-style: dashed; border-color: var(--line-3); color: var(--fg); }
.tag-locked::before { content: "\25A0"; font-size: 8px; color: var(--fg-3); }
.tag-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.tag-illustrative { border-style: dotted; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
  white-space: nowrap; text-align: center;
}
.btn .arrow { font-family: var(--font-mono); transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #ffffff; }
.btn-ghost { border-color: var(--line-3); color: var(--fg); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:active { transform: translateY(1px); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(5, 5, 5, .88);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { width: 28px; height: 28px; border-radius: 3px; object-fit: cover; background: var(--bg-3); }
.brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.brand-sub { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.brand-sub::before { content: "/ "; color: var(--line-3); }

.nav-links { display: flex; align-items: center; gap: 22px; margin-left: 12px; }
.nav-links a {
  font-size: 14px; color: var(--fg-2); padding: 6px 0; position: relative;
  transition: color .15s;
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--fg); }
.nav-links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--fg);
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.utc { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nav-ext { font-family: var(--font-mono); font-size: 12px; color: var(--fg-2); white-space: nowrap; transition: color .15s; }
.nav-ext:hover { color: var(--fg); }
.icon-link { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--fg-2); border: 1px solid var(--line-2); border-radius: var(--radius); transition: color .15s, border-color .15s; }
.icon-link:hover { color: var(--fg); border-color: var(--fg-3); }
.icon-link svg { width: 15px; height: 15px; }

.nav-toggle {
  display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 12px; color: var(--fg);
}

/* Mobile drawer: numbered list, as on agencypad.fun */
.drawer {
  display: none;
  position: fixed; inset: var(--nav-h) 0 auto 0; z-index: 49;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter) 20px;
  max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
}
.drawer.is-open { display: block; }
.drawer ol li a {
  display: flex; align-items: baseline; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 500;
}
.drawer ol li a span { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); width: 22px; }
.drawer .drawer-cta { margin-top: 18px; width: 100%; }

@media (max-width: 1180px) {
  .nav-ext, .utc { display: none; }
}
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-right .btn-primary { display: none; }
}
@media (max-width: 420px) {
  .brand-sub { display: none; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 56px 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.footer-brand p { color: var(--fg-2); font-size: 14px; max-width: 42ch; margin-top: 14px; }
.footer h2 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; color: var(--fg-3); margin-bottom: 14px; }
.footer li + li { margin-top: 8px; }
.footer li a, .footer li span { font-size: 14px; color: var(--fg-2); transition: color .15s; }
.footer li a:hover { color: var(--fg); }
.footer-base {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-3);
}
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Dialog (placeholder connect notice) ---------- */
.dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line-3); border-radius: var(--radius);
  background: var(--bg-1); color: var(--fg);
}
.dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--fg-3);
}
.dialog-body { padding: 22px 18px 20px; }
.dialog-body h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 10px; }
.dialog-body p { color: var(--fg-2); font-size: 15px; }
.dialog-body p + p { margin-top: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
