/* Pixroam home site: Pixel tokens, self-hosted fonts, base typography and the header.
   The story stage lives in story.css; the plain sections are styled by Task 10. */

@font-face { font-family: "Righteous"; src: url("../fonts/Righteous-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("../fonts/Silkscreen-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("../fonts/PixelifySans.ttf") format("truetype"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --paper: #EEEDE9;
  --ink: #111111;
  --white: #FFFFFF;
  --lavender: #A99CF5;
  --lime: #BDF35C;
  --orange: #F4A261;
  --blue: #2A2AE8;
  --mute: #D6D5D0;
  --grey-text: #3A3A3A;

  --border: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --gutter: 16px;
  --measure: 60ch;

  --font-display: "Righteous", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hdr: 64px;
  --font-pixel: "Silkscreen", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "PingFang TC",
    "PingFang SC", "Apple SD Gothic Neo", "Noto Sans CJK JP", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.25rem, 8vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.6rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--blue); text-underline-offset: 0.15em; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

img, canvas { display: block; max-width: 100%; }
canvas { image-rendering: pixelated; }

ul, ol { padding-left: 1.25em; }

[hidden] { display: none !important; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

.chip {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.4em 0.6em;
  border: var(--border);
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font: 400 0.75rem/1 var(--font-pixel);
  text-transform: uppercase;
}

canvas { image-rendering: pixelated; }
img, canvas, svg { max-width: 100%; }

body:not(.home) { padding-top: var(--hdr); }

.dark { background: var(--ink); color: var(--paper); }
.dark a { color: var(--lime); }

.req, .esim-note, .fine, .small { font-size: 0.875rem; color: var(--grey-text); }
.dark .req, .dark .esim-note, .dark .fine { color: var(--mute); }

details > summary { cursor: pointer; }

/* ---------- header ---------- */
@media (max-width: 559px) { :root { --hdr: 56px; } }

.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--hdr);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
  background: var(--paper); color: var(--ink); border-bottom: 2px solid var(--ink);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  will-change: transform;
}
.hdr.on-dark { background: rgba(238, 237, 233, 0); color: var(--paper); border-bottom-color: transparent; }
.hdr.hide { transform: translate3d(0, -100%, 0); }
.hdr .brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: inherit; }
.hdr .brand img { width: 36px; height: 36px; border: 2px solid currentColor; image-rendering: pixelated; }
.hdr .brand b { font: 400 1.35rem/1 var(--font-display); letter-spacing: 0.04em; }
.hdr-right { display: flex; align-items: center; gap: 8px; }

.langmenu { position: relative; }
.langmenu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border: var(--border); background: var(--white); color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
  font: 400 0.8rem/1 var(--font-pixel); text-transform: uppercase; white-space: nowrap;
}
.langmenu summary::-webkit-details-marker { display: none; }
.hdr.on-dark .langmenu summary { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: none; }
.langmenu[open] summary { background: var(--ink); color: var(--lime); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.langpanel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; list-style: none; margin: 0; padding: 6px; min-width: 190px;
  background: var(--white); border: var(--border); box-shadow: var(--shadow); color: var(--ink);
}
.langpanel a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; text-decoration: none; color: var(--ink); font: 600 0.95rem/1.2 var(--font-body); }
.langpanel a::before { content: ""; width: 10px; height: 10px; border: var(--border); background: var(--white); flex: none; }
.langpanel a[aria-current]::before { background: var(--lime); }
.langpanel a:hover, .langpanel a:focus-visible { background: var(--paper); outline: none; }

.cta-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  background: var(--lime); color: var(--ink); border: var(--border); box-shadow: 4px 4px 0 var(--lavender);
  font: 400 1rem/1 var(--font-display); text-decoration: none; white-space: nowrap;
}
.cta-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--lavender); }
.cta-btn .short { display: none; }
.cta-btn i { font-style: normal; }
@media (max-width: 559px) {
  .hdr { padding: 0 12px; }
  .hdr .brand img { width: 32px; height: 32px; }
  .hdr .brand b { font-size: 1.1rem; }
  .langmenu summary { padding: 0 10px; }
  .cta-btn { padding: 0 12px; }
  .cta-btn .long { display: none; }
  .cta-btn .short { display: inline; }
}
@media (max-width: 359px) { .hdr .brand b { display: none; } }

