/* Serenity — base.css
   Reset, tokens, typography. */

/* Self-hosted variable fonts. Latin + latin-ext. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  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;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  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;
}

/* Tokens (light mode) */
:root {
  --serenity-bg: #FAFAF7;
  --serenity-surface: #FFFFFF;
  --serenity-text: #1A1A1A;
  --serenity-text-muted: #5A5A5A;
  --serenity-border: #E8E6E0;
  --serenity-accent: #7B8B6F;

  --serenity-font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --serenity-font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --serenity-fs-body: clamp(1.0625rem, 0.95rem + 0.5vw, 1.1875rem);
  --serenity-lh-body: 1.7;
  --serenity-lh-heading: 1.2;

  --serenity-radius-sm: 4px;
  --serenity-radius-md: 8px;
  --serenity-radius-lg: 16px;

  --serenity-shell-max: 1100px;
  --serenity-content-max: 720px;
  --serenity-prose-measure: 68ch;

  --serenity-space-section: clamp(4rem, 8vw, 8rem);
  --serenity-space-block: clamp(2rem, 4vw, 4rem);

  --serenity-ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --serenity-duration: 220ms;

  --serenity-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(20, 20, 20, 0.06);
  --serenity-header-h: 72px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --serenity-bg: #1A1B1A;
  --serenity-surface: #222322;
  --serenity-text: #EDEBE5;
  --serenity-text-muted: #9A9A95;
  --serenity-border: #33342F;
  --serenity-accent: #A6B89A;
  --serenity-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--serenity-bg);
  color: var(--serenity-text);
  font-family: var(--serenity-font-sans);
  font-size: var(--serenity-fs-body);
  line-height: var(--serenity-lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}
img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
  height: auto;
}
img { font-style: italic; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

a {
  color: var(--serenity-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--serenity-border);
  transition: color var(--serenity-duration) var(--serenity-ease), text-decoration-color var(--serenity-duration) var(--serenity-ease);
}
a:hover, a:focus-visible {
  text-decoration-color: var(--serenity-accent);
  color: var(--serenity-accent);
}

/* Heading rhythm */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--serenity-font-serif);
  font-weight: 400;
  line-height: var(--serenity-lh-heading);
  letter-spacing: -0.005em;
  margin: 0 0 0.5em;
  color: var(--serenity-text);
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 1.6rem + 2.8vw, 3.75rem); font-weight: 400; }
h2 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); }
h3 { font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); }
h4 { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.12em; }

p { margin: 0 0 1.25em; }
p:last-child { margin-bottom: 0; }
strong, b { font-weight: 600; }

ul, ol { padding-left: 1.5em; margin: 0 0 1.25em; }
ul li, ol li { margin: 0.25em 0; }

blockquote {
  margin: 2em 0;
  padding: 0 0 0 1.5em;
  border-left: 2px solid var(--serenity-accent);
  font-family: var(--serenity-font-serif);
  font-style: italic;
  font-size: 1.125em;
  color: var(--serenity-text-muted);
}
blockquote p { margin-bottom: 0.5em; }

hr {
  border: 0;
  height: 1px;
  background: var(--serenity-border);
  margin: var(--serenity-space-block) auto;
  max-width: 6rem;
}

code, kbd, samp, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}
code {
  background: color-mix(in oklab, var(--serenity-surface), var(--serenity-border) 40%);
  padding: 0.15em 0.4em;
  border-radius: var(--serenity-radius-sm);
}
pre {
  background: color-mix(in oklab, var(--serenity-surface), var(--serenity-border) 40%);
  padding: 1em 1.25em;
  border-radius: var(--serenity-radius-md);
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.5em 0;
}
pre code { background: none; padding: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
th, td {
  text-align: left;
  padding: 0.65em 0.85em;
  border-bottom: 1px solid var(--serenity-border);
}
th { font-weight: 600; }

mark {
  background: color-mix(in oklab, var(--serenity-accent) 28%, transparent);
  color: inherit;
  padding: 0 0.15em;
}

::selection {
  background: color-mix(in oklab, var(--serenity-accent) 38%, transparent);
}

/* Focus states — universal */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--serenity-accent);
  outline-offset: 3px;
  border-radius: var(--serenity-radius-sm);
}

/* Skip link */
.serenity-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--serenity-text);
  color: var(--serenity-bg);
  padding: 0.6em 1em;
  text-decoration: none;
  z-index: 100;
  border-radius: var(--serenity-radius-sm);
}
.serenity-skip-link:focus,
.serenity-skip-link:focus-visible {
  left: 0.5rem;
  top: 0.5rem;
  outline: 2px solid var(--serenity-accent);
  outline-offset: 2px;
  color: var(--serenity-bg);
}

/* Visually hidden — for labels etc. */
.serenity-visually-hidden,
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.serenity-visually-hidden:focus,
.screen-reader-text:focus {
  position: static !important;
  width: auto;
  height: auto;
  clip: auto;
  white-space: normal;
}

/* Eyebrow */
.serenity-eyebrow {
  font-family: var(--serenity-font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--serenity-text-muted);
  margin: 0 0 1rem;
}

/* Theme transitions only when user toggles, not on initial paint. */
html.serenity-transitions, html.serenity-transitions * {
  transition: background-color var(--serenity-duration) var(--serenity-ease),
              color var(--serenity-duration) var(--serenity-ease),
              border-color var(--serenity-duration) var(--serenity-ease);
}

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