/* =========================================================================
   5RS — base.css
   Design tokens, reset, typography primitives.
   Palette derived from the real book cover (teal #2B938C) with warm
   paper neutrals and dark charcoal text.
   ========================================================================= */

:root {
  /* --- Surfaces (warm off-white / stone) --- */
  --paper:        #f4efe7;  /* primary background */
  --paper-2:      #efe9df;  /* offset band */
  --surface:      #faf7f1;  /* raised cards */
  --surface-line: #e2dbcf;  /* hairline dividers on paper */

  /* --- Ink (dark charcoal, not pure black) --- */
  --ink:          #24221d;  /* primary text */
  --ink-2:        #514d45;  /* secondary text */
  --ink-3:        #7d786f;  /* muted / captions */
  --ink-4:        #a7a196;  /* faint / placeholders */

  /* --- Teal, sampled directly from the real book cover artwork (#2B928B) --- */
  --teal:         #2b928b;  /* cover teal — brand fill, exact sample */
  --teal-ink:     #0f6560;  /* accessible teal for text/links on paper */
  --teal-ink-h:   #0a4b47;  /* hover */
  --teal-deep:    #12615c;  /* deep panel fill */
  --teal-soft:    #e4efec;  /* faint teal tint surface */

  --border:       #d9d2c6;

  /* --- Type --- */
  --sans: "General Sans", "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Compact, premium scale */
  --step--1: 0.8125rem;   /* 13px  labels / micro */
  --step-0:  1rem;        /* 16px  body */
  --step-1:  1.0625rem;   /* 17px  lead body */
  --step-2:  1.375rem;    /* 22px  sub-heads */
  --step-3:  clamp(1.5rem, 2.4vw, 1.95rem);   /* section headings */
  --step-4:  clamp(2.1rem, 4.4vw, 3.15rem);   /* hero H1 */

  /* --- Rhythm --- */
  --container: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.75rem);
  --radius: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(30,26,20,0.05);
  --shadow-md: 0 14px 40px -14px rgba(24,50,48,0.28);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Dark mode --- */
:root[data-theme="dark"] {
  --paper:        #17191a;
  --paper-2:      #1c1e1f;
  --surface:      #212423;
  --surface-line: #2f3230;
  --ink:          #e7e3db;
  --ink-2:        #b7b2a9;
  --ink-3:        #8b8880;
  --ink-4:        #63615b;
  --teal:         #46b0a7;
  --teal-ink:     #5ec3ba;
  --teal-ink-h:   #83d6cd;
  --teal-deep:    #1c4b48;
  --teal-soft:    #1e2b29;
  --border:       #313432;
  --shadow-md: 0 16px 44px -16px rgba(0,0,0,0.6);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "ss01", "cv01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: var(--teal-ink); text-decoration: none; }

img, svg { display: block; max-width: 100%; }

button, input { font-family: inherit; font-size: inherit; }

::selection { background: var(--teal); color: #fff; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute; 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: 1rem; top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: var(--radius);
  z-index: 200; transition: top 0.2s var(--ease);
  font-size: var(--step--1); font-weight: 500;
}
.skip-link:focus { top: 1rem; }
