/* tc-base.css — reset, elements, links, focus, typography defaults. */

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

html {
  background: var(--tc-bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--tc-bg);
  color: var(--tc-text);
  font-family: var(--tc-sans);
  font-size: var(--tc-fs-body);
  line-height: var(--tc-lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--tc-sans);
  font-weight: 700;
  line-height: var(--tc-lh-heading);
  letter-spacing: var(--tc-tracking-tight);
  margin: 0 0 var(--tc-space-4);
  text-wrap: balance;
}

h1 { font-size: var(--tc-fs-h1); line-height: var(--tc-lh-tight); }
h2 { font-size: var(--tc-fs-h2); }
h3 { font-size: var(--tc-fs-h3); font-weight: 500; }
h4 { font-size: var(--tc-fs-h4); font-weight: 500; }
h5, h6 { font-size: 1rem; font-weight: 500; }

p, ul, ol, dl, blockquote, figure, pre, table { margin: 0 0 var(--tc-space-6); }
p { text-wrap: pretty; }
li + li { margin-top: var(--tc-space-2); }

a { color: var(--tc-text); text-decoration: underline; text-decoration-color: var(--tc-border-strong); text-underline-offset: 3px; transition: color var(--tc-transition), text-decoration-color var(--tc-transition); }
a:hover { color: var(--tc-primary); text-decoration-color: currentColor; }
a:active { color: var(--tc-primary); }

:where(h1, h2, h3, h4, .tc-story__title, .tc-card, .tc-site__brand, .tc-site__nav, .tc-hero__index, .tc-series__item, .tc-tag, .tc-pagination) a { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--tc-focus);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--tc-primary); color: var(--tc-primary-ink); }

img, svg, video, canvas, iframe { max-width: 100%; height: auto; display: block; }
img { border-radius: var(--tc-radius); }

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

small { font-size: var(--tc-fs-small); }
strong, b { font-weight: 700; }

code, kbd, samp, pre { font-family: var(--tc-mono); font-size: .9em; }
:not(pre) > code {
  background: var(--tc-surface-raised);
  border: 1px solid var(--tc-border);
  border-radius: 2px;
  padding: .1em .35em;
  color: var(--tc-text);
}

blockquote {
  margin-inline: 0;
  padding-left: var(--tc-space-6);
  border-left: 2px solid var(--tc-primary);
  color: var(--tc-text);
}
blockquote cite { display: block; margin-top: var(--tc-space-3); font-family: var(--tc-mono); font-size: var(--tc-fs-micro); font-style: normal; color: var(--tc-muted); }

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], select, textarea {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  color: var(--tc-text);
  font-family: var(--tc-mono);
  font-size: var(--tc-fs-small);
  padding: .625rem .75rem;
  min-height: var(--tc-hit);
  width: 100%;
  max-width: 100%;
}
::placeholder { color: var(--tc-muted); opacity: 1; }
textarea { min-height: 8rem; line-height: 1.5; }
label { display: inline-block; font-family: var(--tc-mono); font-size: var(--tc-fs-meta); letter-spacing: var(--tc-tracking-meta); text-transform: uppercase; color: var(--tc-muted); }

input:disabled, select:disabled, textarea:disabled, button:disabled, [aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--tc-danger); }

/* Tables (base; .tc-table adds the editorial treatment) */
table { border-collapse: collapse; width: 100%; font-size: var(--tc-fs-small); }
th, td { text-align: left; padding: var(--tc-space-3); border-bottom: 1px solid var(--tc-border); vertical-align: top; }
th { font-family: var(--tc-mono); font-size: var(--tc-fs-micro); letter-spacing: .06em; text-transform: uppercase; color: var(--tc-muted); font-weight: 500; }
caption { caption-side: bottom; padding-top: var(--tc-space-3); font-family: var(--tc-mono); font-size: var(--tc-fs-micro); color: var(--tc-muted); text-align: left; }

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