:root {
  color-scheme: light;
  --canvas: #f1ede4;
  --surface: #fbf8f1;
  --surface-soft: #e8e2d6;
  --ink: #171916;
  --muted: #686d67;
  --primary: #263f36;
  --primary-dark: #142820;
  --primary-soft: #e2e9e3;
  --teal: #426f5d;
  --teal-soft: #e2eee8;
  --success: #347056;
  --warning: #a26232;
  --danger: #982f35;
  --line: rgba(24, 32, 27, .16);
  --line-strong: rgba(24, 32, 27, .3);
  --ochre: #a87543;
  --oxblood: #6d2230;
  --page: 1240px;
  --shadow: 0 28px 80px rgba(30, 34, 30, .12);
  --sans: Manrope, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #060a08;
  --surface: #0c1410;
  --surface-soft: #121e18;
  --ink: #f3f0e8;
  --muted: #a8b0aa;
  --primary: #dce6df;
  --primary-dark: #f5f3ed;
  --primary-soft: #18271f;
  --teal: #72c29f;
  --teal-soft: #14271f;
  --success: #74cfa8;
  --warning: #e6aa67;
  --danger: #ff8f82;
  --line: rgba(226, 232, 227, .15);
  --line-strong: rgba(226, 232, 227, .28);
  --ochre: #d6a367;
  --oxblood: #d96c78;
  --shadow: 0 30px 90px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 36%, color-mix(in srgb, var(--oxblood) 7%, transparent), transparent 34rem),
    var(--canvas);
  font: 16px/1.58 var(--sans);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; color: var(--ink); font-family: var(--serif); font-weight: 400; letter-spacing: -.045em; line-height: 1.02; }
