/* ClauseSpace styles. Colours and feel follow nebius.com (violet, deep navy, light grey, lime highlight);
   no Nebius logo or brand fonts are used. Structure: tokens, base, layout, components, utilities. */

/* ---- Tokens ---------------------------------------------------------------------------------------------- */
:root {
  --violet: #614efa;
  --violet-hover: #4c39e6;
  --violet-soft: #e0e4ff;
  --navy: #052b42;
  --navy-deep: #001a2b;
  --lime: #e0ff4f;
  --bg: #f3f4f5;
  --surface: #ffffff;
  --line: #dfe3e8;
  --text: #052b42;
  --text-muted: #4f5f69;          /* darker than Nebius' #73858f so small text keeps AA contrast */
  --warn-bg: #fff8db;
  --warn-line: #f2c94c;

  /* The three buckets, consistent on every screen */
  --checked: #0b7a6f;  --checked-bg: #e3f6f3;
  --binding: #0263c7;  --binding-bg: #e3f0fe;
  --open: #c4321f;     --open-bg: #fdeceb;
  --question: #614efa; --question-bg: #ecebff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(5, 43, 66, 0.06), 0 2px 8px rgba(5, 43, 66, 0.04);
  --font: "Inter", "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --page: 64rem;
}

/* ---- Base ------------------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--violet); }
a:hover { color: var(--violet-hover); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
code, pre { font-family: var(--mono); }

/* ---- Layout ---------------------------------------------------------------------------------------------- */
.site-header { background: var(--navy); color: #fff; }
.site-header__inner, .page { max-width: var(--page); margin: 0 auto; padding: 0 1.25rem; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1rem; }
.brand { margin: 0; font-size: 1.35rem; font-weight: 700; }
.brand__mark { color: var(--lime); }
.tagline { margin: 0.1rem 0 0; color: #c5d3dc; font-size: 0.9rem; }
.status-pill { font-size: 0.8rem; padding: 0.3rem 0.7rem; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #e7eef2; }
.status-pill--off { background: rgba(255, 219, 77, 0.2); }
.site-header__tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-left: auto; }
.brand__link, .brand__link:hover { color: inherit; text-decoration: none; }
.nerd-toggle { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; color: #e7eef2; cursor: pointer; }
.nerd-toggle .switch .switch__track { background: rgba(255, 255, 255, 0.25); }
.nerd-toggle .switch input:checked + .switch__track { background: var(--lime); }
.nerd-toggle .switch input:checked + .switch__track::before { background: var(--navy); }
.page { padding-block: 1.5rem 4rem; }
.section { margin-block: 1.5rem; }
.intro { border-top: 4px solid var(--violet); }
.intro p { max-width: 50rem; }
.steps-list { margin: 0 0 0.75rem; padding-left: 1.3rem; max-width: 50rem; }
.steps-list li { margin-bottom: 0.35rem; }
.link-button { font: inherit; color: var(--violet); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--violet-hover); }
.lead { font-size: 1.05rem; color: var(--text-muted); max-width: 46rem; }

/* ---- Stepper --------------------------------------------------------------------------------------------- */
.stepper { list-style: none; display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0; margin: 0 0 1.25rem; }
.stepper__item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.85rem 0.4rem 0.4rem; border-radius: 999px;
                 background: var(--surface); border: 1px solid var(--line); color: var(--text-muted); font-size: 0.9rem; }
.stepper__num { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--bg); font-weight: 600; font-size: 0.8rem; }
.stepper__item--current { border-color: var(--violet); color: var(--text); font-weight: 600; }
.stepper__item--current .stepper__num { background: var(--violet); color: #fff; }
.stepper__item--done .stepper__num { background: var(--navy); color: var(--lime); }

/* ---- Components ------------------------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 0.85rem; }
.cards { display: grid; gap: 0.85rem; align-items: start; }
.cards > *, .cards > .card + .card { margin: 0; }   /* the grid gap spaces them, not the stacked-card margin */
.cards--two { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.card--checked { border-left: 6px solid var(--checked); }
.card--binding { border-left: 6px solid var(--binding); }
.card--not_protected { border-left: 6px solid var(--open); }
.card--question { border-left: 6px solid var(--question); }
.card--success { border-left: 6px solid var(--checked); }
.card--failure { border-left: 6px solid var(--open); }

.notice { border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-block: 1rem; background: var(--violet-soft); border-left: 4px solid var(--violet); }
.notice--error { background: var(--open-bg); border-left-color: var(--open); }
.notice--success { background: var(--checked-bg); border-left-color: var(--checked); font-weight: 600; }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }

.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; margin-bottom: 0.4rem; }
.badge--checked, .badge--FINALIZED { color: var(--checked); background: var(--checked-bg); }
.badge--binding { color: var(--binding); background: var(--binding-bg); }
.badge--not_protected, .badge--TERMINATED, .badge--NOT_VISIBLE, .badge--TIMEOUT { color: var(--open); background: var(--open-bg); }
.badge--question { color: var(--question); background: var(--question-bg); }

.quote { margin: 0.2rem 0 0.6rem; padding-left: 0.8rem; border-left: 3px solid var(--line); color: var(--text-muted); font-style: italic; }

.btn { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; font-weight: 600; padding: 0.6rem 1.15rem; border-radius: var(--radius-sm);
       border: 1px solid transparent; background: var(--violet); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--violet-hover); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn--secondary:hover { background: var(--bg); color: var(--text); }
.actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

