/* ==========================================================================
   YK Type: specimen page (Senren, Seirei, Yuubi)
   The page sets --font-specimen to the family it is showing. One idea per
   section, in this order: the name as tester, styles, information,
   characters, buy. Motion lives in specimen.js; this file only sets resting states.
   ========================================================================== */

/* anchored sections land below the sticky bar */
.hero, .styles, .info, .glyphs, .buy { scroll-margin-top: var(--nav-h, 0px); }

.section__head {
  margin-bottom: clamp(24px, 3vw, 44px);
  color: var(--ink-mute);
}

/* sections that rise in as they scroll into view start hidden, but only once
   the script is known to be running, and never for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .js-motion [data-reveal],
  .js-motion .tester__hint,
  .js-motion .tester__bar,
  .js-motion .hero__foot,
  .js-motion:not(.is-arriving) .title,
  .js-motion:not(.is-arriving) .title__kanji { opacity: 0; }
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(40px, 8vw, 120px) 0 clamp(8px, 1.5vw, 20px);
}

.masthead__name {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

/* the name hugs its text, so its box matches the homepage word it
   transitions from */
.title {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-specimen);
  font-weight: 400;
  font-size: clamp(76px, 21vw, 320px);
  line-height: 0.95;
  letter-spacing: 0.005em;
  color: var(--ink-strong);
  /* the name is also the tester: click it and type */
  overflow-wrap: anywhere;
  outline: 0;
  caret-color: var(--accent);
  cursor: text;
}

.title__kanji {
  flex: none;
  writing-mode: vertical-rl;
  font-family: var(--font-specimen);
  /* each family draws its kanji in one cut only and maps the others to empty
     glyphs, so any other weight would leave a blank gap; the page names it */
  font-weight: var(--kanji-weight);
  /* the homepage size, 0.15 of the title, so the two match mid-transition */
  font-size: clamp(11.4px, 3.15vw, 48px);
  line-height: 1;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin: 0.12em 0 0 0.12em;
}

.hero__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: clamp(18px, 2vw, 26px);
  border-top: 1px solid var(--rule);
}

.hero__facts { color: var(--ink-mute); }

.hero__actions { display: flex; gap: 12px; }

/* ---------- buy bar: the hero's buttons, kept in reach ---------- */

.buybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px var(--gutter);
  border-top: 1px solid var(--rule);
  background: var(--paper);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 0.7, 0.2, 1);
}

.buybar.is-shown { transform: none; }
.buybar__name { color: var(--ink-strong); }
.buybar .button { padding: 10px 20px; }

@media (prefers-reduced-motion: reduce) {
  .buybar { transition: none; }
}

@media (max-width: 720px) {
  .buybar__name { display: none; }
  .buybar .hero__actions { flex: 1; }
  .buybar .button { flex: 1; text-align: center; }
}

.button {
  display: inline-block;
  padding: 14px 26px;
  border: 1px solid var(--ink-strong);
  background: var(--ink-strong);
  color: var(--paper);
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.button:hover { opacity: 0.85; }

.button--quiet { background: none; color: var(--ink-strong); }

.button--quiet:hover { opacity: 1; background: var(--ink-strong); color: var(--paper); }

/* ---------- styles: one full-width line per weight ---------- */

.styles {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 3.5vw, 56px) 0 clamp(40px, 6vw, 88px);
}

.style {
  display: grid;
  grid-template-columns: 9em minmax(0, 1fr);
  align-items: baseline;
  gap: clamp(12px, 2vw, 32px);
}

.style + .style { margin-top: clamp(8px, 1.5vw, 24px); }

.style__name { color: var(--ink-mute); }

.style__word {
  font-family: var(--font-specimen);
  font-size: clamp(56px, 12vw, 200px);
  /* tall enough for accented capitals and descenders, which clipping would cut */
  line-height: 1.2;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
  outline: 0;
  caret-color: var(--accent);
  cursor: text;
}

/* ---------- tester controls, under the name ---------- */

.tester__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 40px;
  flex-wrap: wrap;
  margin-top: clamp(14px, 1.6vw, 22px);
  padding: clamp(14px, 1.6vw, 20px) 0;
  border-top: 1px solid var(--rule);
}

.tester__hint {
  margin-top: clamp(14px, 1.6vw, 22px);
  color: var(--ink-mute);
  transition: opacity 0.3s ease;
}

/* visibility, not opacity, which the arrival animation sets inline */
.hero:not(.is-name) .title__kanji { visibility: hidden; }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
}

.seg button {
  appearance: none;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  padding: 4px 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.seg button:hover { color: var(--ink); }

.seg button[aria-pressed="true"] {
  color: var(--ink-strong);
  border-bottom-color: var(--ink-strong);
}

.tester__size {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-mute);
}

.tester__size output { min-width: 3.5em; color: var(--ink-strong); }

.tester__size input {
  appearance: none;
  width: clamp(120px, 14vw, 220px);
  height: 1px;
  background: var(--rule);
  cursor: pointer;
}

.tester__size input::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-strong);
}

.tester__size input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--ink-strong);
}

/* ---------- characters ---------- */

.glyphs {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 3.5vw, 56px) 0 clamp(40px, 6vw, 88px);
}

.glyphs__body {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 5vw, 80px);
}

/* left: the hovered character, large */
.zoom {
  position: sticky;
  top: calc(var(--nav-h, 0px) + clamp(16px, 2vw, 28px));
  align-self: start;
}

.zoom__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-family: var(--font-specimen);
  font-size: clamp(180px, 24vw, 380px);
  line-height: 1;
  color: var(--ink-strong);
}

