@import url("./design-system.css");

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font: 100%/1.5 var(--sans);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { margin: 0; background: var(--canvas); }
button { font: inherit; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

.module-preview { padding: 24px; }

.overview-module {
  width: min(1480px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(45, 36, 40, 0.08);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-module);
}

html.is-embedded,
html.is-embedded body { background: var(--surface); }
html.is-embedded .module-preview { padding: 0; }
html.is-embedded .overview-module {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.module-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
}

.module-title { display: flex; min-width: 0; align-items: center; gap: 12px; }
.title-mark { width: 5px; height: 24px; border-radius: 999px; background: var(--accent); }
.module-title h1 { margin: 0; font-size: clamp(1.35rem, 2vw, 1.7rem); font-weight: 680; line-height: 1.08; letter-spacing: -0.035em; }
.channel-badge { padding: 7px 11px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--surface-soft); color: var(--accent); font-size: 0.72rem; font-weight: 650; }

.overview-hero { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr); border-top: 1px solid var(--line-soft); }

.project-statement {
  position: relative;
  display: flex;
  min-height: 258px;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 42px 46px;
  background: linear-gradient(145deg, #741d36 0%, #591527 58%, #42101e 100%);
  color: #fff;
}

.project-statement::after {
  position: absolute;
  width: 260px;
  height: 260px;
  right: -96px;
  bottom: -142px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255, 255, 255, 0.025), 0 0 0 88px rgba(255, 255, 255, 0.018);
  content: "";
}

.project-statement h2 { position: relative; z-index: 1; max-width: 700px; margin: 0; font-size: clamp(2.65rem, 4.8vw, 4.8rem); font-weight: 660; line-height: 0.96; letter-spacing: -0.065em; }
.project-statement p { position: relative; z-index: 1; max-width: 760px; margin: 22px 0 0; color: rgba(255, 255, 255, 0.72); font-size: clamp(0.86rem, 1.15vw, 1rem); line-height: 1.72; }

.project-numbers { display: grid; grid-template-rows: repeat(3, 1fr); background: var(--surface); }
.project-numbers article { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); align-items: center; gap: 22px; padding: 18px 28px; }
.project-numbers article + article { border-top: 1px solid var(--line-soft); }
.project-numbers strong { color: var(--accent); font-size: clamp(2.05rem, 3.2vw, 3.15rem); font-weight: 670; line-height: 0.92; letter-spacing: -0.065em; font-variant-numeric: tabular-nums; }
.project-numbers article:nth-child(2) strong { font-size: clamp(1.8rem, 2.8vw, 2.7rem); }
.project-numbers article:nth-child(3) strong { font-size: clamp(1.7rem, 2.5vw, 2.3rem); letter-spacing: -0.045em; }
.project-numbers article > div { min-width: 0; }
.project-numbers span { display: block; font-size: 0.88rem; font-weight: 680; }
.project-numbers p { margin: 4px 0 0; color: var(--tertiary); font-size: 0.72rem; line-height: 1.45; }

.stage-axis { padding: 24px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.stage-heading h2, .section-title h2, .validation-copy h2 { margin: 0; font-size: 1rem; font-weight: 690; letter-spacing: -0.02em; }
.stage-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.stage-list li { position: relative; min-width: 0; min-height: 108px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface-soft); transition: border-color 160ms ease, background-color 180ms ease, box-shadow 180ms ease; }
.stage-list li.is-current::after { position: absolute; top: 0; right: 18px; left: 18px; height: 2px; border-radius: 0 0 999px 999px; background: var(--gold); content: ""; }
.stage-list li.is-selected { border-color: rgba(107, 33, 57, 0.18); background: var(--accent-soft); box-shadow: 0 7px 20px rgba(64, 35, 44, 0.055); }
.stage-list li.is-selected::before { position: absolute; z-index: 1; width: 4px; top: 14px; bottom: 14px; left: 0; border-radius: 0 999px 999px 0; background: var(--accent); content: ""; }
.stage-list button { display: grid; width: 100%; min-height: 106px; grid-template-columns: 34px 1fr; align-items: center; gap: 13px; padding: 17px 18px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.stage-index { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); font-size: 0.68rem; font-weight: 720; }
.stage-list .is-selected .stage-index { border-color: transparent; background: var(--accent); color: #fff; }
.stage-list strong { display: block; font-size: 0.83rem; font-weight: 680; line-height: 1.35; }
.stage-list time { display: block; margin-top: 5px; color: var(--accent); font-size: 0.68rem; font-weight: 690; font-variant-numeric: tabular-nums; }
.stage-list p { margin: 3px 0 0; color: var(--secondary); font-size: 0.68rem; line-height: 1.5; }

.overview-lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line-soft); background: var(--line-soft); gap: 1px; transition: opacity 130ms ease, transform 180ms var(--ease-out); }
.overview-lower.is-changing { opacity: 0; transform: translateY(4px); }
.outcomes, .validation { min-width: 0; padding: 24px; background: var(--surface); }
.validation { background: var(--surface-soft); }
.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.outcome-grid article { display: flex; min-width: 0; min-height: 82px; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface-soft); transition: border-color 160ms ease, background-color 160ms ease; }
.outcome-index { display: grid; flex: 0 0 auto; width: 30px; height: 30px; place-items: center; border-radius: 10px; background: var(--surface); color: var(--gold); font-size: 0.66rem; font-weight: 730; box-shadow: var(--shadow-card); }
.outcome-grid h3 { margin: 0; font-size: 0.82rem; font-weight: 680; letter-spacing: -0.015em; }
.outcome-grid p { margin: 4px 0 0; color: var(--secondary); font-size: 0.68rem; line-height: 1.45; }

