/* Website to content model. Shares its look with the content model audit tool. */

:root {
  --bg: #05080f;
  --surface: #0b111d;
  --surface-2: #101827;
  --border: #1e2b42;
  --border-strong: #2c3d5c;
  --text: #f0f4fa;
  --muted: #b7c3d6;
  --subtle: #93a1b8;
  --accent: #16b1ff;
  --accent-text: #03131c;
  --accent-soft: rgb(22 177 255 / 12%);
  --accent-ink: #8adcff;
  --ok: #3fdcae;
  --ok-soft: rgb(63 220 174 / 10%);
  --warn: #ffd166;
  --warn-soft: rgb(255 209 102 / 10%);
  --danger: #ff7a6b;
  --kind-page: #16b1ff;
  --kind-module: #b79bff;
  --kind-component: #3fdcae;
  --kind-data: #ffd166;
  --kind-settings: #93a1b8;
  --radius: 14px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--text); }
code { font-family: var(--mono); font-size: 0.875em; color: var(--accent-ink); }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(100% - 2.5rem, 62rem); margin-inline: auto; }

/* ---------- header and footer ---------- */

.site-header { border-bottom: 1px solid var(--border); }
.site-header__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.9rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 650; color: var(--text); text-decoration: none; }
.brand__mark { width: 1.75rem; height: 1.75rem; }
.byline { color: var(--subtle); font-size: 0.9375rem; }
.brand-logo { display: inline-block; width: 130px; height: auto; vertical-align: -1px; }
.foot-logo { display: inline-block; padding-block: 0.5rem; margin-bottom: 0.35rem; }
.site-footer { margin-top: 4rem; padding-block: 1.75rem 2.5rem; border-top: 1px solid var(--border); color: var(--subtle); font-size: 0.9375rem; }
.site-footer p + p { margin-top: 0.35rem; }

.badge {
  font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; border: 1px solid rgb(255 209 102 / 30%);
}
.badge--ai { background: var(--ok-soft); color: var(--ok); border-color: rgb(63 220 174 / 35%); }

/* ---------- intro and form ---------- */

.hero {
  padding-block: 3.5rem 2rem;
  background:
    radial-gradient(60rem 22rem at 80% -10%, rgb(22 177 255 / 16%), transparent 70%),
    radial-gradient(40rem 18rem at 0% 0%, rgb(255 138 61 / 8%), transparent 70%);
}
.hero h1 { margin-top: 0.6rem; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.025em; max-width: 18ch; }
.lede { margin-top: 1rem; color: var(--muted); font-size: 1.125rem; max-width: 44rem; }
.promise {
  display: flex; gap: 0.65rem; align-items: flex-start; margin-top: 1.5rem; max-width: 44rem; padding: 0.8rem 1rem;
  border: 1px solid rgb(63 220 174 / 35%); border-radius: 12px; background: rgb(63 220 174 / 7%); color: var(--muted);
}
.promise strong { color: var(--text); }
.promise svg { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; color: var(--ok); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem;
}

