/* =========================================================
   Base Styles — Mixed Living Knowledge Platform
   ========================================================= */

/* Inconsolata (SIL Open Font License, see assets/fonts/inconsolata/OFL.txt) */
@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/inconsolata/inconsolata-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/inconsolata/inconsolata-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;
}

/* -------------------------------------------------------
   CSS reset / normalize
   ------------------------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-4));
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--line-height-relaxed);
  max-width: 75ch;
  text-wrap: pretty;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

::selection {
  background: var(--brand-blue-100);
  color: var(--color-primary-900);
}

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

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

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-neutral-100);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

/* -------------------------------------------------------
   Lists
   ------------------------------------------------------- */

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

li {
  line-height: var(--line-height-relaxed);
}

/* -------------------------------------------------------
   Images & Media
   ------------------------------------------------------- */

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

/* -------------------------------------------------------
   Buttons
   ------------------------------------------------------- */

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

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

/* -------------------------------------------------------
   Form elements
   ------------------------------------------------------- */

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* -------------------------------------------------------
   Utility: visually hidden (accessible)
   ------------------------------------------------------- */

[hidden] {
  display: none !important;
}

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

/* -------------------------------------------------------
   Skip link
   ------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-600);
  color: white;
  font-weight: var(--font-weight-semibold);
  z-index: var(--z-top);
  border-radius: 0 0 var(--radius-md) 0;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* -------------------------------------------------------
   Focus ring (global)
   ------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Programmatic focus targets (headings, sections) do not need a ring */
[tabindex="-1"]:focus {
  outline: none;
}

/* Teal and dark surfaces need a light focus ring */
.on-dark :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

/* -------------------------------------------------------
   External link icon indicator
   ------------------------------------------------------- */

a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.75em;
  vertical-align: super;
  opacity: 0.7;
}