.validation-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 16px; padding: 4px; border-radius: 13px; background: var(--surface-muted); box-shadow: inset 0 0 0 1px rgba(35, 25, 29, 0.025); }
.validation-switch button { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--secondary); cursor: pointer; transition: color 160ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 100ms var(--ease-out); }
.validation-switch button:active { transform: scale(0.97); }
.validation-switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(34, 24, 28, 0.08), 0 6px 16px rgba(34, 24, 28, 0.05); }
.validation-switch span { color: var(--gold); font-size: 0.66rem; font-weight: 720; }
.validation-switch strong { font-size: 0.75rem; font-weight: 650; white-space: nowrap; }
.validation-result { min-height: 88px; margin-top: 10px; padding: 17px 18px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); color: var(--secondary); transition: opacity 120ms ease, transform 180ms var(--ease-out); }
.validation-result strong { display: block; color: var(--ink); font-size: 0.82rem; font-weight: 680; }
.validation-result ul { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.validation-result li { position: relative; padding-left: 13px; font-size: 0.7rem; line-height: 1.5; }
.validation-result li::before { position: absolute; width: 4px; height: 4px; top: 0.55em; left: 0; border-radius: 50%; background: var(--gold); content: ""; }
.validation-result.is-changing { opacity: 0; transform: translateY(3px); }

@media (hover: hover) and (pointer: fine) {
  .stage-list li:not(.is-selected):hover { border-color: var(--line); background: #fbf9f5; }
  .validation-switch button:not([aria-selected="true"]):hover { color: var(--ink); }
  .outcome-grid article:hover { border-color: var(--line); background: #fbf9f5; }
}

@media (max-width: 980px) {
  .overview-hero { grid-template-columns: 1fr; }
  .project-statement { min-height: 230px; }
  .project-numbers { grid-template-columns: repeat(3, 1fr); grid-template-rows: none; }
  .project-numbers article { display: block; padding: 18px 20px; }
  .project-numbers article + article { border-top: 0; border-left: 1px solid var(--line-soft); }
  .project-numbers strong, .project-numbers article:nth-child(2) strong, .project-numbers article:nth-child(3) strong { display: block; font-size: 2.05rem; }
  .project-numbers article > div { margin-top: 9px; }
  .overview-lower { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .module-preview { padding: 9px; }
  .overview-module { border-radius: 20px; }
  .module-header { min-height: 68px; padding: 14px 16px; }
  .channel-badge { padding: 6px 9px; }
  .project-statement { min-height: 250px; padding: 30px 22px; }
  .project-statement h2 { font-size: clamp(2.7rem, 13vw, 3.5rem); }
  .project-statement p { margin-top: 18px; }
  .project-numbers { grid-template-columns: 1fr; }
  .project-numbers article { display: grid; grid-template-columns: 96px 1fr; gap: 15px; padding: 15px 18px; }
  .project-numbers article + article { border-top: 1px solid var(--line-soft); border-left: 0; }
  .project-numbers strong, .project-numbers article:nth-child(2) strong, .project-numbers article:nth-child(3) strong { font-size: 1.9rem; }
  .project-numbers article > div { margin-top: 0; }
  .stage-axis, .outcomes, .validation { padding: 20px 16px; }
  .stage-list { grid-template-columns: 1fr; }
  .stage-list li { min-height: 82px; }
  .outcome-grid { grid-template-columns: 1fr; }
  .validation-switch button { gap: 4px; padding: 0 6px; }
  .validation-switch span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-list li, .overview-lower, .outcome-grid article, .validation-switch button, .validation-result { transition-property: color, background-color, border-color, opacity !important; transform: none !important; }
}

@media (prefers-contrast: more) {
  .overview-module, .outcome-grid article, .validation-result { border-color: rgba(0, 0, 0, 0.46); }
}