.zoom__caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  color: var(--ink-mute);
}

/* right: the character set, in open space */
.grid__set {
  margin: clamp(22px, 2.4vw, 34px) 0 10px;
  color: var(--ink-mute);
}

.grid__set:first-child { margin-top: 0; }

.grid__chars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(40px, 4.2vw, 64px), 1fr));
}

.grid__cell {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 0;
  background: none;
  font-family: var(--font-specimen);
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: inherit;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s ease;
}

.grid__cell:hover,
.grid__cell.is-active { color: var(--accent); }

.grid__rest[hidden] { display: none; }

.glyphs__more {
  appearance: none;
  margin-top: clamp(20px, 2vw, 28px);
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  font-family: var(--font-ui);
  color: var(--ink);
  cursor: pointer;
}

.glyphs__more:hover { color: var(--accent); }

/* ---------- information: the facts beside the story ---------- */

.info {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 3.5vw, 56px) 0 clamp(40px, 6vw, 88px);
}

.info__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 110px);
  align-items: start;
}

.info__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(24px, 3vw, 48px);
}

.info__facts div {
  padding: 0 0 clamp(14px, 1.6vw, 20px);
  margin-bottom: clamp(18px, 2vw, 26px);
  border-bottom: 1px solid var(--rule);
}

.info__facts dt { color: var(--ink-strong); margin-bottom: 6px; }

.info__facts dd { font-size: clamp(14px, 1.05vw, 16px); line-height: 1.55; color: var(--ink); }

.info__facts a { border-bottom: 1px solid var(--rule); }
.info__facts a:hover { color: var(--accent); }

.info__languages summary {
  cursor: pointer;
  list-style: none;
}

.info__languages summary::-webkit-details-marker { display: none; }
.info__languages summary::after { content: ' +'; color: var(--ink-mute); }
.info__languages details[open] summary::after { content: ' \2013'; }
.info__languages summary:hover { color: var(--accent); }

.info__list { margin-top: 8px; color: var(--ink-mute); font-size: 13px; line-height: 1.8; }

.info__story {
  max-width: 34em;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.6;
  color: var(--ink-strong);
}

/* ---------- buy ---------- */

.buy {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 3.5vw, 56px) 0 clamp(40px, 6vw, 88px);
}

.buy__panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 110px);
  min-height: 12em;
}

.buy__choose { display: grid; gap: clamp(28px, 3vw, 44px); }

.buy__legend {
  display: flex;
  gap: 0.9em;
  margin-bottom: 8px;
  color: var(--ink-strong);
}

.buy__step { color: var(--ink-mute); }

.buy__options { list-style: none; border-top: 1px solid var(--rule); }

/* each choice is a plain row: a mark, the name, and what it covers */
.buy__option {
  appearance: none;
  display: grid;
  grid-template-columns: 14px 9em minmax(0, 1fr);
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}

.buy__option::before {
  content: '';
  align-self: center;
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink-mute);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.buy__options--one .buy__option::before { border-radius: 50%; }

.buy__option:hover,
.buy__option[aria-pressed="true"] { color: var(--ink-strong); }

.buy__option[aria-pressed="true"]::before {
  border-color: var(--ink-strong);
  background: var(--ink-strong);
}

.buy__option:disabled { cursor: default; }

.buy__option-label {
  font-size: clamp(12px, 0.95vw, 14px);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.buy__option-detail { font-size: 13px; line-height: 1.5; color: var(--ink-mute); }

.buy__summary {
  align-self: start;
  position: sticky;
  top: calc(var(--nav-h, 0px) + clamp(16px, 2vw, 28px));
  border-top: 1px solid var(--ink-strong);
  padding-top: clamp(16px, 2vw, 24px);
}

.buy__total {
  font-weight: 300;
  font-size: clamp(48px, 6vw, 96px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-strong);
}

.buy__line { margin-top: 12px; color: var(--ink-mute); line-height: 1.7; }

.buy__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: clamp(18px, 2vw, 28px);
}

.buy__add {
  appearance: none;
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--ink-strong);
  background: var(--ink-strong);
  color: var(--paper);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.buy__add:hover { opacity: 0.85; }
.buy__add:disabled { opacity: 0.35; cursor: default; }

.buy__add--quiet { background: none; color: var(--ink-strong); }

.buy__terms { margin-top: 14px; color: var(--ink-mute); line-height: 1.7; }
.buy__terms a { color: var(--ink); border-bottom: 1px solid var(--rule); }

.buy__status { margin-top: 12px; color: var(--ink-strong); line-height: 1.7; }
.buy__status:empty { display: none; }

.buy__note { margin-top: 14px; color: var(--ink-mute); line-height: 1.8; }
.buy__note a { color: var(--ink); border-bottom: 1px solid var(--rule); }
.buy__note a:hover { color: var(--accent); }

/* ---------- narrower screens ---------- */

@media (max-width: 900px) {
  .glyphs__body, .buy__panel, .info__body { grid-template-columns: 1fr; }
  .zoom { position: static; }
  .zoom__glyph { aspect-ratio: 3 / 2; font-size: clamp(150px, 34vw, 260px); }
  .buy__summary { position: static; }
}

@media (max-width: 720px) {
  .style { grid-template-columns: 1fr; gap: 0; }
  .info__facts { grid-template-columns: 1fr; }
  .buy__option { grid-template-columns: 14px minmax(0, 1fr); }
  .buy__option-detail { grid-column: 2; }
}
