/* ==========================================================================
   Gagahoho Corporation — gagahoho.ca
   One-page manifesto. Plain HTML and CSS, no build tools.
   Direction: Linear / Stripe / Apple DNA — sans-serif product-tier.
   See notes/iterations/_lsa-synthesis.md for shared-DNA extraction.
   ========================================================================== */

/* --- Inter Variable (self-hosted, Latin subset) --- */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/Inter-Roman-Latin.woff2') format('woff2-variations'),
       url('assets/fonts/Inter-Roman-Latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter Variable';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/Inter-Italic-Latin.woff2') format('woff2-variations'),
       url('assets/fonts/Inter-Italic-Latin.woff2') format('woff2');
}

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

:root {
  /* Iter 17: cool palette (Linear/Vercel-aligned) — replaces warm cream */
  --bg:            #f7f8f8;  /* Linear light */
  --text:          #171717;  /* Vercel near-black */
  --muted:         #666666;  /* Vercel Gray 500 */
  --rule:          #d4d4d4;  /* cool light gray (iter-18: bumped from #e5e5e5 for visibility) */
  --accent:        #5e6ad2;  /* Linear indigo-violet — interactive only */
  --accent-hover:  #4d59c2;  /* darker for hover */

  --sans: 'Inter Variable', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --measure: 36rem;
}

@media (min-width: 1024px) {
  :root {
    --measure: 42rem;  /* iter 30: slight widen on desktop — Bringhurst upper bound 73-75ch */
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0a0a0c;  /* cool near-black, slightly less extreme than Linear's #08090a */
    --text:          #f7f8f8;  /* Linear primary text */
    --muted:         #8a8f98;  /* Linear tertiary */
    --rule:          #23252a;  /* Linear border-primary */
    --accent:        #828fff;
    --accent-hover:  #a4b0ff;
  }
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);

  max-width: var(--measure);
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Linear DNA: cv01 (single-story 'a'), ss03 (geometric alternates), kern, liga, calt */
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "cv01" 1, "ss03" 1;
}

/* --- Header masthead (Iter 12 + Iter 21 subtle ambient elevation) --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 4px 16px -10px rgba(0, 0, 0, 0.05);
  gap: 1rem;
}

@media (prefers-color-scheme: dark) {
  header {
    box-shadow: 0 4px 18px -8px rgba(0, 0, 0, 0.5);
  }
}

.brand {
  font-family: var(--sans);
  font-weight: 590;
  font-size: 0.875rem;
  color: var(--text);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
}

.brand-dot {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.55em;
  flex-shrink: 0;
}

.meta {
  font-family: var(--sans);
  font-weight: 510;
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: -0.005em;
  white-space: nowrap;
}

/* --- Lead manifesto (Iter 25: humanist Inter on lead — toggle off cv01/ss03 for character contrast vs body) --- */
.lead {
  font-family: var(--sans);
  font-weight: 590;
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);  /* 36–56px */
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 5rem;
  text-wrap: balance;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* --- Sections (Iter 16: Roman numerals via CSS counter) --- */
main {
  counter-reset: section;
}

section {
  margin-bottom: 4rem;
  counter-increment: section;
}

section:last-of-type {
  margin-bottom: 4rem;
}

h2 {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 590;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.06em;
}

h2::before {
  content: counter(section, upper-roman);
  margin-right: 1em;
  color: var(--muted);
  font-feature-settings: "tnum" 1;
}

section p {
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 0.5rem;
  letter-spacing: -0.011em;
}

section p:last-child {
  margin-bottom: 0;
}

/* --- Links (Iter 13 accent + Iter 14 hover + Iter 17 underline contrast) --- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease,
    text-underline-offset 160ms ease,
    text-decoration-thickness 160ms ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
  text-underline-offset: 0.3em;
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 2px;
}

/* --- Footer (Iter 22: mirrors masthead structure) --- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  gap: 1rem;
}

footer p {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: -0.005em;
}

.footer-meta {
  white-space: nowrap;
}

/* --- Selection (Iter 28: white text on accent for proper contrast) --- */
::selection {
  background: var(--accent);
  color: #ffffff;
}

/* --- Mobile --- */
@media (max-width: 540px) {
  body {
    padding: 5rem 1.25rem 3rem;
  }

  .brand {
    margin-bottom: 4rem;
  }

  .lead {
    margin-bottom: 4rem;
  }

  section {
    margin-bottom: 3rem;
  }

  footer {
    margin-top: 4rem;
  }
}

/* --- Dark mode body legibility (Iter 15: Raycast pattern) --- */
@media (prefers-color-scheme: dark) {
  section p {
    font-weight: 470;       /* between regular and medium — slight heft for dark */
    letter-spacing: 0;       /* loosen from -0.011em — Raycast's dark-mode openness */
  }

  /* Iter 27: atmospheric indigo glow at top — Linear-tier ambient depth */
  body {
    background:
      radial-gradient(ellipse 90% 60% at 50% 0%, rgba(130, 143, 255, 0.05), transparent 50%),
      var(--bg);
    background-attachment: fixed;
  }
}

/* --- Iter 26: subtle scroll-driven section entry (CSS only, no JS) --- */
@supports (animation-timeline: view()) {
  section,
  .ornament {
    animation: section-enter 700ms cubic-bezier(0.2, 0.6, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
}

@keyframes section-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  section {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- Hairline footer rule on retina --- */
@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) {
  footer {
    border-top-width: 0.5px;
  }
}

/* --- Print --- */
@media print {
  body {
    background: #fff;
    color: #000;
    max-width: none;
    padding: 1.5cm 2cm;
    font-size: 11pt;
    line-height: 1.5;
  }

  .brand,
  .lead,
  section p,
  footer p {
    color: #000;
  }

  h2 {
    color: #555;
  }

  .lead {
    font-size: 20pt;
    line-height: 1.1;
    margin-bottom: 1.5cm;
  }

  section {
    margin-bottom: 0.8cm;
    page-break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after,
  a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }

  footer {
    margin-top: 1cm;
    border-top: 1px solid #aaa;
  }
}
