/* ==========================================================================
   golka-base.css — shared foundation for all golka.org properties
   Served from assets.golka.org; consumed by URL. Contains design tokens,
   typography and base components only. Page templates, layout and copy
   live in each property's own repo (see CLAUDE.md §4, §8).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts — self-hosted, latin + latin-ext. No third-party requests.
   Fraunces, Inter and JetBrains Mono are all SIL Open Font License 1.1;
   see ../fonts/LICENSES.md.
   -------------------------------------------------------------------------- */

/* Fraunces — latin-ext */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Fraunces — latin */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter — latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter — latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* JetBrains Mono — latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Colour — shared neutral base. These three are fixed by the spec and
     must not be overridden per-app. */
  --bg: #FBF6EF;
  --ink: #2B2622;
  --card: #E8DFD1;

  /* Derived neutrals. --ink-muted clears 4.5:1 on both --bg and --card. */
  --ink-muted: #5F564C;
  --hairline: rgba(43, 38, 34, 0.12);
  --hairline-strong: rgba(43, 38, 34, 0.22);

  /* Accent — studio default: a neutral warm taupe, deliberately not drawn
     from any single app's icon.

     Per-app override contract: set --accent (and optionally --accent-soft)
     in the property's own stylesheet, derived from that app's icon.
     --accent is used for text and interactive states, so it MUST clear
     4.5:1 against both --bg and --card. Decorative-only tints belong in
     --accent-soft, which carries no contrast requirement.

     Note: the example accents in the spec are decorative-safe but not
     text-safe — dust blue #7B94A8 is 2.94:1 on --bg and sage #4A7C6F is
     4.43:1. Darken before using either as --accent. */
  --accent: #5C5147;
  --accent-soft: #D9CDBA;

  /* Type */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Fluid type scale, ~1.25 ratio at both ends */
  --text-xs: 0.78rem;
  --text-sm: 0.875rem;
  --text-base: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --text-lg: clamp(1.15rem, 1.09rem + 0.3vw, 1.3rem);
  --text-xl: clamp(1.4rem, 1.28rem + 0.6vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --text-3xl: clamp(2.25rem, 1.75rem + 2.4vw, 3.75rem);

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.65;
  --measure: 62ch;

  /* Spacing — 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius — soft rounding throughout, never sharp corners */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-pill: 999px;

  --container: 68rem;
  --container-narrow: 44rem;
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 var(--space-4);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); letter-spacing: -0.005em; }

p, ul, ol { margin: 0 0 var(--space-4); max-width: var(--measure); }
p { text-wrap: pretty; }

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

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--space-12) 0;
}

small { font-size: var(--text-sm); color: var(--ink-muted); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Never overflow the container. `height: auto` is scoped to images that
   declare BOTH dimensions — the usual layout-shift-prevention pattern, where
   the ratio must be preserved once max-width shrinks the width. Applying it
   unscoped would silently defeat a lone height attribute, e.g. sizing a logo
   with <img src="golka-logo.svg" height="40">. */
img, svg { max-width: 100%; }
img[width][height] { height: auto; }

/* --------------------------------------------------------------------------
   4. Base components
   -------------------------------------------------------------------------- */

.g-container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.g-container--narrow { max-width: var(--container-narrow); }

/* Studio/app wordmark, always lowercase Fraunces */
.g-wordmark {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--ink);
  text-decoration: none;
}

/* Small mono label for data, metadata and eyebrow text */
.g-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Card / tile — the shared grid-and-tile rhythm (spec §5) */
.g-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.g-tile {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Auto-fitting tile grid; override --tile-min per property */
.g-grid {
  --tile-min: 12rem;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr));
}

.g-stack > * + * { margin-top: var(--space-4); }

.g-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: filter 120ms ease;
}
.g-btn:hover { filter: brightness(1.15); }

.g-btn--quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}
.g-btn--quiet:hover { background: var(--card); filter: none; }

/* Hairline divider between sections */
.g-rule {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 0;
}

.g-section { padding-block: var(--space-24); }

/* Visually hidden but available to assistive tech */
.g-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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