/* HP1 shared shell; LP1 visual tokens are unchanged. */
:root {
  color-scheme: dark;

  /* ground + surfaces */
  --ground: #0f1216;
  --ground-2: #12151a;
  --surface: #1a1e25;
  --surface-2: #232933;
  --surface-raised: #262d38;

  /* type */
  --text: #e8ecf1;
  --muted: #98a2ae;

  /* lines */
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.16);

  /* brand */
  --accent: #34b3a0;
  --accent-bright: #5fd9c4;
  --accent-soft: rgba(52, 179, 160, 0.14);
  --accent-glow: rgba(52, 179, 160, 0.28);
  --amber: #e5b454;
  --amber-soft: rgba(229, 180, 84, 0.14);

  /* status */
  --ok: #4cc38a;
  --rose: #e5726a;

  /* terminal */
  --term-bg: #0c0f12;
  --term-fg: #7ce38b;
  --term-dim: #4d6353;

  /* shape */
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-pill: 999px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);

  /* type stacks */
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  --mono: "Cascadia Mono", Consolas, Menlo, monospace;

  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--ground); color: var(--text); font: 1rem/1.7 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.2; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
/* Japanese has no spaces between words: keep-all left a lone "1" on its own line; break at phrases where supported. */
html:lang(ja) :is(h1, h2, h3) { word-break: auto-phrase; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); }
h3 { font-size: 1.13rem; }
p { margin: 0; overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
img, svg { max-width: 100%; }
img { display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
section, article { scroll-margin-top: calc(var(--header-h) + 16px); }
.container { width: min(1320px, calc(100% - 80px)); margin-inline: auto; }
.mono, .eyebrow { font-family: var(--mono); }
.eyebrow { color: var(--accent-bright); font-size: .78rem; letter-spacing: .16em; margin-bottom: 18px; }
.accent { color: var(--accent-bright); }
.glyph-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.page-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(circle at 78% 4%, var(--accent-glow), transparent 52%), radial-gradient(circle at 4% 92%, var(--amber-soft), transparent 42%), radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px); background-size: auto, auto, 22px 22px; }
.skip-link { position: fixed; top: 10px; left: 12px; z-index: 100; padding: 10px 18px; border-radius: var(--radius-btn); color: var(--ground); background: var(--accent-bright); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 1px solid transparent; border-radius: var(--radius-btn); font-weight: 650; line-height: 1.5; text-align: center; }
.btn-primary { color: var(--ground); background: var(--accent); }
.btn-primary:hover { background: var(--accent-bright); }
.btn-secondary { background: var(--surface); border-color: var(--hairline-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.pill, .lite-badge { display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--hairline-strong); font-size: .78rem; }
.lite-badge { color: var(--amber); background: var(--amber-soft); border-color: transparent; font-weight: 700; letter-spacing: .04em; }
.actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 12px; color: var(--accent-bright); font-weight: 650; }
.text-link:hover { text-decoration: underline; text-underline-offset: 5px; }

.site-header { position: sticky; top: 0; height: var(--header-h); z-index: 30; border-bottom: 1px solid transparent; background: var(--ground); }
.site-header.is-scrolled, .site-header.menu-open { border-color: var(--hairline-strong); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.header-row { height: 100%; width: min(1560px, calc(100% - 48px)); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; gap: 10px; }
.brand img { width: auto; }
.desktop-nav { display: flex; align-items: center; gap: clamp(12px, 1.3vw, 24px); height: 100%; }
.desktop-nav a { height: 100%; display: flex; align-items: center; position: relative; font-size: .88rem; color: var(--muted); white-space: nowrap; }
a[aria-current="page"] { color: var(--text); }
.desktop-nav a[aria-current="page"]::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--accent); }
.desktop-nav a:hover, .site-footer a:hover { color: var(--text); }
.header-actions, .header-tools { display: flex; align-items: center; gap: 10px; }
.header-tools .btn { font-size: .8rem; padding: 9px 11px; white-space: nowrap; }
.lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--hairline-strong); border-radius: var(--radius-btn); flex-shrink: 0; }
.lang-btn { border: 0; padding: 5px 9px; border-radius: 5px; background: transparent; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.lang-btn[aria-pressed="true"] { background: var(--surface-raised); color: var(--text); }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--radius-btn); }
.menu-toggle path, .dialog-close path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.menu-cross, .menu-open .menu-lines { display: none; }
.menu-open .menu-cross { display: initial; }
.menu-panel { position: absolute; inset: var(--header-h) 0 auto; padding: 24px 0 32px; background: var(--ground-2); border-bottom: 1px solid var(--hairline-strong); box-shadow: var(--shadow); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; }
.menu-panel nav { display: grid; margin-bottom: 24px; }
.menu-panel nav a { font-size: 1.3rem; color: var(--muted); padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.menu-panel nav a[aria-current="page"] { color: var(--accent-bright); }
.menu-entries { display: grid; gap: 10px; margin-top: 24px; }

.page-head { padding-block: clamp(72px, 9vw, 112px); border-bottom: 1px solid var(--hairline); }
.page-head h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 800; margin-bottom: 24px; }
.page-head h1 + p { color: var(--muted); max-width: 720px; font-size: 1.1rem; }
.section { padding-block: clamp(64px, 8vw, 108px); }
.section-heading { text-align: center; max-width: 820px; margin: 0 auto 44px; }
.section-heading p { color: var(--muted); margin-top: 16px; }
.section-split { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.5fr); gap: 64px; }
.section-aside { align-self: start; position: sticky; top: calc(var(--header-h) + 32px); }
.section-aside h2 { margin-bottom: 20px; }
.section-aside > p:last-child { color: var(--muted); }
.cta-band { padding-block: 64px; background: var(--accent-soft); border-block: 1px solid var(--hairline); text-align: center; }
.cta-band p { color: var(--muted); margin: 18px auto 26px; max-width: 760px; }
.cta-band .text-link { padding: 10px; }
.site-footer { background: var(--ground); padding: 60px 0 24px; color: var(--muted); font-size: .87rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 44px; }
.footer-grid h2 { font-size: .9rem; color: var(--text); margin: 8px 0 18px; }
.footer-grid nav { display: grid; gap: 8px; }
.footer-brand { color: var(--text); font-weight: 650; margin-top: 15px; }
.footer-grid p + p { margin-top: 8px; }
.footer-grid a[href^="mailto:"] { overflow-wrap: anywhere; }
.footer-grid a[href^="mailto:"] + p { margin-top: 18px; }
.text-button { display: block; background: none; padding: 0; border: 0; border-radius: 0; color: var(--muted); font-size: inherit; font-weight: 400; margin-bottom: 8px; }
.text-button:hover { color: var(--text); background: none; text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--hairline); margin-top: 44px; padding-top: 24px; font-size: .75rem; }

