/* ==========================================================================
   EIMEI — Base
   @font-face, reset, base typography, focus, motion-safety scaffolding.
   ========================================================================== */

/* ---- Fonts (self-hosted, Latin-only subset — see assets/fonts) ---- */
@font-face {
  font-family: 'Shippori Mincho';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/shippori-mincho-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Shippori Mincho';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/shippori-mincho-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/eb-garamond-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/inter-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
img, picture, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

/* ---- Base document ---- */
html {
  background: var(--color-bg);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-weight: 400;
  line-height: var(--lh-heading);
  text-wrap: balance;
}

p { max-width: 70ch; }

/* ---- Section theming ----
   Apply .theme-dark to any section with a Sumi background so text,
   muted text, borders, and focus rings flip to the inverse-calibrated
   tokens. Never hand-pick a color inside a section — use these. */
.theme-dark {
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
}
.theme-dark .text-muted { color: var(--color-text-inverse-muted); }
.theme-light { background: var(--color-bg); color: var(--color-text); }
.text-muted { color: var(--color-text-muted); }

/* ---- Focus ----
   Outline is always drawn with a positive offset, so it sits against the
   surrounding PAGE background rather than the focused element's own
   fill — that's what lets one ring color stay AA-compliant even when a
   dark button sits on a light section (see tokens.css comment). */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}
.theme-dark :focus-visible {
  outline-color: var(--color-focus-inverse);
}

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--section-px);
}

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

.section {
  padding-block: var(--section-py);
}

.sr-only {
  position: absolute;
  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;
  top: -100%;
  left: var(--space-2);
  z-index: 300;
  background: var(--color-sumi);
  color: var(--color-kinari);
  padding: var(--space-1) var(--space-2);
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-2);
}

/* ---- Motion-safety scaffolding ----
   [data-reveal] elements are never hidden by CSS — animations.js sets
   their pre-animation state via GSAP only if it actually runs. If JS
   fails to load, content simply renders in its final, visible state. */

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