:root {
  --paper: #f1ede5;
  --paper-2: #e5ded2;
  --ink: #171523;
  --muted: #625f69;
  --line: #c7bdad;
  --green: #4e348a;
  --green-bright: #8668c8;
  --blue: #176b7e;
  --amber: #b4522e;
  --night: #0b101d;
  --white: #fffdf8;
}

body {
  background:
    radial-gradient(circle at 8% 4%, rgba(78, 52, 138, .12), transparent 34rem),
    radial-gradient(circle at 92% 28%, rgba(23, 107, 126, .09), transparent 30rem),
    linear-gradient(180deg, var(--paper), #f8f5ef 48%, var(--paper-2));
}

.reading-progress { background: linear-gradient(90deg, var(--green), #9774dc, var(--blue)); }
.desk-nav { background: rgba(241, 237, 229, .93); }
.ai-hero h1 { max-width: 9ch; }
.ai-hero h1 span { color: var(--green); }
.ai-card h3 { max-width: 10ch; font-size: clamp(2rem, 3.4vw, 3.15rem); }
.ai-card:nth-child(1)::after,
.ai-card:nth-child(2)::after,
.ai-card:nth-child(3)::after {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 6px;
  height: 42%;
  content: "";
}
.ai-card:nth-child(1)::after { background: #d8aa3f; }
.ai-card:nth-child(2)::after { background: #8b67d2; }
.ai-card:nth-child(3)::after { background: #2b9bae; }
.method-title { font: clamp(2.2rem, 5vw, 4.5rem)/1 Georgia, serif; margin: .25em 0 1.4rem; }

.metric-console,
.law-timeline,
.stack-explorer,
.energy-scenario {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  background: var(--white);
}

.metric-console { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); }
.metric-toggle { padding: 1rem; display: grid; align-content: center; gap: .65rem; background: var(--night); }
.metric-toggle button,
.scenario-controls button {
  min-height: 48px;
  padding: .75rem 1rem;
  border: 1px solid rgba(255,255,255,.3);
  background: transparent;
  color: white;
  cursor: pointer;
  font: 800 .78rem/1.25 Arial, sans-serif;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}
.metric-toggle button[aria-pressed="true"],
.metric-toggle button:hover,
.metric-toggle button:focus-visible { border-color: #b9a5e8; background: var(--green); outline: 0; }
.metric-readout { min-height: 330px; padding: clamp(1.5rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: center; }
.metric-readout > span { color: var(--green); font-size: .75rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.metric-readout strong { display: block; margin: .08em 0 .16em; font: clamp(4rem, 11vw, 8rem)/.9 Georgia, serif; letter-spacing: -.07em; }
.metric-readout p { max-width: 48rem; margin: 0; color: var(--ink); font: 1.05rem/1.65 Georgia, serif; }
.metric-readout small { display: block; margin-top: 1rem; color: var(--muted); }

.law-timeline { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); }
.law-steps { display: grid; background: #ede6f4; }
.law-steps button {
  min-height: 82px;
  padding: 1rem 1.2rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 6px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.law-steps button[aria-pressed="true"] { border-left-color: var(--amber); background: var(--white); }
.law-steps button:focus-visible { outline: 3px solid var(--green-bright); outline-offset: -4px; }
.law-steps time { display: block; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.law-steps strong { display: block; margin-top: .2rem; font: 1.05rem Georgia, serif; }
.law-readout { min-height: 430px; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; background: var(--night); color: white; }
.law-readout > span { color: #d4b5ff; font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
.law-readout h4 { max-width: 16ch; margin: .55rem 0 .7rem; font: clamp(2.4rem, 6vw, 5rem)/.93 Georgia, serif; letter-spacing: -.045em; }
.law-readout p { max-width: 48rem; margin: 0; color: #d5d8e3; font-size: 1rem; line-height: 1.7; }

.stack-explorer { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); }
.stack-steps { padding: 1rem; display: grid; gap: .65rem; background: linear-gradient(145deg, #e7eef0, #eee6f4); }
.stack-steps button {
  min-height: 60px;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
}
.stack-steps button span { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--paper-2); color: var(--muted); font-size: .7rem; }
.stack-steps button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: white; }
.stack-steps button[aria-pressed="true"] span { background: white; color: var(--blue); }
.stack-steps button:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }
.stack-readout { min-height: 430px; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; background: var(--night); color: white; }
.stack-readout > span { color: #8bd3df; font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
.stack-readout h4 { max-width: 17ch; margin: .55rem 0 .7rem; font: clamp(2.3rem, 5vw, 4.6rem)/.95 Georgia, serif; letter-spacing: -.04em; }
.stack-readout p { max-width: 44rem; margin: 0; color: #d5dce2; line-height: 1.7; }

.energy-scenario { padding: clamp(1rem, 4vw, 2.5rem); }
.energy-scale { min-height: 360px; display: flex; align-items: end; justify-content: center; gap: clamp(2rem, 10vw, 9rem); border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(78,52,138,.04), transparent); }
.energy-scale > span { width: min(170px, 34vw); height: var(--energy); min-height: 90px; padding: .7rem; display: flex; flex-direction: column; justify-content: end; background: var(--blue); color: white; transition: height .45s ease, background .45s ease; }
.energy-scale .energy-2030 { background: var(--green); }
.energy-scale b { font: clamp(2.4rem, 7vw, 5rem)/1 Georgia, serif; letter-spacing: -.05em; }
.energy-scale small { font-weight: 800; line-height: 1.2; }
.scenario-controls { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .65rem; }
.scenario-controls button { border-color: var(--line); background: var(--paper-2); color: var(--ink); text-align: center; }
.scenario-controls button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; }
.scenario-controls button:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }

@media (max-width: 900px) {
  .metric-console,
  .law-timeline,
  .stack-explorer { grid-template-columns: 1fr; }
  .metric-toggle { grid-template-columns: repeat(3, 1fr); }
  .law-steps { grid-template-columns: repeat(5, minmax(160px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; }
  .law-steps button { scroll-snap-align: start; border-left: 0; border-top: 6px solid transparent; border-right: 1px solid var(--line); }
  .law-steps button[aria-pressed="true"] { border-top-color: var(--amber); }
  .law-readout,
  .stack-readout { min-height: 340px; }
}

@media (max-width: 640px) {
  .ai-card h3 { max-width: 12ch; font-size: clamp(2rem, 10.5vw, 3rem); }
  .metric-toggle { grid-template-columns: 1fr; }
  .metric-readout { min-height: 300px; padding: 1.35rem; }
  .metric-readout strong { font-size: clamp(3.6rem, 18vw, 5.6rem); }
  .law-readout,
  .stack-readout { min-height: 330px; padding: 1.4rem; }
  .law-readout h4,
  .stack-readout h4 { font-size: clamp(2.35rem, 12vw, 3.7rem); }
  .energy-scale { min-height: 300px; gap: 1.1rem; }
  .energy-scale > span { width: min(145px, 39vw); padding: .55rem; }
  .energy-scale b { font-size: clamp(2.2rem, 13vw, 4rem); }
  .scenario-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .scenario-controls button { min-width: 0; font-size: .66rem; }
}

@media (prefers-reduced-motion: reduce) {
  .energy-scale > span { transition: none; }
}