/* Shared screen: original pixel dimensions are only used by screen.js. */
.screen { min-width: 0; border: 1px solid var(--surface-2); border-radius: 12px; overflow: hidden; background: var(--ground); box-shadow: var(--shadow); }
.screen-bar { display: flex; align-items: center; gap: 5px; height: 28px; padding-inline: 10px; background: var(--surface); position: relative; }
.screen-bar i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; }
.screen-bar span { position: absolute; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.screen-viewport { aspect-ratio: 16 / 10; overflow: hidden; }
.stage { position: relative; width: 100%; height: 100%; transition: transform 900ms cubic-bezier(.4,0,.2,1); }
.screen-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 450ms; }
.screen-image.is-front { opacity: 1; }
.focus { position: absolute; z-index: 2; border: 2px solid var(--accent); border-radius: 6px; box-shadow: 0 0 16px var(--accent-glow); opacity: 0; transition: opacity 300ms; pointer-events: none; }
.focus.is-visible { opacity: 1; }
.cursor, .ripple { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.cursor { opacity: 0; transition: transform 700ms cubic-bezier(.4,0,.2,1), opacity 120ms; }
.cursor.is-visible { opacity: 1; }
.cursor svg { display: block; transform-origin: 0 0; }
.ripple { z-index: 3; }
.ripple span { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border: 2px solid var(--accent-bright); border-radius: 50%; opacity: 0; }
.ripple .is-clicking { animation: screen-click 320ms ease-out; }
@keyframes screen-click { from { transform: scale(0); opacity: .6; } to { transform: scale(1); opacity: 0; } }
.swatches { display: inline-flex; flex-shrink: 0; gap: 4px; }
.swatches i { width: 16px; height: 16px; border: 1px solid var(--hairline-strong); border-radius: 50%; }

/* Shared memory illustration: static end state also works without JavaScript. */
.guard { min-width: 0; margin: 0; padding: 24px; border-block: 1px solid var(--hairline); background: var(--surface); }
.guard-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.guard-note { flex-shrink: 0; color: var(--muted); font-size: .72rem; border: 1px solid var(--hairline-strong); border-radius: var(--radius-pill); padding: 2px 9px; }
.guard-bar { display: flex; height: 70px; background: var(--ground); border: 1px solid var(--hairline-strong); }
.guard-slot { position: relative; flex: none; min-width: 0; overflow: hidden; }
.guard-fill { position: absolute; inset: 0; background: var(--guard-color); transform-origin: left; }
.guard-llm { --guard-color: var(--accent); }
.guard-train { --guard-color: var(--accent-bright); }
.guard-notebook { --guard-color: var(--amber); }
.guard-runaway { --guard-color: var(--rose); opacity: 0; }
.guard-reserve { --guard-color: var(--surface-raised); margin-left: auto; border-left: 2px dashed var(--muted); }
.guard-reserve .guard-fill { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--hairline-strong) 5px 7px), var(--surface-raised); }
.guard-label { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); white-space: nowrap; font-size: .78rem; font-weight: 650; color: var(--ground); visibility: hidden; }
.guard-slot[data-inline] .guard-label { visibility: visible; }
.guard-reserve .guard-label { color: var(--muted); }
.guard-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: .78rem; color: var(--muted); }
.guard-legend li { display: inline-flex; align-items: center; gap: 8px; }
.guard-legend li[data-inline] { display: none; }
.guard-swatch { width: 9px; height: 9px; background: var(--guard-color); flex: none; }
.guard-legend .guard-runaway { opacity: 1; }
.guard-swatch.guard-reserve { border: 1px dashed var(--muted); margin: 0; }
.guard-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 24px; font-size: .85rem; }
.guard-ok { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); }
.guard-ok i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.guard-toast { color: var(--rose); padding: 8px 12px; border: 1px solid var(--hairline-strong); border-radius: var(--radius-btn); }
@media (max-width: 599.98px) {
  .guard { padding: 20px 16px; }
  .guard-slot[data-inline] .guard-label { visibility: hidden; }
  .guard-legend li[data-inline] { display: inline-flex; }
  .guard-heading { font-size: .88rem; }
  .guard-bar { height: 56px; }
}

