/* Hoshilua Studio — paper and ink for the studio, a moonlit night for each game.
   Self-hosted OFL fonts only (no third-party requests): Cormorant Garamond for Latin display,
   Shippori Mincho (subset to the Japanese pages) for Japanese display, system sans for body text. */

@font-face { font-family: "Cormorant"; src: url("/assets/fonts/cormorant-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("/assets/fonts/cormorant-500.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Shippori"; src: url("/assets/fonts/shippori-500.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  /* paper */
  --paper: #f4efe6;
  --paper-2: #ebe4d7;
  --ink: #25211e;
  --ink-2: #6a6159;
  --ink-3: #998f85;
  --rule: rgba(37, 33, 30, 0.14);
  --accent: #8c6a3f;
  /* night */
  --night: #171e30;
  --night-2: #1f2739;
  --moon: #ede4d3;
  --moon-2: #b8b0a2;
  --moon-3: #8a8679;
  --rule-night: rgba(237, 228, 211, 0.14);
  --accent-night: #cdb283;

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-2: var(--ink-2);
  --fg-3: var(--ink-3);
  --line: var(--rule);
  --gold: var(--accent);

  --latin: "Cormorant", "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --mincho: "Shippori", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wide: 1200px;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
.lang-zh {
  --mincho: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}
.lang-en { --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif; }

/* The studio follows the reader's light / dark preference; every game page is always night. */
@media (prefers-color-scheme: dark) {
  .section-studio { --bg: var(--night); --fg: var(--moon); --fg-2: var(--moon-2); --fg-3: var(--moon-3); --line: var(--rule-night); --gold: var(--accent-night); color-scheme: dark; }
}
body:not(.section-studio) { --bg: var(--night); --fg: var(--moon); --fg-2: var(--moon-2); --fg-3: var(--moon-3); --line: var(--rule-night); --gold: var(--accent-night); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 16px/1.9 var(--sans); letter-spacing: 0.03em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.lang-en body, body.lang-en { letter-spacing: 0; line-height: 1.7; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
svg { display: block; }
::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); }
:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 4px; border-radius: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
p { margin: 0 0 1em; }

/* ——— Header ——— */
.top {
  max-width: var(--wide); margin: 0 auto; padding: 28px var(--gutter);
  display: flex; align-items: center; gap: 32px; position: relative; z-index: 2;
}
.top-brand { display: flex; align-items: center; gap: 14px; }
.brand .svg-wordmark { height: 22px; width: auto; }
.section-studio .top-brand { visibility: hidden; }  /* the hero already shows the wordmark */
.brand-game { font-family: var(--mincho); font-size: 18px; letter-spacing: 0.16em; }
.lang-en .brand-game { font-family: var(--latin); font-size: 22px; letter-spacing: 0.01em; }
.brand-studio .svg-mark-a { width: 26px; height: 26px; opacity: 0.6; transition: opacity 0.3s; }
.brand-studio:hover .svg-mark-a { opacity: 1; }
.links { display: flex; gap: 28px; margin-left: auto; font-size: 13px; letter-spacing: 0.12em; }
.links a, .langs a { color: var(--fg-2); transition: color 0.25s; }
.links a:hover, .langs a:hover { color: var(--fg); }
.langs { display: flex; gap: 14px; font-size: 12px; letter-spacing: 0.06em; }
.langs a[aria-current] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; }

main { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

/* ——— Footer ——— */
.bottom {
  width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--wide) - 2 * var(--gutter));
  margin: clamp(80px, 12vw, 160px) auto 0; padding: 40px 0 56px;
  border-top: 1px solid var(--line); color: var(--fg-3); font-size: 12px; letter-spacing: 0.08em;
  display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: flex-end; justify-content: space-between;
}
.bottom nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.bottom nav a:hover { color: var(--fg); }
.bottom-sign { margin: 0; display: flex; align-items: center; gap: 20px; }
.bottom-sign .svg-wordmark { height: 16px; width: auto; color: var(--fg-2); }
.section-studio .bottom nav { display: none; }

