/* Himari sample keepsake. Warm palette shared with the Yuisho site.
   Mobile first. System fonts only. */

:root {
  --color-bg: #faf6f0;
  --color-bg-alt: #f3ece1;
  --color-surface: #ffffff;
  --color-text: #2b2420;
  --color-text-soft: #5f564d;
  --color-accent: #b5793f;
  --color-accent-text: #8a5a2b;
  --color-accent-soft: #e7d3b7;
  --color-border: #e4dacb;
  --color-paper: #fffdf9;
  --shadow-soft: 0 12px 30px rgba(43, 36, 32, 0.08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Yu Mincho", "YuMincho",
    "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", "Segoe UI", Roboto, sans-serif;
  --header-h: 57px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent-text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

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

.wrap {
  width: min(100% - 40px, 40rem);
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4vw, 2rem);
  font-weight: 500;
  line-height: 1.35;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, 72rem);
  min-height: var(--header-h);
}

.brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: inherit;
}

.lang-toggle {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}

.lang-toggle:hover {
  border-color: var(--color-accent);
}

/* Opening */

.hero-screen {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  overflow: hidden;
  background: radial-gradient(70% 60% at 50% 46%, rgba(248, 220, 154, 0.55), rgba(250, 246, 240, 0) 72%);
}

.sun-graphic {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(78vw, 420px);
  height: auto;
  transform: translate(-50%, -54%);
  pointer-events: none;
}

.hero-layout {
  position: relative;
  z-index: 1;
  padding: 48px 0 36px;
  text-align: center;
  background: radial-gradient(
    closest-side,
    rgba(250, 246, 240, 0.9),
    rgba(250, 246, 240, 0.62) 58%,
    rgba(250, 246, 240, 0) 78%
  );
}

.hero-layout .eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(250, 246, 240, 0.94);
}

.hero-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4.4rem, 22vw, 7.5rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.08em;
}

.reading {
  margin: 12px 0 0;
  font-size: 1.15rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--color-text-soft);
}

.romaji {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.rule {
  width: 36px;
  height: 2px;
  margin: 18px auto;
  border: 0;
  border-radius: 2px;
  background: var(--color-accent);
}

.born {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-soft);
}

.born li {
  display: flex;
  align-items: center;
}

.born li + li::before {
  content: "";
  width: 4px;
  height: 4px;
  margin: 0 10px;
  border-radius: 50%;
  background: var(--color-accent);
}

.next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 32px;
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  color: var(--color-accent-text);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  touch-action: manipulation;
}

.next::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

/* Kanji */

.meaning {
  padding: 12px 0 72px;
}

.meaning-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  text-align: center;
}

.meaning-head h2 {
  margin: 0;
}

.bloom {
  display: block;
  width: 58px;
  height: 58px;
  color: #e4b15f;
}

