/* ───────────────────────────────────────────
   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: #646464;  /* 4.9:1 on every light ground (was #717171, 4.36:1) */
  --text-warm: #3d2f1f;
  --text-muted: #6e6e6e;     /* 4.8:1 on cards; small caps labels are text (was #a1a1a1, 2.41:1) */

  /* 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 ── */
.site {
  min-height: 100dvh;
}

.hero {
  min-height: min(780px, 100dvh);
  display: flex;
  align-items: center;
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 5vw, 5rem);
}

.hero-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  min-height: min(650px, 88dvh);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-topline,
.hero-bottomline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone-400);
}

.hero-label {
  font-family: 'TT Hoves', 'Google Sans', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--bg-primary);
}

.hero-label-period {
  color: #d97706;
}

.hero-symbol {
  color: #d97706;
}

.hero-copy {
  max-width: 850px;
  padding: clamp(4rem, 11vh, 8rem) 0;
}

.eyebrow {
  margin-bottom: 1.25rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--stone-400);
}

.eyebrow-dark {
  color: var(--text-tertiary);
}

.hero h1 {
  max-width: 850px;
  font-size: clamp(2.6rem, 7vw, 6.6rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.055em;
  color: var(--bg-primary);
}

.hero-description {
  max-width: 540px;
  margin-top: 2rem;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.5;
  color: var(--stone-300);
}

.portfolio-section {
  padding: clamp(5rem, 10vw, 9rem) clamp(1.25rem, 5vw, 5rem);
  background: var(--bg-primary);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  align-items: end;
  gap: clamp(2rem, 8vw, 9rem);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.section-heading h2,
.principles h2 {
  max-width: 700px;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--text-primary);
}

.section-intro {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.section-action {
  grid-column: 2;
  margin-top: 1.5rem;
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-warm);
}

.section-action span {
  display: inline-block;
  margin-left: 0.35rem;
  color: #d97706;
  font-size: 1rem;
}

/* ── 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: 1180px;
  margin: clamp(3rem, 6vw, 5rem) auto;
  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 (three products, flat) ── */
.portfolio {
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

@media (min-width: 880px) {
  .portfolio {
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
  }
}

/* ── Product card ──
   Show, don't tell: description + meta are visible by default.
   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, transform 0.2s ease;
}

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

.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-kicker {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.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);
}

.product-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding-top: 0.15rem;
  border-bottom: 1px solid var(--stone-400);
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-warm);
  letter-spacing: 0.01em;
}

.product-action span {
  transition: transform 0.2s ease;
}

.product:hover .product-action span,
.product:focus-within .product-action span {
  transform: translate(2px, -2px);
}

.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: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 5vw, 5rem);
  border-top: 1px solid var(--stone-300);
  background: var(--bg-primary);
}

.principles {
  padding: clamp(5rem, 10vw, 9rem) clamp(1.25rem, 5vw, 5rem);
  background: var(--bg-secondary);
}

.principles-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: clamp(3rem, 6vw, 5rem);
  background: var(--stone-300);
}

.principle {
  min-height: 190px;
  padding: 1.5rem;
  background: var(--bg-elevated);
}

.principle-number {
  display: block;
  margin-bottom: 3rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.principle p {
  max-width: 18ch;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--text-primary);
}

.foot-company {
  color: var(--text-warm);
  font-size: 0.875rem;
  font-weight: 500;
}

.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-note {
  justify-self: end;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

@media (prefers-reduced-motion: reduce) {
  .product,
  .product-action span,
  .product-go {
    transition: none;
  }
}

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

/* Keyboard focus must show: the colour change alone is too faint. */
.foot-link:focus-visible {
  outline: 1px solid var(--stone-500);
  outline-offset: 3px;
}

/* ── 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;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .section-action {
    grid-column: auto;
    margin-top: 0;
  }

  .principle-grid {
    grid-template-columns: 1fr;
  }

  .principle {
    min-height: 140px;
  }

  .principle-number {
    margin-bottom: 1.5rem;
  }
}

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

  .hero {
    min-height: 680px;
  }

  .hero-inner {
    min-height: 600px;
  }

  .hero-bottomline {
    align-items: flex-start;
    flex-direction: column;
  }

  .foot {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .foot-note {
    justify-self: start;
  }
}