h1 { font-size: clamp(4rem, 8vw, 8.4rem); }
h2 { font-size: clamp(2.2rem, 4.6vw, 4.5rem); }
h3 { font-size: 1.25rem; }
[hidden] { display: none !important; }
::selection { color: #fff8ef; background: var(--oxblood); }

.eyebrow {
  margin: 0 0 12px;
  color: var(--ochre);
  font: 800 .65rem/1.2 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.continuity-hero {
  position: relative;
  isolation: isolate;
  min-height: min(880px, calc(100vh - 76px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: clamp(42px, 8vw, 125px);
  align-items: end;
  overflow: hidden;
  padding: clamp(95px, 12vw, 175px) clamp(22px, 6vw, 92px) clamp(60px, 8vw, 110px);
  color: #fff9ef;
  background: #15231d;
}
.continuity-hero__art,
.continuity-hero__art img,
.continuity-hero__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.continuity-hero__art { z-index: -3; }
.continuity-hero__art img { object-fit: cover; object-position: center; }
.continuity-hero__veil {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(5, 11, 8, .91) 0%, rgba(5, 11, 8, .6) 50%, rgba(5, 11, 8, .28) 100%),
    linear-gradient(0deg, rgba(5, 11, 8, .66), transparent 58%);
}
.continuity-hero__copy { max-width: 850px; }
.continuity-hero__copy .eyebrow { color: #edb180; }
.continuity-hero h1 { max-width: 920px; color: #fff9ef; line-height: .88; letter-spacing: -.065em; text-wrap: balance; }
.continuity-hero__copy > p:last-of-type { max-width: 720px; margin-top: 30px; color: rgba(255, 249, 239, .8); font-size: clamp(1rem, 1.55vw, 1.25rem); }
.continuity-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.continuity-hero .button:not(.button--primary) { color: #fff9ef; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.34); }

.kernel-card {
  padding: 28px;
  color: #fff9ef;
  background: rgba(9, 17, 12, .7);
  border: 1px solid rgba(255,255,255,.2);
  border-top: 3px solid #b98455;
  box-shadow: 0 28px 70px rgba(0,0,0,.3);
  backdrop-filter: blur(18px);
}
.kernel-card__state { display: grid; grid-template-columns: 10px 1fr; gap: 13px; align-items: center; padding-bottom: 21px; }
.kernel-card__state i { width: 9px; height: 9px; border-radius: 50%; background: #bbb8ae; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.kernel-card.ready .kernel-card__state i { background: #70c69f; box-shadow: 0 0 0 5px rgba(112,198,159,.15); }
.kernel-card.error .kernel-card__state i { background: #ff8a72; box-shadow: 0 0 0 5px rgba(255,138,114,.16); }
.kernel-card__state span,
.kernel-card__state strong,
.kernel-card__state small { display: block; }
.kernel-card__state strong { font-size: .86rem; }
.kernel-card__state small { margin-top: 3px; color: rgba(255,249,239,.58); font-size: .7rem; }
.kernel-card dl { margin: 0; border-top: 1px solid rgba(255,255,255,.14); }
.kernel-card dl div { display: grid; grid-template-columns: 90px 1fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.11); }
.kernel-card dt { color: rgba(255,249,239,.54); font-size: .62rem; letter-spacing: .07em; text-transform: uppercase; }
.kernel-card dd { margin: 0; overflow-wrap: anywhere; font: .65rem/1.5 var(--mono); }
.kernel-card .button { margin-top: 18px; color: #edb180; border-color: rgba(237,177,128,.35); }

.button {
  width: max-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .025em;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible { outline: 3px solid color-mix(in srgb, var(--ochre) 30%, transparent); outline-offset: 3px; }
.button--primary,
button.primary { color: #fff9ef; background: #29483c; border-color: #29483c; }
.button--primary:hover:not(:disabled),
button.primary:hover:not(:disabled) { background: #1c352c; }
.button--quiet { min-height: 36px; padding: 0; background: transparent; border-color: transparent; border-radius: 0; }
.button:disabled,
button:disabled { cursor: not-allowed; opacity: .42; }

.continuity-principles {
  width: min(100%, 1500px);
  display: grid;
  grid-template-columns: minmax(280px, .66fr) 1fr;
  gap: clamp(45px, 8vw, 125px);
  margin: 0 auto;
  padding: clamp(68px, 9vw, 125px) clamp(22px, 6vw, 92px);
  border-bottom: 1px solid var(--line);
}
.continuity-principles > header > p:last-child { max-width: 520px; margin-top: 24px; color: var(--muted); }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.principle-grid article { min-height: 340px; padding: 34px 28px; border-right: 1px solid var(--line); }
.principle-grid article:last-child { border-right: 0; }
.principle-grid span { color: var(--ochre); font: 800 .62rem var(--mono); }
.principle-grid h3 { margin-top: 80px; font-size: clamp(1.5rem, 2.3vw, 2.15rem); }
.principle-grid p { margin-top: 18px; color: var(--muted); font-size: .8rem; }

.demo-workspace,
.technical-panel {
  width: min(calc(100% - 48px), var(--page));
  margin-inline: auto;
}
.demo-workspace { padding: clamp(70px, 9vw, 125px) 0 0; }
.workspace-head { display: grid; grid-template-columns: 1fr minmax(300px, .55fr); gap: 45px 80px; align-items: end; }
.workspace-head > p { color: var(--muted); }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 46px; border-bottom: 1px solid var(--line); }
.progress span { display: flex; gap: .5rem; padding: 1rem .55rem; color: var(--muted); border-bottom: 2px solid transparent; font-size: .73rem; }
.progress span b { color: inherit; font-weight: 700; }
.progress span.active { color: var(--oxblood); border-color: var(--oxblood); }

.panel {
  min-height: 360px;
  margin-top: 20px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.demo-scene { min-height: 500px; display: grid; grid-template-columns: minmax(300px, .42fr) 1fr; }
.demo-scene > figure { min-height: 100%; margin: 0; overflow: hidden; background: var(--surface-soft); }
.demo-scene > figure img { width: 100%; height: 100%; display: block; object-fit: cover; }
.demo-screen-body { min-width: 0; padding: clamp(28px, 5vw, 58px); }
.loading { min-height: 260px; display: flex; align-items: center; justify-content: center; gap: .7rem; color: var(--muted); }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--oxblood); animation: pulse 1s ease-in-out infinite alternate; }
.screen-head,
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-bottom: 1.6rem; }
.screen-head p { max-width: 500px; color: var(--muted); }
.screen-head h2 { margin-top: .25rem; font-size: clamp(2rem, 3.7vw, 3.7rem); }

.persona { display: grid; grid-template-columns: 52px 1fr; gap: .9rem; align-items: center; margin: 1.7rem 0; padding: 1rem; background: var(--surface-soft); border-left: 3px solid var(--oxblood); }
.persona-icon { width: 52px; height: 52px; display: grid; place-items: center; color: #fff8ef; background: var(--oxblood); border-radius: 50%; font: 800 1rem var(--serif); }
.persona small { display: block; color: var(--muted); }
.field { display: grid; gap: .45rem; max-width: 540px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.field input,
.chat-form input,
.chat-form select { width: 100%; min-height: 46px; padding: .75rem .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 3px; }

.authority-grid,
.key-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 1.5rem; }
.card { min-width: 0; padding: 1.15rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; text-align: left; }
button.card { cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; }
button.card:hover { border-color: var(--ochre); box-shadow: 0 10px 28px rgba(50,57,51,.1); transform: translateY(-2px); }
.authority-option.selected { background: var(--primary-soft); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.card h3 { margin: .7rem 0 .35rem; font-size: 1.18rem; }
.card p,
.fine,
.empty { color: var(--muted); font-size: .8rem; }
.status,
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: .2rem .5rem; color: var(--muted); background: var(--surface-soft); border-radius: 999px; font-size: .61rem; font-weight: 800; letter-spacing: .04em; }
.status.good,
.badge { color: var(--success); background: var(--teal-soft); }
.selection-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.3rem; color: var(--muted); }
.selection-row strong { color: var(--ink); }

button:not(.hestia-theme-toggle):not(.button):not(.card) {
  min-height: 44px;
  padding: .7rem 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  transition: border-color .2s, background .2s, transform .2s;
}
button:not(.hestia-theme-toggle):not(.button):not(.card):hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.success-callout,
.loss-callout { display: grid; grid-template-columns: 56px 1fr; gap: 1rem; align-items: center; margin: 1.5rem 0; padding: 1.2rem; }
.success-callout { color: var(--success); background: var(--teal-soft); border-left: 3px solid var(--success); }
.loss-callout { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-left: 3px solid var(--danger); }
.callout-icon { width: 52px; height: 52px; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 78%, transparent); border-radius: 50%; font-weight: 800; }

.process-steps { display: grid; gap: .55rem; margin: 1.7rem 0 0; padding: 0; list-style: none; }
.process-steps li { display: grid; grid-template-columns: 28px 1fr; gap: .7rem; align-items: center; padding: .8rem .95rem; color: var(--muted); background: var(--canvas); border: 1px solid var(--line); }
.process-steps li > span { color: var(--ochre); font-weight: 800; }
.process-steps li.active { color: var(--ink); background: var(--primary-soft); border-color: var(--primary); }
.process-steps li.done { color: var(--success); }

.technical-panel { margin-top: 28px; margin-bottom: 120px; overflow: visible; background: var(--surface); border: 1px solid var(--line); }
.technical-panel > summary { min-height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.3rem; cursor: pointer; list-style: none; }
.technical-panel > summary::-webkit-details-marker { display: none; }
.technical-panel > summary span,
.technical-panel > summary b,
.technical-panel > summary small { display: block; }
.technical-panel > summary small { margin-top: .2rem; color: var(--muted); }
.technical-panel > summary i { color: var(--ochre); font-size: 1.3rem; font-style: normal; }
.technical-panel[open] > summary i { transform: rotate(45deg); }
.technical-body { display: grid; gap: 2.5rem; padding: clamp(20px, 4vw, 38px); border-top: 1px solid var(--line); }
.architecture-note { padding: 1.1rem; color: var(--muted); background: var(--primary-soft); border-left: 3px solid var(--ochre); font-size: .8rem; }
.architecture-note strong { display: block; margin-bottom: .25rem; color: var(--primary-dark); }
.hal-source { overflow: hidden; color: #dce8e0; background: #08110d; border: 1px solid rgba(255,255,255,.12); }
.hal-source > summary { padding: 18px 20px; color: #e7aa78; cursor: pointer; font: 800 .65rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.hal-source pre { max-height: 650px; overflow: auto; margin: 0; padding: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.hal-source code { color: #b9d6c6; font: .67rem/1.65 var(--mono); white-space: pre; }

.raw-values { grid-column: 1 / -1; margin-top: .5rem; border-top: 1px solid var(--line); }
.raw-values > summary { padding: 1rem 0; color: var(--ochre); cursor: pointer; font-weight: 800; }
.raw-content { display: grid; gap: 1rem; }
.warning { padding: 1rem; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-left: 3px solid var(--danger); }
.secret-card { padding: 1rem; background: #08110d; }
.secret-card strong,
.secret-card small,
.secret-card code { display: block; }
.secret-card strong { color: #d0d9d3; font-size: .7rem; }
.secret-card code { max-height: 170px; overflow: auto; margin: .55rem 0; color: #9edcbf; font: .7rem/1.5 var(--mono); overflow-wrap: anywhere; white-space: pre-wrap; }
.secret-card small { color: #8fa097; font-size: .66rem; }
.share-grid,
.secrets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.secrets-accordion { margin-top: 1.2rem; overflow: hidden; background: #15251e; border: 1px solid #344c40; }
.secrets-accordion > summary { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; color: #f7f1e8; cursor: pointer; list-style: none; }
.secrets-accordion > summary::-webkit-details-marker { display: none; }
.secrets-accordion > summary span,
.secrets-accordion > summary strong,
.secrets-accordion > summary small { display: block; }
.secrets-accordion > summary strong { font-size: .8rem; }
.secrets-accordion > summary small { margin-top: .18rem; color: #bdcbc3; font-size: .68rem; }
.secrets-accordion > summary i { width: 38px; height: 22px; position: relative; flex: 0 0 auto; background: #61736a; border-radius: 999px; }
.secrets-accordion > summary i::after { width: 16px; height: 16px; position: absolute; top: 3px; left: 3px; content: ""; background: #fffdf7; border-radius: 50%; transition: transform .2s; }
.secrets-accordion[open] > summary i { background: #b67a4b; }
.secrets-accordion[open] > summary i::after { transform: translateX(16px); }
.secrets-accordion .hide-secrets,
.secrets-accordion[open] .show-secrets { display: none; }
.secrets-accordion[open] .hide-secrets { display: block; }
.secrets-content { display: grid; gap: .8rem; padding: 1rem; border-top: 1px solid #42564c; }
.end-nav { display: flex; justify-content: space-between; gap: .7rem; margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.messages { min-height: 110px; max-height: 260px; overflow: auto; padding: .8rem; background: var(--canvas); }
.message { margin: .5rem 0; padding: .75rem; background: var(--surface); border-left: 3px solid var(--teal); }
.message small { display: block; color: var(--muted); }
.chat-form { display: grid; grid-template-columns: 190px 1fr auto; gap: .6rem; margin-top: .8rem; }
.code { display: block; padding: .7rem; overflow-wrap: anywhere; color: var(--primary-dark); background: var(--primary-soft); font: .78rem var(--mono); }
dl { display: grid; grid-template-columns: 150px 1fr; gap: .6rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 30px clamp(20px, 5vw, 84px);
  color: #84938b;
  background: #040806;
  font: .61rem var(--mono);
  letter-spacing: .06em;
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .technical-panel,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .chat-form input,
:root[data-theme="dark"] .chat-form select,
:root[data-theme="dark"] button:not(.primary):not(.hestia-theme-toggle) { background-color: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .success-callout { color: #9ce0c0; }
:root[data-theme="dark"] .loss-callout,
:root[data-theme="dark"] .warning { color: #ffad9e; }

@keyframes pulse { to { opacity: .25; transform: scale(.75); } }

@media (max-width: 1000px) {
  .continuity-hero { grid-template-columns: 1fr; min-height: 760px; }
  .kernel-card { max-width: 490px; }
  .continuity-principles { grid-template-columns: 1fr; }
  .principle-grid article { min-height: 290px; }
  .workspace-head { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .principle-grid { grid-template-columns: 1fr; }
  .principle-grid article { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .principle-grid article:last-child { border-bottom: 0; }
  .principle-grid h3 { margin-top: 36px; }
  .authority-grid,
  .key-grid { grid-template-columns: repeat(2, 1fr); }
  .progress { overflow-x: auto; }
  .progress span { min-width: 120px; }
  .demo-scene { grid-template-columns: 1fr; }
  .demo-scene > figure { min-height: 260px; max-height: 340px; }
}

@media (max-width: 620px) {
  .continuity-hero { min-height: 730px; padding: 82px 18px 48px; }
  .continuity-hero h1 { font-size: clamp(3.3rem, 16vw, 5.1rem); }
  .continuity-hero__copy > p:last-of-type { font-size: .96rem; }
  .continuity-principles { padding-inline: 18px; }
  .demo-workspace,
  .technical-panel { width: calc(100% - 28px); }
  .progress span { min-width: 105px; }
  .demo-scene > figure { min-height: 210px; max-height: 245px; }
  .demo-screen-body { padding: 1.25rem; }
  .screen-head,
  .section-head,
  .selection-row { align-items: flex-start; flex-direction: column; }
  .authority-grid,
  .key-grid,
  .share-grid,
  .secrets-grid { grid-template-columns: 1fr; }
  .chat-form { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: .35rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