.field { display: grid; gap: 0.3rem; }
.field__hint { font-size: 0.85rem; color: var(--text-muted); }
input[type=text], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); padding: 0.5rem 0.65rem;
  border: 1px solid #c6ced6; border-radius: var(--radius-sm); max-width: 100%;
}
textarea { width: 100%; min-height: 7rem; resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 0.75rem; padding: 0.5rem 0.9rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
input[type=file]::file-selector-button:hover { background: var(--violet-soft); }
.checkbox { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; white-space: nowrap; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f8fa; font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: 0; }
tr.row--confirm td { background: var(--warn-bg); }
/* Mapping table: fixed column widths so the notes and the confirm box always stay on screen */
.mapping-table { table-layout: fixed; min-width: 56rem; }
.mapping-table th:nth-child(1) { width: 12rem; }
.mapping-table th:nth-child(2) { width: 16rem; }
.mapping-table th:nth-child(5) { width: 7.5rem; }
.mapping-table select { width: 100%; }
.mapping-table td { overflow-wrap: anywhere; }
tr.row--confirm td:first-child { box-shadow: inset 4px 0 0 var(--warn-line); }

.facts { width: auto; }
.facts td:first-child { color: var(--text-muted); padding-right: 1.5rem; }

.issue { color: var(--open); }
.busy { color: var(--text-muted); font-size: 0.9rem; }
.busy::before { content: ""; display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0.4rem; vertical-align: -0.1rem;
                border: 2px solid var(--violet-soft); border-top-color: var(--violet); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy::before { animation: none; } }

pre.code { white-space: pre-wrap; background: var(--navy-deep); color: #d7e3ea; padding: 0.85rem; border-radius: var(--radius-sm);
           font-size: 0.78rem; max-height: 24rem; overflow: auto; }

/* "Under the hood" drawer */
.drawer { margin-top: 3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.drawer > summary { cursor: pointer; padding: 0.9rem 1.25rem; font-weight: 600; list-style: none; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary .muted { font-weight: 400; }
.drawer > summary::before { content: "▸ "; color: var(--violet); }
.drawer[open] > summary::before { content: "▾ "; }
.drawer__body { padding: 0 1.25rem 1.25rem; }
.drawer__body h3 { margin-top: 1.25rem; }

/* Token limiter switch */
.switch { position: relative; width: 2.6rem; height: 1.45rem; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; background: #9aa5b1; border-radius: 1rem; cursor: pointer; transition: background 0.15s; }
.switch__track::before { content: ""; position: absolute; width: 1.05rem; height: 1.05rem; left: 0.2rem; top: 0.2rem; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + .switch__track { background: var(--violet); }
.switch input:checked + .switch__track::before { transform: translateX(1.15rem); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--violet); outline-offset: 2px; }
input[type=range] { flex: 1; min-width: 10rem; accent-color: var(--violet); }
input[type=range]:disabled { opacity: 0.4; }

/* "You are here" box at the top of every step */
.here { background: var(--violet-soft); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.here__step { display: inline-block; margin: 0 0 0.4rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--navy);
              color: var(--lime); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.here__title { margin: 0 0 0.35rem; }
.here__body p { margin: 0 0 0.35rem; max-width: 52rem; }
.here__body p:last-child { margin-bottom: 0; }

/* Between two steps */
.between { max-width: 44rem; margin: 1rem auto 0; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--violet);
           border-radius: var(--radius); padding: 1.5rem 1.75rem; box-shadow: var(--shadow); }
.between__step { margin: 0 0 0.25rem; color: var(--checked); font-weight: 700; font-size: 0.85rem; }
.between h3 { margin-top: 1.25rem; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { position: relative; padding-left: 1.6rem; margin-bottom: 0.45rem; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--checked); font-weight: 700; }
.legend { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.5rem; }
.legend .badge { margin: 0 0.4rem 0 0; }

/* The info icon: a small "i" in a circle; the explanation shows on hover, click or keyboard focus */
.info { display: inline-block; position: relative; vertical-align: 0.1em; margin-left: 0.3rem; font-weight: 400; }
.info__btn { display: grid; place-items: center; width: 1.1rem; height: 1.1rem; padding: 0; border-radius: 50%; cursor: help;
             border: 1.5px solid var(--violet); background: var(--surface); color: var(--violet); font: italic 700 0.7rem/1 Georgia, serif; }
.info:hover .info__btn, .info__btn:focus { background: var(--violet); color: #fff; }
.info__body { display: none; position: absolute; z-index: 20; top: 1.5rem; left: -0.6rem; width: min(22rem, 80vw); padding: 0.75rem 0.9rem;
              background: var(--navy); color: #eef3f6; border-radius: var(--radius-sm); box-shadow: 0 6px 24px rgba(5, 43, 66, 0.25);
              font-size: 0.85rem; font-weight: 400; font-style: normal; line-height: 1.45; text-align: left; }
.info:hover .info__body, .info:focus-within .info__body { display: block; }
.info__p { display: block; margin-bottom: 0.45rem; }
.info__p:last-child { margin-bottom: 0; }
.info__body strong { color: var(--lime); }

/* Questions: suggestion line and the sample's pre-filled answers */
.suggest { font-size: 0.85rem; color: var(--text); background: var(--bg); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; }
.suggest strong { color: var(--violet); }
.example { display: block; font-family: var(--mono); font-size: 0.8rem; color: var(--text); background: var(--bg);
           border-radius: 6px; padding: 0.15rem 0.45rem; margin-bottom: 0.3rem; overflow-wrap: anywhere; }

/* Stats for nerds: technical details stay hidden until the header switch is on. Pure CSS, so the switch works
   without JavaScript too; the script only remembers the choice. */
body:not(:has(#nerds:checked)) .nerd { display: none !important; }

/* ---- Utilities ------------------------------------------------------------------------------------------- */
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.stack > * + * { margin-top: 0.5rem; }
.mt-0 { margin-top: 0; }
[hidden] { display: none !important; }
