/**
 * base.css — Reset, typography defaults, body.
 * All values reference tokens.css custom properties.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keep sticky header from covering anchored sections */
  scroll-padding-top: var(--space-20);
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-primary);
  /* Editorial serif: optical sizing + ligatures for Fraunces */
  font-optical-sizing: auto;
  text-wrap: balance;
}

h1 { font-size: var(--font-size-4xl); font-weight: var(--font-weight-black); letter-spacing: var(--letter-spacing-tighter); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

p {
  margin: 0 0 var(--space-5);
  text-wrap: pretty;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 0.18em;
  transition: color var(--transition-fast),
              text-decoration-color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-primary-light);
  text-decoration-color: var(--color-accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-6);
}

li { margin-bottom: var(--space-2); }

blockquote {
  position: relative;
  margin: var(--space-8) 0;
  padding: var(--space-6) var(--space-8);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--gradient-surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  font-style: italic;
  line-height: var(--line-height-snug);
  color: var(--color-text);
}

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

blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-style: normal;
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
  background-color: var(--color-primary-dark);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
}

hr {
  border: 0;
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-12) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
}

/* ===========================================================================
   Editorial long-form — drop cap & pull-quotes for .prose articles
   =========================================================================== */

/* Magazine drop cap on the first paragraph of an article */
.prose > p:first-of-type::first-letter {
  float: left;
  margin: 0.04em 0.12em 0 0;
  padding: 0 0.06em;
  font-family: var(--font-display);
  font-size: 3.4em;
  font-weight: var(--font-weight-black);
  line-height: 0.78;
  color: var(--color-primary);
}

/* Pull-quote: a large, centered editorial aside.
   Add class="pull-quote" to a <blockquote> or <p> inside .prose. */
.prose .pull-quote,
.prose blockquote.is-style-pull {
  margin: var(--space-12) auto;
  padding: 0;
  max-width: 36ch;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-family: var(--font-display);
  font-size: var(--font-size-2xl);
  font-style: normal;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-tight);
  text-align: center;
  text-wrap: balance;
  color: var(--color-primary);
}

.prose .pull-quote::before {
  content: "";
  display: block;
  width: var(--space-12);
  height: 3px;
  margin: 0 auto var(--space-5);
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
}

/* Comfortable measure for long-form reading */
.prose {
  max-width: 68ch;
}

.prose img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ===========================================================================
   Motion preferences — honor reduced-motion across the whole theme
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
