/* ==========================================================================
   YK Type — shared shell: faces, tokens, nav, footer
   ========================================================================== */

/* ---------- the logo face: uppercase only, used for the wordmark ---------- */

@font-face {
  font-family: "YK Type Logo";
  src: url("fonts/YKTypeLogo.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* ---------- Senren — 6 weights ---------- */

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Senren";
  src: url("fonts/Senren-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Seirei — 6 weights ---------- */

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Seirei";
  src: url("fonts/Seirei-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Yuubi — 7 weights ---------- */

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yuubi";
  src: url("fonts/Yuubi-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #e8e8e6;
  --ink: #4c4c4a;
  --ink-strong: #2c2c2a;
  /* dark enough to hold 4.5:1 on the paper, since the labels are set small */
  --ink-mute: #666660;
  --rule: #c3c3bd;
  --wash: #dededa;
  --accent: #1b3a6b;
  --gutter: clamp(20px, 3.4vw, 48px);
  --font-ui: "Work Sans", system-ui, sans-serif;
  --font-logo: "YK Type Logo", "Work Sans", sans-serif;
  --font-senren: "Senren", system-ui, sans-serif;
  --font-seirei: "Seirei", Georgia, serif;
  --font-yuubi: "Yuubi", Georgia, serif;
  color-scheme: light;
}

/* the specimen pages can flip the page to dark to judge the type reversed */
[data-theme="dark"] {
  --paper: #1a1a19;
  --ink: #b9b9b3;
  --ink-strong: #f0f0ea;
  --ink-mute: #8a8a83;
  --rule: #37372f;
  --wash: #242422;
  --accent: #9fb8dc;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--ink); color: var(--paper); }

body {
  background: var(--paper);
  color: var(--ink);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.shell { padding: 0 var(--gutter); }

.label {
  font-size: clamp(10px, 0.85vw, 12px);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

hr { border: 0; border-top: 1px solid var(--rule); }

/* ---------- nav ---------- */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: clamp(20px, 3vw, 52px);
  /* the bar stays with the reader; the paper behind it hides what scrolls under */
  position: sticky;
  top: 0;
  z-index: 10;
  padding: clamp(24px, 3vw, 44px) 0 clamp(14px, 1.6vw, 22px);
  background: var(--paper);
  transition: background-color 0.3s ease;
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav ul {
  display: flex;
  gap: clamp(18px, 3vw, 52px);
  list-style: none;
}

/* the logo sits in the top-left corner of every page */
.nav__left {
  display: flex;
  align-items: baseline;
  gap: clamp(20px, 3.6vw, 64px);
}

.nav__logo {
  font-family: var(--font-logo);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(18px, 1.7vw, 26px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink-strong);
  white-space: nowrap;
}

h1.nav__logo { font-size: clamp(18px, 1.7vw, 26px); }

.nav__count {
  display: inline-block;
  min-width: 1.6em;
  margin-left: 0.5em;
  padding: 0 0.4em;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.8em;
  line-height: 1.5;
  text-align: center;
}

.nav__count[hidden] { display: none; }

.theme-toggle {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.theme-toggle svg {
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
}

.theme-toggle circle { fill: none; stroke: currentColor; stroke-width: 1.2; }
.theme-toggle path { fill: currentColor; }

/* the nav holds its colour — no hover or current-page tint */

/* ---------- page transitions ---------- */

/* moving between pages, a family's name glides from where it was to where
   it lands, and the bar holds still while the rest cross-fades */
@view-transition { navigation: auto; }

.nav { view-transition-name: nav; }

::view-transition-group(*) {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.22, 0.7, 0.2, 1);
}

/* the old page holds still and the new one fades in over it; fading both at
   once dips through a near-blank frame, and the default additive blend would
   flare where they overlap */
::view-transition-old(root),
::view-transition-new(root) { mix-blend-mode: normal; }

::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: 450ms ease-out both vt-in; }

@keyframes vt-in { from { opacity: 0; } }

/* the specimen title normally settles in on arrival; after a transition it
   is already in place */
.is-arriving .title,
.is-arriving .title__kanji { animation: none; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- wordmark ---------- */

.wordmark {
  /* the logo face is drawn as caps only — never set it in lowercase */
  font-family: var(--font-logo);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(30px, 4.6vw, 62px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink-strong);
}

.wordmark--hero { padding: clamp(48px, 9vw, 130px) 0 clamp(40px, 7vw, 96px); }

/* ---------- footer ---------- */

.foot {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
  gap: 32px clamp(20px, 3vw, 48px);
  border-top: 1px solid var(--rule);
  padding: clamp(32px, 4vw, 56px) 0 clamp(28px, 3.5vw, 48px);
  color: var(--ink-mute);
}

.foot__brand { display: flex; flex-direction: column; gap: 8px; }
.foot__logo { color: var(--ink-strong); }
.foot__head { margin-bottom: 14px; font: inherit; color: var(--ink-strong); }
.foot ul { list-style: none; display: grid; gap: 8px; }
.foot a:hover { color: var(--accent); }

.foot__currency select {
  appearance: none;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-strong);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  body, .nav { transition: none; }
  .nav-sheet, .nav-sheet li, .nav-sheet__theme { transition: none !important; transform: none; }
}

/* ---------- phone menu ---------- */

.nav__menu,
.nav-sheet { display: none; }

.nav__menu {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-strong);
  cursor: pointer;
}

@media (max-width: 720px) {
  /* without script the logo takes its own line and the links wrap below it */
  .nav { position: static; flex-wrap: wrap; justify-content: flex-start; gap: 12px clamp(18px, 3vw, 52px); }
  .nav__left { display: contents; }
  .nav__logo { flex-basis: 100%; }

  .nav.has-menu { flex-wrap: nowrap; align-items: baseline; gap: 22px; }
  .nav.has-menu .nav__logo { flex-basis: auto; margin-right: auto; }
  .nav.has-menu .nav__left ul,
  .nav.has-menu > ul > li:not(:last-child) { display: none; }
  .nav.has-menu .nav__menu { display: block; }

  .nav-sheet {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    inset: 0;
    z-index: 9;
    padding: calc(var(--nav-h, 80px) + 24px) var(--gutter) 32px;
    background: var(--paper);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }

  .nav-sheet ul { list-style: none; }

  .nav-sheet a {
    display: block;
    padding: 6px 0;
    font-size: clamp(36px, 11vw, 52px);
    font-weight: 300;
    letter-spacing: 0.01em;
    line-height: 1.15;
    text-transform: uppercase;
    color: var(--ink-strong);
  }

  .nav-sheet li,
  .nav-sheet__theme {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 0.7, 0.2, 1);
  }

  .nav-sheet__theme {
    appearance: none;
    align-self: flex-start;
    border: 0;
    background: none;
    padding: 0;
    color: var(--ink-mute);
    cursor: pointer;
  }

  .nav-sheet__theme svg { width: 1em; height: 1em; vertical-align: -0.12em; margin-right: 0.4em; }
  .nav-sheet__theme circle { fill: none; stroke: currentColor; stroke-width: 1.2; }
  .nav-sheet__theme path { fill: currentColor; }

  .is-menu-open { overflow: hidden; }
  .is-menu-open .nav { position: relative; z-index: 10; }

  .is-menu-open .nav-sheet {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
  }

  /* the links arrive one after another, top to bottom */
  .is-menu-open .nav-sheet li,
  .is-menu-open .nav-sheet__theme {
    opacity: 1;
    transform: none;
    transition-delay: calc(0.06s + var(--i) * 0.05s);
  }

  .foot { grid-template-columns: 1fr 1fr; }
  .foot__brand { grid-column: 1 / -1; }
}