.form { margin-top: 0.5rem; }
.form__head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.label { display: block; font-weight: 650; font-size: 1.125rem; }
.form__row { display: flex; gap: 10px; }
.form__extras { display: grid; gap: 8px; }
.form__extras:not(:empty) { margin-top: 8px; }
.input {
  flex: 1; min-width: 0; min-height: 2.75rem; padding: 0.55rem 0.85rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
}
.input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.hint { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.form__error { margin-top: 12px; color: var(--danger); font-weight: 600; }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem;
  font: inherit; font-weight: 600; padding: 0.55rem 1.1rem; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.button:hover { border-color: var(--accent); }
.button--primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button--primary:hover { background: var(--accent-ink); }
.button--small { min-height: 0; padding: 4px 10px; font-size: 0.85rem; }
.button:disabled { opacity: 0.6; cursor: progress; }
.link-button { margin-top: 10px; padding: 0; background: none; border: 0; color: var(--accent-ink); font: inherit; font-size: 0.92rem; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.icon-button {
  width: 44px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-size: 1.2rem; cursor: pointer;
}

.examples { margin-top: 1.25rem; }
.examples__label { color: var(--muted); font-size: 0.92rem; }
.examples__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
.example-button {
  text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); display: grid; gap: 2px;
}
.example-button:hover { border-color: var(--accent); }
.example-button__title { font-weight: 600; color: var(--accent-ink); }
.example-button__meta { color: var(--subtle); font-size: 0.86rem; }

/* ---------- progress ---------- */

.progress { margin-top: 1.5rem; }
.progress__title { font-size: 1.05rem; }
.progress__steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.progress__step { padding-left: 26px; position: relative; color: var(--muted); overflow-wrap: anywhere; }
.progress__step::before {
  content: ""; position: absolute; left: 4px; top: 0.42em; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border);
}
.progress__step.is-done::before { background: var(--ok); border-color: var(--ok); }
.progress__step.is-current { color: var(--text); }
.progress__step.is-current::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .progress__step.is-current::before { animation: none; background: var(--accent); }
}

/* ---------- result ---------- */