/* ——— Shared bits ——— */
.kicker, .g-kicker { font-family: var(--latin); font-style: italic; font-size: 17px; letter-spacing: 0.06em; color: var(--fg-2); margin: 0 0 12px; }
.more { display: inline-flex; align-items: center; gap: 14px; font-size: 13px; letter-spacing: 0.14em; color: var(--fg); }
.more::after { content: ""; width: 32px; height: 1px; background: currentColor; transition: width 0.5s var(--ease); }
a:hover .more::after, a.more:hover::after { width: 56px; }
.note { font-size: 13px; color: var(--fg-3); }

/* ——— Studio: hero ——— */
.hero {
  position: relative; min-height: min(86svh, 860px);
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; gap: 48px 40px;
  padding: clamp(48px, 10vh, 120px) 0 clamp(48px, 8vh, 96px);
}
.hero-mark { margin: 0; align-self: center; grid-column: 1; }
.hero-mark .svg-wordmark { width: min(100%, 980px); height: auto; }
.hero-vertical {
  grid-column: 2; grid-row: 1 / span 2; align-self: start; margin: 0;
  writing-mode: vertical-rl; font-family: var(--mincho); font-size: clamp(15px, 1.4vw, 18px);
  letter-spacing: 0.32em; line-height: 2.4; color: var(--fg-2);
}
.hero-intro { grid-column: 1; max-width: 26em; font-size: 15px; color: var(--fg-2); }
.hero-intro p:last-child { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .hero-mark, .hero-vertical, .hero-intro, .g-hero-text, .g-hero-art { animation: rise 1.6s var(--ease) both; }
  .hero-vertical { animation-delay: 0.35s; }
  .hero-intro { animation-delay: 0.55s; }
  .g-hero-art { animation: settle 2.4s var(--ease) both; }
  .g-hero-text { animation-delay: 0.4s; }
  .hero-mark .moon { animation: wax 1.8s 0.6s var(--ease) both; transform-box: fill-box; transform-origin: center; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes settle { from { opacity: 0; transform: scale(1.04); } }
@keyframes wax { from { opacity: 0; transform: rotate(-24deg) scale(0.6); } }

/* ——— Studio: numbered blocks ——— */
.block { border-top: 1px solid var(--line); padding: clamp(56px, 9vw, 128px) 0 0; margin-top: clamp(56px, 9vw, 128px); }
.hero + .block { margin-top: 0; }
.block-head { display: grid; grid-template-columns: 72px 1fr auto; align-items: baseline; margin-bottom: clamp(32px, 5vw, 64px); }
.block-no { font-family: var(--latin); font-size: 15px; color: var(--gold); letter-spacing: 0.1em; }
.block-head h2 { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: 0.24em; }
.lang-en .block-head h2 { font-family: var(--latin); font-size: clamp(28px, 3vw, 36px); letter-spacing: 0.02em; }
.block-en { font-family: var(--latin); font-style: italic; font-size: 16px; color: var(--fg-3); }
.block-en[lang="ja"] { font-family: var(--mincho); font-style: normal; font-size: 13px; letter-spacing: 0.2em; }

/* Works */
.work { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(28px, 5vw, 72px); align-items: end; }
.work-art { margin: 0; overflow: hidden; border-radius: 2px; background: var(--night); }
.work-art img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 1.4s var(--ease), opacity 0.6s; }
.work:hover .work-art img { transform: scale(1.03); }
.work-text { padding-bottom: 8px; color: var(--fg-2); font-size: 15px; }
.work-no { font-family: var(--latin); font-size: 15px; letter-spacing: 0.1em; color: var(--gold); margin: 0 0 20px; }
.work-no span { color: var(--fg-3); margin-left: 12px; }
.work h3 { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: 0.14em; line-height: 1.4; color: var(--fg); }
.lang-en .work h3 { font-family: var(--latin); letter-spacing: 0.01em; }
.work-en { font-family: var(--latin); font-style: italic; font-size: 18px; color: var(--fg-3); margin: 2px 0 24px; }
.work-en[lang="ja"] { font-family: var(--mincho); font-style: normal; font-size: 14px; letter-spacing: 0.2em; }
.work-meta { font-size: 12px; letter-spacing: 0.14em; color: var(--fg-3); margin: 24px 0 28px; }
.work-next { margin: clamp(40px, 6vw, 72px) 0 0; padding-top: 24px; border-top: 1px dashed var(--line); color: var(--fg-3); font-size: 14px; display: flex; gap: 24px; align-items: baseline; }
.work-next .work-no { margin: 0; color: var(--fg-3); }

/* Studio: about */
.about { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.etym { margin: 0; display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); }
.etym > span:not(.etym-plus) { display: grid; justify-items: start; }
.etym b { font-family: var(--latin); font-weight: 400; font-size: clamp(56px, 8vw, 112px); line-height: 1; letter-spacing: -0.01em; }
.etym i { font-family: var(--mincho); font-style: normal; font-size: clamp(18px, 1.8vw, 22px); color: var(--fg-2); margin-top: 16px; }
.etym small { font-size: 11px; letter-spacing: 0.18em; color: var(--fg-3); margin-top: 2px; }
.etym-plus { font-family: var(--latin); font-size: clamp(28px, 3vw, 40px); color: var(--gold); font-weight: 400; align-self: flex-start; margin-top: 0.6em; }
.about-text { font-size: 15px; color: var(--fg-2); max-width: 30em; }

/* Studio: contact */
.contact { color: var(--fg-2); font-size: 15px; }
.contact-mail {
  display: inline-block; font-family: var(--latin); font-weight: 500; font-size: clamp(34px, 6.4vw, 80px);
  line-height: 1.15; letter-spacing: 0; color: var(--fg); margin: 4px 0 28px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.7s var(--ease);
}
.contact-mail:hover { background-size: 100% 1px; }

/* ——— Game: hero (full bleed under the header) ——— */
.section-studio main { overflow: visible; }
.page-index:not(.section-studio) .top { position: absolute; left: 0; right: 0; }
.page-index:not(.section-studio) .top .links a, .page-index:not(.section-studio) .top .langs a { color: color-mix(in srgb, var(--moon) 80%, transparent); }
.g-hero { position: relative; width: 100vw; margin-left: calc(50% - 50vw); height: min(94svh, 960px); min-height: 560px; overflow: hidden; background: var(--night); }
.g-hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; }
.g-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(23, 30, 48, 0.55) 0%, rgba(23, 30, 48, 0) 22%, rgba(23, 30, 48, 0) 52%, var(--night) 100%);
}
.g-hero-text { position: absolute; z-index: 1; left: 0; right: 0; bottom: clamp(40px, 8vh, 96px); max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.g-hero .g-kicker { color: var(--moon-2); font-family: var(--sans); font-style: normal; font-size: 12px; letter-spacing: 0.2em; margin-bottom: 20px; }
.g-title { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: clamp(48px, 9vw, 112px); line-height: 1.15; letter-spacing: 0.14em; text-shadow: 0 2px 32px rgba(10, 14, 26, 0.5); }
.g-title-latin { font-family: var(--latin); letter-spacing: 0; }
.g-title-en { font-family: var(--latin); font-style: italic; font-size: clamp(20px, 2.4vw, 28px); color: var(--moon-2); margin: 8px 0 0 0.2em; }
.g-title-en[lang="ja"] { font-family: var(--mincho); font-style: normal; font-size: clamp(16px, 1.6vw, 20px); letter-spacing: 0.3em; }

/* Game: intro */
.g-intro { max-width: 36em; margin: clamp(64px, 10vw, 140px) auto 0; text-align: center; color: var(--fg-2); font-size: 15px; }
.g-lead { font-family: var(--mincho); font-size: clamp(20px, 2.4vw, 26px); line-height: 2.1; letter-spacing: 0.12em; color: var(--fg); margin-bottom: 40px; }
.lang-en .g-lead { font-family: var(--latin); font-size: clamp(24px, 2.8vw, 32px); line-height: 1.5; letter-spacing: 0; font-style: italic; }
.stores { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 48px; }
.store {
  display: grid; justify-items: center; min-width: 168px; padding: 12px 28px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); line-height: 1.4;
}
.store b { font-weight: 500; font-size: 15px; letter-spacing: 0.04em; }
.store small { font-size: 11px; letter-spacing: 0.16em; color: var(--fg-3); }
.store[aria-disabled="true"] { cursor: default; }

