/* ──────────────────────────────────────────────
   v3.css — top page (index.html)
   Uses shared.css tokens; theater.css styles the
   embedded Product Theater. Only index.html loads it.
   ────────────────────────────────────────────── */

.v3 main { padding-top: 0; }

/* page-level line color for the PC boundary */
:root { --v3-line: rgba(30, 41, 59, 0.34); }

@media (prefers-color-scheme: dark) {
  :root { --v3-line: rgba(226, 232, 240, 0.32); }
}

/* ── Section heads ── */

.v3-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 650;
}

.v3-num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.v3-section { padding-top: 88px; }

.v3-head h2 { margin-bottom: 0; }

.v3-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

/* ══ 01 DESIGN PHILOSOPHY ══ */

.v3-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
  padding-top: 56px;
  min-height: min(520px, calc(100vh - 140px));
}

.v3-hero h1 {
  font-size: clamp(1.8rem, 2.9vw, 2.6rem);
  margin-bottom: 18px;
  text-wrap: balance;
}

/* Japanese title: each segment stays whole; a segment wraps only at its <wbr> */
.v3-hero h1 .h-seg {
  display: inline-block;
  max-width: 100%;
  word-break: keep-all;
  overflow-wrap: normal;
}

.v3-hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 18px;
}

.v3-principles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 28px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.86rem;
  color: var(--accent-dark);
}

.v3-hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }

/* PC boundary diagram: drawn once on load, then still.
   Elements are complete by default; the animations only fade them in, so
   prefers-reduced-motion (shared.css turns animations off) shows the final state. */
.v3-pc {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v3-pc-box {
  position: relative;
  width: 100%;
  max-width: 500px;
  padding: 40px 28px 30px;
  border: 1.5px solid var(--v3-line);
  border-radius: 22px;
  background: var(--surface);
  animation: v3-rise 0.8s ease 0.1s both;
}

.v3-pc-label {
  position: absolute;
  top: -11px;
  left: 22px;
  padding: 0 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.v3-pc-product {
  text-align: center;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
  animation: v3-fade 0.6s ease 0.7s both;
}

.v3-pc-mods {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.v3-pc-mods li {
  flex: 0 0 calc(33.333% - 7px);
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  animation: v3-rise 0.5s ease calc(1.1s + var(--i) * 0.12s) both;
}

.v3-pc-link {
  width: 0;
  height: 22px;
  margin: 8px auto;
  border-left: 1.5px dashed var(--v3-line);
  animation: v3-fade 0.5s ease 1.85s both;
}

.v3-pc-engine {
  padding: 11px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent-dark);
  text-align: center;
  font-weight: 650;
  letter-spacing: 0.06em;
  font-size: 0.92rem;
  animation: v3-fade 0.6s ease 2s both;
}

/* the single doorway: a gap in the bottom border with two small jambs */
.v3-pc-door {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  background: var(--surface);
  animation: v3-fade 0.4s ease 2.5s both;
}

.v3-pc-door::before,
.v3-pc-door::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 1.5px;
  height: 8px;
  background: var(--v3-line);
}

.v3-pc-door::before { left: -1px; }
.v3-pc-door::after { right: -1px; }

.v3-pc-out {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  animation: v3-fade 0.6s ease 2.75s both;
}

.v3-pc-out-line {
  width: 0;
  height: 22px;
  border-left: 1.5px dashed var(--v3-line);
}

.v3-pc-out-arrow { line-height: 1; }

.v3-pc-out-log {
  font-size: 0.82rem;
  color: var(--text);
}

.v3-pc-out-note {
  margin-top: 6px;
  max-width: 34em;
  text-align: center;
  font-size: 0.74rem;
}

@keyframes v3-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes v3-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ══ 02 PRODUCT THEATER ══ */

.v3-theater .v3-head { text-align: center; }
.v3-theater .v3-eyebrow { justify-content: center; }

.v3 .theater {
  width: min(1180px, calc(100% - 40px), calc((100vh - 300px) * 960 / 500));
  min-width: min(720px, calc(100% - 40px));
  margin: 22px auto 0;
}

/* ══ 03 FUNCTIONS IN MOTION ══ */

.v3-fim-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.fim-rag, .fim-voice { grid-column: span 3; }
.fim-chat, .fim-macro, .fim-studio { grid-column: span 2; }

.fim-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* the one card that is playing right now */
.fim-card.is-active {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.fim-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

.fim-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.v3-preview {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--warn);
  border-radius: 999px;
  color: var(--warn);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* mini app surface */
.fim-ui {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.55;
}

/* a state that a later step replaces (data-until): gone once passed, also when finished */
.fim-card [data-until].is-gone { display: none; }

/* steps: only hidden while their card is playing */
.fim-card [data-step] { transition: opacity 0.45s ease, transform 0.45s ease; }
.fim-card.is-playing [data-step]:not(.is-shown) {
  opacity: 0;
  transform: translateY(4px);
}

.fx-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-mono { font-family: Consolas, "Cascadia Code", monospace; }
.fx-dim { color: var(--muted); }

.fx-status {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--muted);
}

.fx-live { color: var(--accent-dark); }
.fx-wait { color: var(--warn); margin-left: auto; }
.fx-ok { color: var(--accent-dark); margin-left: 0; font-weight: 650; }

/* folder: body + tab on the upper left */
.fx-ico-folder {
  position: relative;
  width: 16px;
  height: 11px;
  margin-top: 3px;
  border-radius: 1px 2px 2px 2px;
  background: var(--warn);
  opacity: 0.85;
}

.fx-ico-folder::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 7px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: inherit;
}

.fx-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.fx-switch {
  width: 24px;
  height: 13px;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
}