/* reading progress: a 4 px pixel trail with a notch per chapter */
.trailbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 45; height: 4px;
  transform: translate3d(0, calc(var(--hdr) - 2px), 0); transition: transform 0.2s ease;
  background: repeating-linear-gradient(90deg, rgba(17, 17, 17, 0.18) 0 6px, transparent 6px 8px);
}
.trailbar.at-top { transform: translate3d(0, 0, 0); }
.trailbar .fill { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, var(--lime) 0 6px, transparent 6px 8px); clip-path: inset(0 100% 0 0); }
.trailbar .notch { position: absolute; top: -6px; width: 14px; height: 16px; margin-left: -7px; padding: 0; border: 0; background: none; cursor: pointer; }
.trailbar .notch::before { content: ""; position: absolute; left: 6px; top: 4px; width: 2px; height: 8px; background: var(--ink); }
.hdr.on-dark ~ .trailbar .notch::before { background: var(--paper); }
.trailbar .notch:hover::after, .trailbar .notch:focus-visible::after {
  content: attr(data-name); position: absolute; top: 18px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--ink); color: var(--lime); padding: 6px 8px; font: 400 0.65rem/1 var(--font-pixel); text-transform: uppercase; border: 2px solid var(--lime);
}
@media (hover: none) { .trailbar .notch { pointer-events: none; } }

/* desktop only: the pixel cursor */
html.pixel-cursor, html.pixel-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 11 11' shape-rendering='crispEdges'%3E%3Cpath fill='%23111' d='M0 0h1v10H0zM1 1h1v1H1zM2 2h1v1H2zM3 3h1v1H3zM4 4h1v1H4zM5 5h1v1H5zM6 6h1v1H6zM1 9h1v1H1zM2 8h1v1H2zM3 7h4v1H3z'/%3E%3Cpath fill='%23BDF35C' d='M1 2h1v7H1zM2 3h1v5H2zM3 4h1v3H3zM4 5h1v2H4zM5 6h1v1H5z'/%3E%3C/svg%3E") 0 0, auto;
}
html.pixel-cursor a, html.pixel-cursor button, html.pixel-cursor summary { cursor: pointer; }
.cta-btn, .cta a { will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* skip link: first focusable element on the home page, visually hidden until focused */
.skip { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 0.6em 0.8em; background: var(--lime); color: var(--ink); border: var(--border); box-shadow: var(--shadow-sm); font: 400 0.8rem/1 var(--font-pixel); text-transform: uppercase; text-decoration: none; transform: translate3d(0, -200%, 0); }
.skip:focus-visible { transform: none; }

/* CJK pages: headings (and the display-font labels) use the system CJK face at a heavy weight, never Righteous.
   The PIXROAM wordmark, the header brand and the eSIM tag on stamps stay Righteous. */
html:lang(ja) { --font-display: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", system-ui, sans-serif; }
html:lang(zh-Hant) { --font-display: "PingFang TC", "Noto Sans CJK TC", "Microsoft JhengHei", system-ui, sans-serif; }
html:lang(zh-Hans) { --font-display: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif; }
html:lang(ko) { --font-display: "Apple SD Gothic Neo", "Noto Sans CJK KR", "Malgun Gothic", system-ui, sans-serif; }
html:lang(ja) :is(h1, h2, h3, .film-title, .lb-title, .cta-btn),
html:lang(zh-Hant) :is(h1, h2, h3, .film-title, .lb-title, .cta-btn),
html:lang(zh-Hans) :is(h1, h2, h3, .film-title, .lb-title, .cta-btn),
html:lang(ko) :is(h1, h2, h3, .film-title, .lb-title, .cta-btn) { font-weight: 800; line-height: 1.25; }
html:lang(ja) :is(.wordmark, .hdr .brand b, .stamp .cap b),
html:lang(zh-Hant) :is(.wordmark, .hdr .brand b, .stamp .cap b),
html:lang(zh-Hans) :is(.wordmark, .hdr .brand b, .stamp .cap b),
html:lang(ko) :is(.wordmark, .hdr .brand b, .stamp .cap b) { font-family: "Righteous", system-ui, sans-serif; font-weight: 400; }

/* ---------- footer ---------- */
.foot { margin-top: 48px; padding: 36px 0 44px; background: var(--ink); color: var(--paper); border-top: var(--border); }
.foot .cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-bottom: 28px; }
.foot h2 { margin: 0 0 12px; font-size: 0.8rem; font-family: var(--font-pixel); font-weight: 400; text-transform: uppercase; color: var(--lime); }
.foot ul { margin: 0; padding: 0; list-style: none; }
.foot li { margin: 0 0 8px; }
.foot a { color: var(--paper); text-underline-offset: 0.2em; }
.foot a:hover { color: var(--lime); }
.foot .langmenu { margin-bottom: 20px; }
.foot .langpanel { top: auto; bottom: calc(100% + 10px); right: auto; left: 0; }
.foot .small { margin: 0; color: var(--mute); }
@media (max-width: 639px) { .foot .cols { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.foot .langmenu { display: inline-block; }
/* zh-Hans header at phone width: the required "需支持 eSIM 的 iPhone" note sits beside the Get button, so the
   wordmark text steps aside for the app icon (still read out by screen readers) */
@media (max-width: 480px) {
  html:lang(zh-Hans) .hdr .brand b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