/* Game: features, alternating */
.g-features { margin-top: clamp(80px, 12vw, 180px); display: grid; gap: clamp(72px, 11vw, 160px); }
.g-feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 7vw, 120px); align-items: center; }
.g-feature:nth-child(even) > figure { order: 2; }
.g-feature > div { max-width: 30em; color: var(--fg-2); font-size: 15px; }
.g-feature:nth-child(odd) > figure { justify-self: end; }
.g-no { font-family: var(--latin); font-size: 18px; color: var(--gold); letter-spacing: 0.1em; margin: 0 0 18px; display: flex; align-items: center; gap: 14px; }
.g-no::after { content: ""; width: 40px; height: 1px; background: var(--line); }
.g-feature h2 { margin: 0 0 20px; font-family: var(--mincho); font-weight: 500; font-size: clamp(22px, 2.4vw, 30px); text-wrap: balance; line-height: 1.55; letter-spacing: 0.1em; color: var(--fg); }
.lang-en .g-feature h2 { font-family: var(--latin); letter-spacing: 0; line-height: 1.2; font-size: clamp(30px, 3.4vw, 42px); }
.phone {
  margin: 0; width: min(300px, 72vw); padding: 7px; border-radius: 40px; background: var(--night-2);
  border: 1px solid var(--rule-night); box-shadow: 0 40px 80px -32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.phone img { width: 100%; border-radius: 33px; }

/* Game: seasons gallery */
.g-themes { margin-top: clamp(96px, 14vw, 200px); }
.g-themes header { display: flex; align-items: baseline; gap: 24px; margin-bottom: 32px; }
.g-themes h2 { margin: 0; font-family: var(--mincho); font-weight: 500; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: 0.2em; }
.lang-en .g-themes h2 { font-family: var(--latin); letter-spacing: 0; font-size: clamp(28px, 3vw, 36px); }
.g-themes .g-kicker { order: 2; margin: 0; color: var(--fg-3); }
.g-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.g-gallery figure { margin: 0; }
.g-gallery img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 2px; transition: transform 1s var(--ease); }
.g-gallery figure:hover img { transform: translateY(-4px); }
.g-gallery figcaption { font-family: var(--mincho); font-size: 13px; letter-spacing: 0.16em; color: var(--fg-2); margin-top: 14px; }
.lang-en .g-gallery figcaption { font-family: var(--latin); font-style: italic; font-size: 16px; letter-spacing: 0; }

