/* ───────────────────────────────────────────
   BILLINGRAILS CO. — Warm Paper & Ink System
   Tokens mirror docs/DESIGN_SYSTEM_AND_AGENT_STYLE_GUIDE.md v2.0.
   ─────────────────────────────────────────── */

/* ── Self-hosted Google Sans (body) ── */
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/google-sans/google-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/google-sans/google-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/google-sans/google-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Google Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/google-sans/google-sans-latin-700-normal.woff2') format('woff2');
}

/* ── Self-hosted TT Hoves (Billingrails product wordmark) ──
   Sourced from billingrails.com. Only used for the "Billingrails"
   product name on this page, scoped via .product-name--billingrails. */
@font-face {
  font-family: 'TT Hoves';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/tt-hoves/tt-hoves-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'TT Hoves';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/tt-hoves/tt-hoves-medium.woff2') format('woff2');
}

/* ── Self-hosted Inter (UI labels, uppercase tracking) ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter/inter-latin-700-normal.woff2') format('woff2');
}

/* ── Design tokens (verbatim from the style guide) ── */
:root {
  /* Warm paper backgrounds */
  --bg-primary: #f5f2eb;
  --bg-secondary: #edeae2;
  --bg-tertiary: #e5e2da;
  --bg-elevated: #faf7f0;

  /* Ink hierarchy */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-tertiary: #717171;
  --text-warm: #3d2f1f;
  --text-muted: #a1a1a1;

  /* Accent (neutral ink) */
  --accent: #1a1a1a;
  --accent-secondary: #4a4a4a;
  --accent-muted: rgba(26, 26, 26, 0.08);
  --accent-hover: #000000;

  /* Stone scale (borders + structural only) */
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-800: #292524;
  --stone-900: #1c1917;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Google Sans', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ── Ambient page background (subtle, per guide: "barely noticeable") ── */
.page-ambient {
  background-color: var(--bg-primary);
  background-image: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  background-attachment: fixed;
}

@media (prefers-reduced-motion: no-preference) {
  .page-ambient {
    /* Static gradient only — no animation. Decoration off. */
  }
}

/* ── Page layout ── */
.page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  align-items: start;
  justify-items: center;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) clamp(2rem, 4vw, 3rem);
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* ── Masthead (brand + thesis) ── */
.masthead {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  text-align: left;
  align-self: end;
}

.brand {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-warm);
}

.brand-suffix {
  font-weight: 400;
  color: var(--text-tertiary);
}

.brand-tagline {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 56ch;
}

/* ── Asterisk divider (typographic mark, no decorative rule) ── */
.split {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1080px;
  color: var(--text-warm);
}

.split-mark {
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-warm);
  user-select: none;
}

/* ── Portfolio (the two clusters) ── */
.portfolio {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

@media (min-width: 880px) {
  .portfolio {
    grid-template-columns: 1fr 1fr;
    gap: 0;
    column-gap: clamp(2rem, 4vw, 3.5rem);
  }
}

.cluster {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.cluster-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 0.2em 0.45em;
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* ── Product list inside a cluster ── */
.products {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

/* ── Product card ──
   Show, don't tell: description + meta are visible by default
   (style guide: "click-to-reveal for primary content" is an anti-pattern).
   The whole card is the link, so the focus ring follows the card. */
.product {
  border: 1px solid var(--stone-300);
  background-color: var(--bg-elevated);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.product:hover,
.product:focus-within {
  border-color: var(--text-warm);
  background-color: var(--bg-elevated);
}

.product-link {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem 1.25rem;
  outline: none;
}

.product-link:focus-visible {
  outline: 1px solid var(--stone-500);
  outline-offset: -3px;
}

.product-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
}

.product-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

/* The AccomplishAnything sunflower is a solid brand mark (the only
   filled icon in the system). Petals render in secondary ink (not
   primary) so the mark reads as a softer brand glyph, not a heavy
   stamp. The hollow center uses --bg-primary directly via a var()
   in the SVG fill. */
.product-icon .aa-mark {
  color: var(--text-secondary);
}

.product:hover .product-icon,
.product:focus-within .product-icon {
  color: var(--text-warm);
}

.product-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.product-name {
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Billingrails product name uses the TT Hoves family (Regular/Medium)
   — the same font the Billingrails product site uses, scoped to this
   one card so the rest of the page stays in the design-system stack. */
.product-name--billingrails {
  font-family: 'TT Hoves', 'Google Sans', system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

/* The fetched Billingrails mark is a 247x247 viewBox SVG; render it at
   the same 20x20 the inline icons use so all three product rows are
   optically aligned. */
.billingrails-mark {
  width: 20px;
  height: 20px;
  display: block;
  color: var(--text-primary);
}

/* AccomplishAnything wordmark treatment.
   "accomplish" reads as the lead-in (lighter), "anything" carries
   the weight (darker), the period is part of the brand, not a
   sentence-terminator — so it lives with the darker word and sits
   at the same weight. */
.product-name--aa {
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text-tertiary);
}

.product-name--aa .aa-anything {
  color: var(--text-primary);
  font-weight: 600;
}

.product-name--aa .aa-dot {
  color: var(--text-primary);
  font-weight: 700;
  display: inline-block;
  margin-left: 0.05em;
}

.product-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.product:hover .product-go,
.product:focus-within .product-go {
  color: var(--text-warm);
  transform: translate(1px, -1px);
}

.product-go svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ── Product body (description + meta — always visible) ── */
.product-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  padding-left: calc(24px + 0.75rem);
}

.product-desc {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 60ch;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.meta-key {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: 0.5625rem;
  color: var(--text-muted);
}

.meta-val {
  color: var(--text-secondary);
}

.meta-sep {
  color: var(--text-muted);
  user-select: none;
}

/* ── Footer (single contact, no form) ── */
.foot {
  width: 100%;
  max-width: 1080px;
  text-align: left;
  padding-top: clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--stone-200);
  align-self: end;
}

.foot-link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: -0.005em;
  transition: color 0.15s ease;
}

.foot-link:hover,
.foot-link:focus-visible {
  color: var(--text-warm);
  outline: none;
}

/* ── Responsive: single column under 880px (no design-system breakpoints exist
   for the portfolio; this matches the "mobile-native" rule of progressive disclosure). */
@media (max-width: 879px) {
  .masthead {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .product-body {
    padding-left: 0;
  }
}