.fx-switch::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.fx-msg {
  max-width: 88%;
  padding: 7px 10px;
  border-radius: 10px;
}

/* chat.css: user bubble = accent, AI = raised surface */
.fx-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .fx-user { color: #042f2e; }
}

.fx-ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}

.fx-ai b { color: var(--accent-dark); font-weight: 650; }

.fx-sources {
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}

.fx-sources-title { font-size: 0.72rem; color: var(--muted); margin-bottom: 2px; }
.fx-src b { color: var(--accent-dark); }

.fx-rec {
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.fx-transcript { display: flex; flex-direction: column; gap: 2px; }

.fx-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.fx-tabs span {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
}

.fx-tabs span.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .fx-tabs span.is-on { color: #042f2e; }
}

.fx-charas { display: flex; align-items: center; gap: 6px; }

.fx-charas img,
.fx-initial {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: cover;
}

.fx-initial {
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
}

/* picked character: from step 1 on, and in the finished state */
.fim-chat:not(.is-playing) .fx-picked,
.fim-chat.is-playing:not([data-at="0"]) .fx-picked { box-shadow: 0 0 0 2px var(--accent); }

.fx-chara-name { margin-left: 4px; font-weight: 650; }

.fx-note { margin: auto 0 0; font-size: 0.72rem; color: var(--muted); }

.fx-chip {
  padding: 1px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.fx-result { font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); }

.fx-diff {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.fx-diff-title { font-size: 0.72rem; color: var(--muted); }

.fx-del {
  font-size: 0.72rem;
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  padding-left: 4px;
  margin-top: 2px;
  border-radius: 3px;
}

.fx-btn {
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.76rem;
}

.fx-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .fx-btn-primary { color: #042f2e; }
}

.fx-studio-bar { display: flex; flex-wrap: wrap; gap: 3px; }
.fx-studio-bar .fx-sbtn { font-size: 0.6rem; padding: 1px 5px; }

.fx-sbtn {
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fx-sbtn.fx-run { color: var(--accent-dark); border-color: var(--accent); }

.fx-code {
  list-style: none;
  counter-reset: ln;
  margin: 0;
  padding: 6px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.7rem;
  overflow: hidden;
}

.fx-code li {
  counter-increment: ln;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 1.6em;
  padding-right: 6px;
  white-space: nowrap;
}

.fx-code li::before {
  content: counter(ln);
  width: 2.2em;
  text-align: right;
  color: var(--muted);
  order: 1;
}

.fx-bp {
  order: 0;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
}

.fx-bp.is-set { background: var(--danger); }
.fx-src-line {
  order: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* paused at the breakpoint line */
.fim-studio:not(.is-playing) .fx-cur,
.fim-studio.is-playing:not([data-at="0"]) .fx-cur { background: rgba(217, 119, 6, 0.16); }

.fx-stopped { font-size: 0.72rem; color: var(--warn); }

.fx-vars {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.fx-vars-title { font-size: 0.66rem; letter-spacing: 0.08em; color: var(--muted); }

.fx-var { display: flex; gap: 12px; }

/* ══ 04 MORE / DOWNLOAD ══ */

.v3-closing { padding-bottom: 24px; }

.v3-closing h2 { margin-bottom: 26px; }

.v3-closing-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 22px;
  align-items: start;
}

.v3-get h3 { margin-bottom: 12px; }

.v3-facts {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.v3-facts li + li { margin-top: 4px; }

.v3-free { margin: 14px 0 0; font-size: 0.88rem; }
.v3-free a { color: var(--accent-dark); }

.v3-more h3 { margin-bottom: 10px; }

.v3-more ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.v3-more li { border-bottom: 1px solid var(--border); }

.v3-more a,
.v3-more li.is-disabled {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 4px;
}

.v3-more b { min-width: 11em; font-weight: 650; }
.v3-more span { color: var(--muted); font-size: 0.9rem; }
.v3-more a:hover b { color: var(--accent-dark); }
.v3-more li.is-disabled b { color: var(--muted); }

/* ── Responsive ── */

@media (max-width: 1023px) {
  .v3-hero { grid-template-columns: 1fr; gap: 36px; min-height: 0; padding-top: 40px; }
  .v3-fim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fim-rag { grid-column: span 2; }
  .fim-voice, .fim-chat, .fim-macro, .fim-studio { grid-column: span 1; }
  .v3 .theater { width: auto; min-width: 0; margin: 20px 16px 0; }
}

@media (max-width: 760px) {
  .v3-closing-grid { grid-template-columns: 1fr; }
  .v3-more b { min-width: 0; }
  .v3-more a, .v3-more li.is-disabled { flex-direction: column; gap: 0; }
}

@media (max-width: 640px) {
  .v3-section { padding-top: 64px; }
  .v3-hero { padding-top: 28px; gap: 28px; }
  .v3-hero-sub { font-size: 0.98rem; }
  .v3-pc-box { padding: 34px 16px 24px; }
  .v3-pc-mods li { flex-basis: calc(50% - 5px); font-size: 0.85rem; }
  .v3-fim-grid { grid-template-columns: minmax(0, 1fr); }
  .fim-rag, .fim-voice, .fim-chat, .fim-macro, .fim-studio { grid-column: auto; }
  .v3-head-row { flex-direction: column; align-items: flex-start; }
}

/* demo note under the cards: theater-demo-tag look, in normal flow */
.v3-fim-under { margin-top: 14px; }
.v3 .v3-fim-under .theater-demo-tag { position: static; transform: none; }

/* the section pause reuses the theater button look, but sits in the heading row */
.v3 .v3-fim-toggle { position: static; transform: none; flex-shrink: 0; }