.kanji-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kanji-card {
  padding: 22px 12px 18px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.kanji-char {
  margin: 0;
  font-family: var(--serif);
  font-size: 3.2rem;
  line-height: 1;
}

.kanji-kana-label {
  margin: 12px 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.kanji-read {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
}

.kanji-card h3 {
  margin: 10px 0 0;
  font-size: 1.05rem;
}

.kanji-body {
  margin: 6px 0 0;
  color: var(--color-text-soft);
  font-size: 0.92rem;
  text-wrap: balance;
}

/* Chapters */

.chapter {
  padding: 64px 0;
}

.why,
.letter-chapter {
  background: var(--color-bg-alt);
}

.letter-chapter {
  min-height: calc(100svh - var(--header-h));
}

.parents {
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--color-accent-soft);
}

.parents p {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.parents p:last-child {
  margin-bottom: 0;
}

.sign {
  margin: 18px 0 0;
  font-family: var(--serif);
  text-align: right;
  color: var(--color-text-soft);
}

/* Birth day */

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.fact {
  margin: 0;
  padding: 14px 14px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
}

.fact-date dd {
  white-space: nowrap;
}

.fact dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.fact dd {
  margin: 2px 0 0;
  font-size: 1.08rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fact-weather dd {
  color: var(--color-accent-text);
}

.nowrap {
  white-space: nowrap;
}

.timeline {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 22px 26px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-bg);
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.35em;
  bottom: 0;
  width: 1px;
  background: var(--color-accent-soft);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li:last-child::after {
  display: none;
}

.timeline h3 {
  margin: 0;
  font-size: 1rem;
}

.timeline p {
  margin: 2px 0 0;
  color: var(--color-text-soft);
}

/* Letter */

.letter-chapter .wrap {
  display: grid;
  gap: 8px;
}

.envelope {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-paper);
  box-shadow: var(--shadow-soft);
}

.flap {
  display: none;
}

.letter {
  padding: 28px 22px 12px;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.letter-to {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 1.45rem;
}

.letter p {
  margin: 0 0 14px;
}

.letter-sign {
  margin: 22px 0 0;
  font-family: var(--serif);
  text-align: right;
}

.letter-date {
  margin: 2px 0 0;
  text-align: right;
  color: var(--color-text-soft);
  font-size: 0.92rem;
}

.seal {
  display: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.wax {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 8px 10px rgba(120, 52, 28, 0.28));
}

.seal-open-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seal-kicker {
  font-family: var(--serif);
  font-size: 1.28rem;
}

.seal-hint {
  color: var(--color-text-soft);
  font-size: 0.88rem;
}

.seal-close-label {
  display: none;
}

/* Sealed until the seal is tapped. no-js readers see the letter instead. */

.js .envelope:not(.is-open) {
  min-height: 360px;
  overflow: hidden;
  background: linear-gradient(180deg, #fbf7f1 0%, #f4e7d6 100%);
}

.js .envelope:not(.is-open) .flap {
  display: block;
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 0;
  height: 58%;
  background: linear-gradient(180deg, #fbf6ef 0%, #eddcc6 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: 50% 0;
  pointer-events: none;
}

.js .envelope:not(.is-open)::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.15), rgba(214, 190, 160, 0.45));
  clip-path: polygon(0 32%, 50% 0, 100% 32%, 100% 100%, 0 100%);
  pointer-events: none;
}

.js .envelope:not(.is-open) #letter {
  display: none;
}

.js .seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  text-align: center;
}

.js .envelope:not(.is-open) .seal {
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: 24px 20px 36px;
}

.js .envelope.is-opening .flap {
  transform: translateY(-60%);
  opacity: 0;
}

.js .envelope.is-opening .wax,
.js .envelope.is-opening .seal-open-label {
  opacity: 0;
}

.js .envelope.is-open {
  background: var(--color-paper);
}

.js .envelope.is-open .seal {
  min-height: 48px;
  padding: 0 16px 18px;
  color: var(--color-accent-text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.js .envelope.is-open .wax,
.js .envelope.is-open .seal-open-label {
  display: none;
}

.js .envelope.is-open .seal-close-label {
  display: inline;
}

/* Closing */

.closing {
  padding: 72px 0 calc(80px + env(safe-area-inset-bottom));
  text-align: center;
}

.closing-bloom {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
}

.closing-from {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.45rem;
  letter-spacing: 0.06em;
}

.closing-note {
  margin: 18px 0 0;
  font-size: 0.92rem;
}

.closing-note a {
  color: var(--color-accent-text);
  text-underline-offset: 3px;
}

.closing-note a:hover {
  color: var(--color-text);
}

/* Wider screens */

@media (min-width: 720px) {
  .letter {
    padding: 40px 48px 16px;
  }

  .kanji-char {
    font-size: 3.8rem;
  }
}

@media (max-height: 680px) {
  .hero-screen {
    min-height: 0;
  }

  .hero-name {
    font-size: clamp(3.4rem, 18vw, 5rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .motion .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }

  .motion .reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .motion .timeline .reveal:nth-child(2) {
    transition-delay: 0.08s;
  }

  .motion .timeline .reveal:nth-child(3) {
    transition-delay: 0.16s;
  }

  .motion .timeline .reveal:nth-child(4) {
    transition-delay: 0.24s;
  }

  .flap,
  .wax,
  .seal-open-label {
    transition: transform 0.5s ease, opacity 0.45s ease;
  }

  .letter.is-rising {
    animation: rise 0.6s ease;
  }

  .seal:active .wax {
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion .reveal,
  .letter.is-rising {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}