/* Game: facts */
.g-facts { margin-top: clamp(96px, 14vw, 200px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 64px; align-items: end; }
.g-facts dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.g-facts dl > div { padding: 20px 24px 20px 0; border-bottom: 1px solid var(--line); }
.g-facts dt { font-size: 11px; letter-spacing: 0.2em; color: var(--fg-3); margin-bottom: 4px; }
.g-facts dd { margin: 0; font-size: 14px; color: var(--fg-2); }
.g-facts p { margin: 0 0 20px; }

/* ——— Documents (privacy, terms, legal, support) ——— */
.doc { max-width: 44em; margin: clamp(32px, 6vw, 72px) 0 0; color: var(--fg-2); font-size: 15px; }
.doc h1 { margin: 0 0 12px; font-family: var(--mincho); font-weight: 500; font-size: clamp(30px, 4vw, 44px); letter-spacing: 0.14em; line-height: 1.4; color: var(--fg); }
.lang-en .doc h1 { font-family: var(--latin); letter-spacing: 0; }
.doc h2 { margin: 2.6em 0 0.8em; padding-top: 1.4em; border-top: 1px solid var(--line); font-family: var(--mincho); font-weight: 500; font-size: 20px; letter-spacing: 0.1em; color: var(--fg); line-height: 1.6; }
.lang-en .doc h2 { font-family: var(--latin); font-size: 26px; letter-spacing: 0; }
.doc h3 { margin: 2em 0 0.5em; font-size: 15px; font-weight: 600; color: var(--fg); }
.doc .updated { font-size: 12px; letter-spacing: 0.12em; color: var(--fg-3); margin-bottom: 40px; }
.doc a { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; color: var(--fg); }
.doc ul, .doc ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.doc li { margin-bottom: 0.4em; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 1.6em; font-size: 14px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.doc thead th { font-size: 11px; letter-spacing: 0.18em; color: var(--fg-3); font-weight: 400; border-bottom-color: var(--fg-3); }
.doc tbody th { width: 34%; font-weight: 500; color: var(--fg); }
.doc details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.doc summary { cursor: pointer; font-weight: 500; color: var(--fg); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.doc summary::-webkit-details-marker { display: none; }
.doc summary::after { content: "+"; font-family: var(--latin); font-size: 22px; line-height: 1; color: var(--gold); transition: transform 0.3s var(--ease); }
.doc details[open] summary::after { transform: rotate(45deg); }
.doc details p { margin: 12px 0 0; }
.todo { background: color-mix(in srgb, var(--gold) 25%, transparent); border-radius: 2px; padding: 0 4px; color: var(--fg); }

.nb { display: inline-block; }
.g-intro p, .work-text p, .about-text p { text-wrap: pretty; }
@media (min-width: 861px) { body:not(.lang-en) .g-feature h2 { white-space: nowrap; } }

/* ——— Small screens ——— */
@media (max-width: 860px) {
  .work, .about, .g-feature, .g-facts { grid-template-columns: 1fr; }
  .g-feature:nth-child(even) > figure { order: 0; }
  .g-feature > figure, .g-feature:nth-child(odd) > figure { justify-self: center; }
  .g-feature > div { justify-self: center; text-align: left; }
  .g-gallery { grid-template-columns: repeat(4, 64vw); overflow-x: auto; scroll-snap-type: x mandatory; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); scrollbar-width: none; }
  .g-gallery::-webkit-scrollbar { display: none; }
  .g-gallery figure { scroll-snap-align: start; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 14px 24px; padding-top: 22px; padding-bottom: 22px; }
  .links { order: 3; width: 100%; margin-left: 0; gap: 22px; }
  .langs { margin-left: auto; }
  .hero { grid-template-columns: 1fr auto; min-height: 0; gap: 40px 20px; padding-top: 40px; }
  .hero-vertical { font-size: 13px; letter-spacing: 0.24em; }
  .block-head { grid-template-columns: 48px 1fr auto; }
  .etym b { font-size: clamp(48px, 15vw, 72px); }
  .g-hero { height: 88svh; min-height: 520px; }
  .g-hero-art { object-position: 66% 50%; }
  .g-facts dl { grid-template-columns: 1fr; }
  .doc tbody th, .doc td { display: block; width: auto; padding: 4px 0; border: 0; }
  .doc tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .doc thead { display: none; }
  .bottom { flex-direction: column; align-items: flex-start; }
}