#result { margin-top: 40px; display: grid; gap: 16px; scroll-margin-top: 16px; }
#result > * { min-width: 0; }
.result-head { display: flex; justify-content: space-between; align-items: end; gap: 16px 32px; flex-wrap: wrap; }
.eyebrow { color: var(--accent-ink); font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.result-head__title { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.stats { display: flex; gap: 28px; margin: 0; }
.stats dt { color: var(--muted); font-size: 0.82rem; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.notice {
  padding: 0.8rem 1rem; border-radius: 12px; background: var(--accent-soft);
  border: 1px solid rgb(22 177 255 / 30%); color: var(--muted);
}
.notice strong { color: var(--text); }
.notice--warn { background: var(--warn-soft); border-color: rgb(255 209 102 / 30%); }
.notice--ai { background: var(--ok-soft); border-color: rgb(63 220 174 / 35%); }

.actions__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.actions__status:not(:empty) { margin-top: 12px; color: var(--muted); font-size: 0.92rem; }

.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card h3 { font-size: 1.05rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.notes { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.93rem; display: grid; gap: 6px; }
.count {
  font-size: 0.78rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.count--ok { background: var(--ok-soft); color: var(--ok); }
.count--warn { background: var(--warn-soft); color: var(--warn); }

.pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pages__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.pages__skipped p { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 0.8rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip--type { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.chip--warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* ---------- tabs ---------- */

.tabs { margin-top: 8px; }
.tabs__list { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  font: inherit; font-weight: 600; padding: 10px 14px; background: none; border: 0; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 20px; }

/* ---------- content types ---------- */

.kind-group + .kind-group { margin-top: 32px; }
.kind-group__title { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.kind-group__note { color: var(--muted); font-size: 0.92rem; margin: 2px 0 12px; }

.type-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--kind);
  border-radius: var(--radius); padding: 18px 20px; scroll-margin-top: 16px;
}
.type-card + .type-card { margin-top: 12px; }
.type-card:target { outline: 2px solid var(--accent); }
.type-card--page { --kind: var(--kind-page); }
.type-card--module { --kind: var(--kind-module); }
.type-card--component { --kind: var(--kind-component); }
.type-card--data { --kind: var(--kind-data); }
.type-card--settings { --kind: var(--kind-settings); }
.type-card__header { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.type-card__name { font-size: 1.08rem; }
.type-card__id { color: var(--subtle); }
.type-card__description { margin-top: 6px; }
.type-card__why, .type-card__used { margin-top: 8px; color: var(--muted); font-size: 0.93rem; }
.type-card__why strong { color: var(--text); }

.table-scroll { overflow-x: auto; margin-top: 14px; }
.fields { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.fields th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--border);
}
.fields td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.fields tr:last-child td { border-bottom: 0; }
.fields td:first-child { min-width: 190px; }
.field-name { font-weight: 600; margin-right: 8px; }
.field-id { color: var(--subtle); }
.field-help { color: var(--muted); font-size: 0.86rem; margin-top: 2px; max-width: 46ch; }
.field-type { min-width: 150px; }
.rules { display: flex; flex-wrap: wrap; gap: 5px; }
.rule { font-size: 0.78rem; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.rule--strong { color: var(--text); font-weight: 600; }
.rule--accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- diagram ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 0.86rem; color: var(--muted); }
.legend__item::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; background: var(--kind);
}
.legend__item--page { --kind: var(--kind-page); }
.legend__item--module { --kind: var(--kind-module); }
.legend__item--component { --kind: var(--kind-component); }
.legend__item--data { --kind: var(--kind-data); }
.legend__item--settings { --kind: var(--kind-settings); }

.diagram-scroll { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.diagram { display: block; margin-inline: auto; }
.diagram__box { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1; }
.diagram__node { cursor: default; outline: none; }
.diagram__node--page { --kind: var(--kind-page); }
.diagram__node--module { --kind: var(--kind-module); }
.diagram__node--component { --kind: var(--kind-component); }
.diagram__node--data { --kind: var(--kind-data); }
.diagram__node--settings { --kind: var(--kind-settings); }
.diagram__stripe { fill: var(--kind); }
.diagram__name { fill: var(--text); font-size: 13px; font-weight: 600; }
.diagram__kind { fill: var(--muted); font-size: 10.5px; }
.diagram__back { fill: var(--accent-ink); font-size: 10.5px; font-weight: 600; }
.diagram__edge { fill: none; stroke: var(--muted); stroke-width: 1.2; opacity: 0.55; }
.diagram__edge--back { stroke-dasharray: 4 4; }
.diagram__arrow { fill: var(--muted); }
.diagram--focused .diagram__edge { opacity: 0.12; }
.diagram--focused .diagram__node { opacity: 0.4; }
.diagram--focused .diagram__edge.is-active { opacity: 1; stroke: var(--accent); stroke-width: 1.8; }
.diagram--focused .diagram__node.is-active { opacity: 1; }
.diagram__node:focus-visible .diagram__box, .diagram__node.is-active .diagram__box { stroke: var(--accent); stroke-width: 1.5; }

/* ---------- references: view switch and 3D model ---------- */

.references__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 0.6rem; }
.references__bar .legend { margin-bottom: 0; }
.references__note:not(:empty) { margin: 0.5rem 0; color: var(--warn); font-size: 0.92rem; }
.references__loading { padding: 3rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.references .legend__note { color: var(--subtle); font-size: 0.86rem; margin-bottom: 0.75rem; }

.segmented { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
.segmented__option {
  font: inherit; font-weight: 600; font-size: 0.92rem; min-height: 2.25rem; padding: 0.3rem 0.9rem; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.segmented__option:hover { color: var(--text); }
.segmented__option[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.model3d {
  position: relative; height: clamp(26rem, 72vh, 42rem); overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background:
    radial-gradient(38rem 20rem at 50% 0%, rgb(22 177 255 / 9%), transparent 70%),
    var(--surface);
}
.model3d__host { position: absolute; inset: 0; isolation: isolate; }
.model3d__canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.model3d__canvas:active { cursor: grabbing; }
.model3d__labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.model3d__label {
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; font-size: 0.74rem; font-weight: 600; color: var(--text);
  background: rgb(5 8 15 / 62%); border: 1px solid rgb(44 61 92 / 70%); transition: opacity 0.15s;
}
.model3d__label.is-dim { opacity: 0.18; }
.model3d__label.is-focus { border-color: var(--accent); color: var(--accent-ink); }
.model3d__tip {
  position: absolute; left: 0; top: 0; z-index: 3; max-width: min(22rem, 80%); padding: 0.4rem 0.65rem; pointer-events: none;
  border-radius: 8px; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text); font-size: 0.82rem;
}
.model3d__toolbar { position: absolute; left: 0.75rem; top: 0.75rem; z-index: 2; display: flex; gap: 0.4rem; }
.model3d__toolbar .button { background: rgb(16 24 39 / 85%); }
.model3d__toolbar .button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
.model3d__hint {
  position: absolute; left: 0.75rem; bottom: 0.6rem; z-index: 1; margin: 0; pointer-events: none;
  color: var(--subtle); font-size: 0.78rem; max-width: calc(100% - 1.5rem);
}

.panel3d {
  position: absolute; z-index: 4; top: 0.75rem; right: 0.75rem; bottom: 0.75rem; width: min(21rem, calc(100% - 1.5rem));
  padding: 1rem; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border-strong); border-radius: 12px; background: rgb(11 17 29 / 94%); backdrop-filter: blur(6px);
}
.panel3d__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.panel3d__kind { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--kind); }
.panel3d__kind--page { --kind: var(--kind-page); }
.panel3d__kind--module { --kind: var(--kind-module); }
.panel3d__kind--component { --kind: var(--kind-component); }
.panel3d__kind--data { --kind: var(--kind-data); }
.panel3d__kind--settings { --kind: var(--kind-settings); }
.panel3d__name { font-size: 1.15rem; margin: 0.1rem 0 0.15rem; }
.panel3d__close { flex: none; width: 2.25rem; height: 2.25rem; }
.panel3d__description { margin-top: 0.6rem; color: var(--muted); font-size: 0.92rem; }
.panel3d__links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.7rem; font-size: 0.82rem; color: var(--subtle); }
.panel3d__subhead { margin: 1rem 0 0.2rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--subtle); }
.panel3d__fields { list-style: none; margin: 0; padding: 0; }
.panel3d__fields li { padding: 0.55rem 0; border-top: 1px solid var(--border); display: grid; gap: 0.2rem; font-size: 0.9rem; }
.panel3d__type { color: var(--muted); font-size: 0.86rem; }
.chip--button { border: 1px solid var(--border-strong); background: transparent; color: var(--accent-ink); font: inherit; font-size: 0.8rem; cursor: pointer; }
.chip--button:hover { border-color: var(--accent); color: var(--text); }

@media (max-width: 40rem) {
  .model3d { height: clamp(26rem, 78vh, 38rem); }
  .panel3d { top: auto; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; width: auto; max-height: 58%; }
  .model3d__hint { display: none; }
}

/* ---------- code ---------- */

.code { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.code__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); color: var(--muted); font-family: var(--mono); font-size: 0.84rem;
}
.code pre code { color: inherit; }
.code pre { margin: 0; padding: 14px; color: var(--muted); max-height: 560px; overflow: auto; font-size: 0.84rem; line-height: 1.5; tab-size: 2; }

/* ---------- checks ---------- */

.checks { margin-top: 8px; }
.checks__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 24px; }
.check { display: flex; gap: 10px; font-size: 0.93rem; }
.check__mark {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; margin-top: 2px;
}
.check--pass .check__mark { background: var(--ok-soft); color: var(--ok); }
.check--fail .check__mark { background: var(--warn-soft); color: var(--warn); }
.check__detail { color: var(--muted); font-family: var(--mono); font-size: 0.82rem; overflow-wrap: anywhere; }
.adjustments { margin-top: 16px; color: var(--muted); font-size: 0.9rem; }
.adjustments summary { cursor: pointer; }
.adjustments ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }

@media (max-width: 560px) {
  .form__row { flex-wrap: wrap; }
  .form__row .button { width: 100%; }
  .form__extras .form__row { flex-wrap: nowrap; }
  .stats { gap: 20px; }
  .card, .type-card { padding: 16px; }
}
