/* ==========================================================================
   catonmydesk — Base
   Reset, document defaults, typography and a handful of utilities.
   Depends on tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  background-color: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  transition: background-color var(--t-base), color var(--t-base);
}

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

svg { flex: none; }

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; }

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

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

/* --------------------------------------------------------------------------
   Focus — visible, never ugly
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -110%);
  z-index: 999;
  background: var(--accent);
  color: var(--accent-on);
  padding: 0.65rem 1.15rem;
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: transform var(--t-base);
}

.skip-link:focus { transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  color: var(--text);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

h5 {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0;
}

p { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}

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

/* Inline links inside running prose get an underline */
.prose a,
.link-inline {
  text-decoration: underline;
  text-decoration-color: var(--accent-underline);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

.prose a:hover,
.link-inline:hover { text-decoration-color: currentColor; }

strong, b { color: var(--text); font-weight: 600; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-feature-settings: "liga" 0;
}

:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.12em 0.4em;
  color: var(--text);
  white-space: nowrap;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--sp-4);
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
}

/* Running prose blocks (About page, project detail copy, …) */
.prose > * + * { margin-top: var(--sp-4); }
.prose > h2 { margin-top: var(--sp-7); }
.prose > h3 { margin-top: var(--sp-6); }
.prose > ul,
.prose > ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.35rem; }
.prose li::marker { color: var(--accent); }

/* --------------------------------------------------------------------------
   Small shared text bits
   -------------------------------------------------------------------------- */

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.lede {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  line-height: var(--lh-loose);
  max-width: 56ch;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
  letter-spacing: -0.01em;
}

.muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

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

.wrap--narrow { max-width: var(--wrap-narrow); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.stack > * + * { margin-top: var(--sp-4); }
.center { text-align: center; }
.center .lede { margin-inline: auto; }

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   Print — make a project page printable without the chrome
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .hero__glow,
  .theme-switch { display: none !important; }
  body { background: #fff; color: #000; }
}
