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

  * {
    margin: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body,
  h1,
  h2,
  h3,
  p,
  dl,
  dd,
  dt,
  ol,
  ul,
  figure {
    margin: 0;
  }

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

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

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

  button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  html {
    min-height: 100%;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.7;
    letter-spacing: 0.004em;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
      radial-gradient(
        120% 60% at 50% -18%,
        color-mix(in oklab, var(--surface) 92%, transparent),
        transparent 68%
      ),
      repeating-linear-gradient(
        to bottom,
        transparent 0 47px,
        color-mix(in oklab, var(--line) 24%, transparent) 47px 48px
      );
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: 1.14;
    letter-spacing: 0.012em;
    text-wrap: balance;
  }

  p {
    text-wrap: pretty;
  }

  strong {
    font-weight: 600;
  }

  em {
    font-style: normal;
  }

  small {
    font-size: 0.75em;
  }

  a {
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.24em;
    text-decoration-color: color-mix(in oklab, var(--ink) 28%, transparent);
    transition:
      color 0.2s var(--ease-soft),
      text-decoration-color 0.2s var(--ease-soft);
  }

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

  button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

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

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

  ::marker {
    color: var(--muted);
  }

  .sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 500;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--on-seal);
    background: var(--seal);
    border-radius: 999px;
    transform: translateY(-160%);
    transition: transform 0.25s var(--ease-out);
  }

  .skip-link:focus-visible {
    transform: translateY(0);
    color: var(--on-seal);
  }

  .grain {
    position: fixed;
    inset: 0;
    z-index: 250;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
    background-size: 160px 160px;
  }

  .scroll-progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 300;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  .noscript {
    position: fixed;
    inset: auto 16px 16px;
    z-index: 400;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }

  #top {
    scroll-margin-top: calc(var(--header-h) + 10px);
  }

  @media (max-width: 720px) {
    body {
      font-size: 15px;
      background-image:
        radial-gradient(
          140% 50% at 50% -12%,
          color-mix(in oklab, var(--surface) 94%, transparent),
          transparent 66%
        ),
        repeating-linear-gradient(
          to bottom,
          transparent 0 47px,
          color-mix(in oklab, var(--line) 18%, transparent) 47px 48px
        );
    }
  }
}