/* Shared installation walkthrough: terminal, wizard panes and setup strip. */
.install-panes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 28px; align-items: start; }
.install-terminal { min-width: 0; border: 1px solid var(--surface-2); border-radius: var(--radius-card); overflow: hidden; background: var(--term-bg); }
.terminal-body { min-width: 0; padding: 24px; color: var(--term-fg); }
.terminal-command { font: .86rem/1.8 var(--mono); overflow-wrap: anywhere; min-height: 5.4em; }
[data-install-prompt] { color: var(--term-dim); }
.terminal-caret { display: inline-block; width: .5em; height: 1em; background: var(--term-fg); vertical-align: middle; opacity: 0; }
.install-progress { height: 3px; background: var(--term-dim); margin-block: 16px 24px; overflow: hidden; }
.install-progress i { display: block; height: 100%; background: var(--term-fg); transform-origin: left; }
.install-checks { font-size: .86rem; }
.install-checks li { display: flex; gap: 10px; align-items: baseline; margin-block: 10px; }
.install-checks i { font-style: normal; color: var(--ok); flex: none; }
.install-address { margin-top: 24px; }
.install-address .mono { color: var(--accent-bright); display: block; font-size: .84rem; overflow-wrap: anywhere; }
.install-address > span:last-child { display: inline-block; font-size: .72rem; color: var(--muted); border: 1px solid var(--hairline-strong); border-radius: var(--radius-pill); padding: 3px 10px; margin-top: 10px; }
.install-browser { min-width: 0; }
.install-controls { display: none; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.spark-install[data-ready] .install-controls, .home-install[data-ready] .install-controls { display: flex; }
.install-steps { margin-right: auto; }
.spark-setup-strip, .install-setup-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--hairline); margin-top: 44px; }
.spark-setup-strip li, .install-setup-strip li { min-width: 0; padding: 24px; border-right: 1px solid var(--hairline); }
.spark-setup-strip li:first-child, .install-setup-strip li:first-child { padding-left: 0; }
.spark-setup-strip li:last-child, .install-setup-strip li:last-child { border-right: 0; }
.spark-setup-strip .mono, .install-setup-strip .mono { color: var(--accent-bright); font-size: .8rem; }
.spark-setup-strip h3, .install-setup-strip h3 { font-size: 1rem; margin-block: 16px 12px; }
.spark-setup-strip p, .install-setup-strip p { color: var(--muted); font-size: .85rem; }
@media (max-width: 899.98px) {
  .install-panes { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .spark-setup-strip, .install-setup-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spark-setup-strip li, .install-setup-strip li { padding: 24px 20px; border-bottom: 1px solid var(--hairline); }
  .spark-setup-strip li:nth-child(odd), .install-setup-strip li:nth-child(odd) { padding-left: 0; }
  .spark-setup-strip li:nth-child(even), .install-setup-strip li:nth-child(even) { border-right: 0; }
}
@media (max-width: 599.98px) {
  .terminal-body { padding: 20px 16px; }
  .install-controls > .btn { flex: 1 1 auto; }
}

/* The attribute is set only by main.js, never by shipped markup. */
@media (prefers-reduced-motion: no-preference) {
  html[data-reveal] .reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms, transform 600ms; }
  html[data-reveal] .reveal.is-visible { opacity: 1; transform: none; }
}
/* Eight links need room beside the language controls and both entry buttons.
   nav.js reads the nav's display and watches these same language breakpoints. */
@media (max-width: 1279.98px) {
  .desktop-nav { display: none; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 1499.98px) {
  html:lang(en) .desktop-nav { display: none; }
  html:lang(en) .menu-toggle { display: inline-flex; }
}
@media (max-width: 1599.98px) {
  html:lang(ja) .desktop-nav { display: none; }
  html:lang(ja) .menu-toggle { display: inline-flex; }
}
@media (max-width: 1179.98px) {
  .section-split { gap: 36px; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); }
}
@media (max-width: 899.98px) {
  .container { width: calc(100% - 48px); }
  .header-tools { display: none; }
  .section-split { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .section-aside { position: static; max-width: 620px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599.98px) {
  .container { width: calc(100% - 32px); }
  .brand { gap: 6px; }
  .brand img { height: 28px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .actions { align-items: stretch; flex-direction: column; }
  .actions > * { width: 100%; }
  .cta-band .container { max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .cursor, .ripple { display: none; }
  .stage { transform: none !important; }
}
