/* ==========================================================================
   Base Styles — Microsoft-adjacent element defaults
   ========================================================================== */

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: light;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--fw-regular);
  line-height: var(--leading-normal);
  letter-spacing: 0;
  color: var(--color-ink);
  background-color: var(--color-paper);
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--leading-tight);
  color: var(--color-ink);
  letter-spacing: 0;
  margin-top: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-5);
}

h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: var(--text-h3);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--text-h4);
  margin-bottom: var(--space-2);
}

h5, h6 {
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--text-small);
  color: var(--color-ink-soft);
  text-transform: none;
  letter-spacing: 0;
}

/* Body copy */
p {
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--color-ink-soft);
  line-height: var(--leading-relaxed);
}

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

.lede,
p.lede {
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-ink);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  max-width: 60ch;
}

/* Links */
a {
  color: var(--color-brand-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: currentColor;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-brand-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

strong, b {
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
}

em, i {
  font-style: italic;
}

/* Lists */
ul, ol {
  padding-left: 0;
  margin: 0 0 var(--space-5) 0;
  list-style: none;
}

ul li,
ol li {
  position: relative;
  padding-left: var(--space-5);
  margin-bottom: var(--space-3);
  line-height: var(--leading-relaxed);
  color: var(--color-ink-soft);
}

ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 12px;
  height: 1px;
  background-color: var(--color-border-strong);
}

ol {
  counter-reset: cn-list;
}

ol li {
  counter-increment: cn-list;
}

ol li::before {
  content: counter(cn-list) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: var(--fw-semibold);
  color: var(--color-brand-primary);
  font-size: 0.95em;
  line-height: inherit;
}

li:last-child {
  margin-bottom: 0;
}

li ul,
li ol {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* Blockquote — Communication Blue border-top, never border-left */
blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-5) 0 0 0;
  border: none;
  border-top: 1px solid var(--color-brand-primary);
  background: transparent;
  border-radius: 0;
  max-width: 56ch;
}

blockquote p {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: var(--leading-snug);
  color: var(--color-ink);
  margin-bottom: var(--space-4);
  font-style: normal;
}

blockquote cite,
blockquote footer {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--text-small);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-ink-soft);
}

/* Horizontal rule */
hr {
  border: none;
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-10) 0;
}

hr.hr--ornament {
  width: 48px;
  margin: var(--space-6) 0;
  background-color: var(--color-border-strong);
}

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

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-surface-alt);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  color: var(--color-ink);
}

pre {
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  line-height: var(--leading-snug);
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: var(--space-6) 0;
}

figcaption {
  font-size: var(--text-small);
  color: var(--color-ink-soft);
  margin-top: var(--space-2);
  font-style: normal;
  font-family: var(--font-body);
}

::selection {
  background-color: var(--color-brand-primary);
  color: var(--color-paper);
}

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