/* Fluks — reset, element defaults, typography, utilities */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; /* every control has its own :active state */
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-feature-settings: "cv11"; /* Inter: single-storey a reads calmer at text size */
  -webkit-font-smoothing: antialiased;
}

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

::selection {
  background-color: var(--color-selection);
  color: var(--color-on-selection);
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

h1 {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
}

h2 {
  font-size: var(--fs-lg);
}

h3 {
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
}

p {
  max-width: var(--measure);
  text-wrap: pretty;
}

p,
li,
dd,
dt {
  overflow-wrap: break-word;
  hyphens: auto;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--color-accent);
  text-decoration-thickness: var(--border-width);
  text-underline-offset: 0.22em;
  transition: color var(--duration-fast) ease, text-decoration-color var(--duration-fast) ease;
}

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

address {
  font-style: normal;
}

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

/* Scrollbar — Chromium/Safari: thin, no arrow buttons, thicker on hover, accent while dragging */
::-webkit-scrollbar {
  inline-size: var(--scrollbar-size);
  block-size: var(--scrollbar-size);
}

::-webkit-scrollbar-button {
  display: none;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background-color: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  border: var(--scrollbar-inset) solid transparent;
  border-radius: var(--radius-pill);
  background-color: var(--scrollbar-thumb);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  border-width: var(--scrollbar-inset-hover);
  background-color: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-thumb:active {
  border-width: var(--scrollbar-inset-hover);
  background-color: var(--scrollbar-thumb-active);
}

/* Firefox has no ::-webkit-scrollbar: standard properties give a thin bar (no hover/active styling).
   Only applied there, because in Chromium they would override the rules above. */
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--color-bg);
  }
}

/* Utilities */
.container {
  width: min(100% - 2 * var(--gutter), var(--container-max));
  margin-inline: auto;
}

.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;
}

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:hover {
  transform: none;
  color: var(--color-on-accent);
}

/* Reduced motion: keep colour feedback, drop movement */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    transition-property: color, background-color, border-color, text-decoration-color, opacity !important;
  }
}
