:root {
  --ink: #16202a;
  --ink-soft: #4a5663;
  --muted: #6b7682;
  --line: #dfe4ea;
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --accent: #1f6feb;
  --accent-dark: #1553b8;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 42, 0.06), 0 4px 16px rgba(22, 32, 42, 0.06);
  --surface: #ffffff;
  --link: #1f6feb;
  --accent-text: #1553b8;
  --accent-soft: #eaf1fd;
  --badge-muted: #eceff3;
  --input-border: #c9d1da;
  --bar: #16202a;
  --hero: linear-gradient(135deg, #eef4fd, #f7f9fb);
  --card-media: linear-gradient(135deg, #dbe7f8, #eef4fd);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --add-section-bg: #f3f8ff;
  --danger-soft: #fdecea;
  --success: #1a7f37;
  --success-soft: #e6f4ea;
  --notice-bg: #fff6d6;
  --notice-ink: #6b5200;
  --on-accent: #ffffff;
  --table-head: #16202a;
  --table-head-ink: #ffffff;
  --overlay: rgba(22, 32, 42, 0.82);
  --section-bg-opacity: 0.12;
  color-scheme: light;
}

/* Dark themes: chosen per page by the editor (data-theme on <html>). "dark": graphite, ivory text, champagne accent. */
[data-theme="dark"] {
  --ink: #ecebe6;
  --ink-soft: #b9b7b0;
  --muted: #87857f;
  --line: #27282c;
  --bg: #0e0f11;
  --bg-soft: #121315;
  --accent: #c9a96e;
  --accent-dark: #b59358;
  --on-accent: #17140d;
  --danger: #e0786c;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 12px 32px rgba(0, 0, 0, 0.35);
  --surface: #17181b;
  --link: #d8bd88;
  --accent-text: #e4cd9e;
  --accent-soft: rgba(201, 169, 110, 0.12);
  --badge-muted: #222327;
  --input-border: #35363b;
  --bar: rgba(14, 15, 17, 0.88);
  --table-head: #1e1f23;
  --table-head-ink: #ecebe6;
  --overlay: rgba(12, 12, 14, 0.88);
  --hero: radial-gradient(900px 360px at 12% 0%, rgba(201, 169, 110, 0.09), transparent 70%), linear-gradient(180deg, #141517, #0e0f11);
  --card-media: linear-gradient(135deg, #1e1f23, #141517);
  --nav-bg: rgba(14, 15, 17, 0.78);
  --add-section-bg: #131416;
  --danger-soft: #2e1c1a;
  --success: #3d8b57;
  --success-soft: #16261c;
  --notice-bg: #262117;
  --notice-ink: #e8d3a6;
  --card-hover-border: rgba(201, 169, 110, 0.35);
  --placeholder: rgba(201, 169, 110, 0.3);
  --code-bg: #0a0a0c;
  --section-bg-opacity: 0.2;
  color-scheme: dark;
}
/* "dark-blue": midnight navy, cool white text, soft blue accent */
[data-theme="dark-blue"] {
  --ink: #e7edf6;
  --ink-soft: #aebbcd;
  --muted: #7d8aa0;
  --line: #1a2438;
  --bg: #050912;
  --bg-soft: #080e1b;
  --accent: #3d78e0;
  --accent-dark: #3067c7;
  --on-accent: #ffffff;
  --danger: #ec7a7a;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.4);
  --surface: #0d1628;
  --link: #8db4ff;
  --accent-text: #b3ccff;
  --accent-soft: rgba(93, 144, 240, 0.15);
  --badge-muted: #19233a;
  --input-border: #2a3953;
  --bar: rgba(5, 9, 18, 0.9);
  --table-head: #16213a;
  --table-head-ink: #e7edf6;
  --overlay: rgba(7, 12, 24, 0.88);
  --hero: radial-gradient(900px 360px at 12% 0%, rgba(93, 144, 240, 0.16), transparent 70%), linear-gradient(180deg, #0b1324, #050912);
  --card-media: linear-gradient(135deg, #122039, #0a1222);
  --nav-bg: rgba(5, 9, 18, 0.8);
  --add-section-bg: #0a1223;
  --danger-soft: #2d1b22;
  --success: #3d8b57;
  --success-soft: #12261c;
  --notice-bg: #172440;
  --notice-ink: #c7d9fb;
  --card-hover-border: rgba(93, 144, 240, 0.45);
  --placeholder: rgba(93, 144, 240, 0.35);
  --code-bg: #03060d;
  --section-bg-opacity: 0.22;
  color-scheme: dark;
}
[data-theme^="dark"] body { -webkit-font-smoothing: antialiased; }
[data-theme^="dark"] :is(h1, h2, h3, h4) { font-weight: 600; letter-spacing: -0.015em; }
[data-theme^="dark"] .eyebrow { letter-spacing: 0.16em; font-weight: 500; }
[data-theme^="dark"] :is(.site-header, .editor-bar) { backdrop-filter: blur(10px); }
[data-theme^="dark"] .site-header { border-bottom: 1px solid var(--line); }
[data-theme^="dark"] .editor-bar { border-top: 1px solid var(--line); }
[data-theme^="dark"] .site-brand { color: var(--ink); letter-spacing: 0.01em; }
[data-theme^="dark"] .header-link { color: var(--ink-soft); }
[data-theme^="dark"] .header-link:hover { color: var(--accent-text); }
[data-theme^="dark"] .header-page-title { color: var(--ink); }
[data-theme^="dark"] .header-page-title::before { color: var(--ink-soft); }
[data-theme^="dark"] .section + .section { border-top: 1px solid var(--line); }
[data-theme^="dark"] a.project-card:hover { border-color: var(--card-hover-border); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
[data-theme^="dark"] .project-card-placeholder { color: var(--placeholder); }
[data-theme^="dark"] :is(.code, .tab.active) { background: var(--code-bg); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--link); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
img { max-width: 100%; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; }
[hidden] { display: none !important; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 600; color: var(--link); margin: 0 0 0.4rem; }
.prose p { margin: 0 0 0.8em; white-space: pre-line; }
.prose p:last-child { margin-bottom: 0; }
.lead { font-size: 1.3rem; font-weight: 500; color: var(--ink); margin: 0 0 0.8rem; }
.empty-state { color: var(--muted); font-style: italic; }
.form-error, .field-error { color: var(--danger); font-size: 0.88rem; }
.form-error { background: var(--danger-soft); padding: 0.5rem 0.75rem; border-radius: 6px; }

/* Buttons */
.button {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:disabled { opacity: 0.55; cursor: default; }
.button-ghost { background: transparent; color: var(--link); }
.button-ghost:hover { background: var(--accent-soft); color: var(--accent-text); }
.button-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 6px;
  min-width: 30px;
  height: 30px;
  padding: 0 0.45rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-button:hover { border-color: var(--link); color: var(--link); }
.icon-button.danger:hover { border-color: var(--danger); color: var(--danger); }
.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-muted { background: var(--badge-muted); color: var(--muted); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem 24px;
  background: var(--bar);
  color: #fff;
}
.site-brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.header-link { color: #b9d4ff; text-decoration: none; font-size: 0.92rem; }
.header-link:hover { color: #fff; }
/* The page's project (project.html) or map title (case_study.html, after the link back to its project) */
.header-page-title { margin-left: -0.6rem; color: #fff; font-size: 0.92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.header-page-title::before { content: "|"; margin-right: 0.6rem; color: rgba(255, 255, 255, 0.45); font-weight: 400; }
.header-button { background: none; border: 0; padding: 0; font: inherit; font-size: 0.92rem; cursor: pointer; }
.site-header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.9rem; }
.site-header .button-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.site-header .button-ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.save-status { font-size: 0.82rem; color: #b8c2cc; cursor: default; }
.save-status.saving { color: #ffd479; }
.save-status.saved { color: #8fdca9; }
.save-status.error { color: #fff; background: var(--danger); padding: 0.15rem 0.6rem; border-radius: 6px; cursor: pointer; }
.preview-banner { background: var(--notice-bg); color: var(--notice-ink); text-align: center; padding: 0.4rem 24px; font-size: 0.9rem; }
.preview-banner .button { margin-left: 0.6rem; }

/* Page hero */
.page-hero { background: var(--hero); border-bottom: 1px solid var(--line); padding: 3.5rem 0 3rem; }
.page-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.hero-intro { font-size: 1.1rem; color: var(--ink-soft); }
/* Banner image behind the title, darkened on the text side so it stays readable in every theme */
.page-hero.has-banner { position: relative; overflow: hidden; padding: 5.5rem 0 5rem; color: #fff; border-bottom: 0; }
.hero-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page-hero.has-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 10, 18, 0.85), rgba(6, 10, 18, 0.55) 55%, rgba(6, 10, 18, 0.25)); }
[data-theme^="dark"] .page-hero.has-banner::after { background: linear-gradient(90deg, rgba(4, 6, 10, 0.93), rgba(4, 6, 10, 0.75) 55%, rgba(4, 6, 10, 0.5)); }
.page-hero.has-banner .container { position: relative; z-index: 1; }
.page-hero.has-banner .hero-intro { color: rgba(255, 255, 255, 0.86); max-width: 760px; }
.page-hero.has-banner .eyebrow { color: rgba(255, 255, 255, 0.75); }
.page-hero.has-banner h1 { text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35); }

/* Main page */
/* Projects use the full window width: as many cards per row as fit, a row not filled is centered */
.projects-wide { padding: 0 24px; }
.project-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; padding: 2.5rem 0 4rem; }
.project-grid > .project-card { flex: 0 0 min(380px, 100%); }
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* Image 3/4 of the card height, title in the last quarter */
a.project-card { display: grid; grid-template-rows: 3fr 1fr; aspect-ratio: 16 / 11; }
a.project-card:hover, a.project-card:focus-visible { position: relative; z-index: 1; transform: translateY(-2px) scale(1.04); box-shadow: 0 8px 28px rgba(22, 32, 42, 0.12); }
.project-card-media { position: relative; min-height: 0; overflow: hidden; background: var(--card-media); }
.project-card.editing .project-card-media { aspect-ratio: 16 / 8.25; }
.project-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; font-weight: 700; color: rgba(31, 111, 235, 0.35); text-transform: uppercase; }
.project-card-summary {
  position: absolute;
  inset: 0;
  padding: 1.2rem 1.4rem;
  overflow: hidden;
  background: var(--overlay);
  color: #fff;
  font-size: 0.98rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
a.project-card:hover .project-card-summary, a.project-card:focus-visible .project-card-summary { opacity: 1; }
.project-card-title { display: flex; align-items: center; gap: 0.8rem; min-height: 0; margin: 0; padding: 0 1.4rem; font-size: 1.25rem; overflow: hidden; }
.project-card-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Logo: right of the title, in its own proportions up to a maximum size */
.project-card-logo { margin-left: auto; flex-shrink: 0; width: auto; height: auto; max-height: 2.2rem; max-width: 35%; }
.project-card-body { padding: 1rem 1.4rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.project-card-body h2 { font-size: 1.25rem; }
.project-card-body .project-card-title { padding: 0; margin-bottom: 0.4rem; }
.card-actions { margin-top: auto; padding-top: 1rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (hover: none) {
  /* No hover on touch screens: show the summary as a caption instead */
  .project-card-summary { opacity: 1; top: 40%; background: linear-gradient(transparent, var(--overlay) 35%); padding-top: 2rem; font-size: 0.9rem; }
}
@media (max-width: 760px) {
  .project-grid > .project-card { flex-basis: 100%; }
}
.card-actions .button { margin-right: auto; }

/* Project page sections */
/* --header-height is measured by sections.js, so the nav sticks right under the header */
/* Section menu: frosted bar; an underline slides to the section being read (sections.js) */
.section-nav { position: sticky; top: var(--header-height, 48px); z-index: 10; background: var(--nav-bg); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
.section-nav-wrap { position: relative; }
.section-nav .section-nav-wrap { max-width: none; }
.section-nav-inner { position: relative; display: flex; gap: 0.3rem; overflow-x: auto; padding-top: 0.3rem; padding-bottom: 0.3rem; scrollbar-width: none; scroll-behavior: smooth; }
.section-nav-inner::-webkit-scrollbar { display: none; }
/* Buttons share the full window width when they fit; otherwise the strip scrolls */
.section-nav a {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  padding: 0.55rem 1rem;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  transition: color 0.25s ease;
}
.section-nav a:hover { color: var(--ink); }
.section-nav a.is-current { color: var(--ink); }
.section-nav-pill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}
.section-nav-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 52px;
  border: 0;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
.section-nav-arrow:hover { color: var(--link); }
.section-nav-prev { left: 0; text-align: left; padding-left: 12px; background: linear-gradient(90deg, var(--bg) 50%, transparent); }
.section-nav-next { right: 0; text-align: right; padding-right: 12px; background: linear-gradient(270deg, var(--bg) 50%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .section-nav-pill { transition: none; }
}
.section { padding: 3.5rem 0; }
.section:nth-of-type(even) { background: var(--bg-soft); }
.section-title { font-size: 1.9rem; margin-bottom: 1.2rem; }
/* Section background image: toned into the theme colors and faded out at the edges */
.section.has-bg { position: relative; isolation: isolate; }
.section-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: var(--section-bg-opacity);
  mix-blend-mode: luminosity;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.section h3 { margin-top: 1.8rem; font-size: 1.2rem; }
.section > .container > .prose { color: var(--ink-soft); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.card h3, .card h4 { margin-top: 0; font-size: 1.05rem; }
.card .prose { color: var(--ink-soft); font-size: 0.95rem; }

.overview-middle { margin-top: 2rem; color: var(--ink-soft); }
.fact-row { display: flex; flex-wrap: wrap; gap: 16px; }
.fact { flex: 1 1 160px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.fact-value { display: block; font-size: 1.7rem; font-weight: 700; color: var(--accent-text); }
.fact-label { color: var(--muted); font-size: 0.9rem; }
.hero-facts { margin-top: 2rem; }
.page-hero.has-banner .fact { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); backdrop-filter: blur(6px); }
.page-hero.has-banner .fact-value { color: #fff; }
.page-hero.has-banner .fact-label { color: rgba(255, 255, 255, 0.75); }

/* Numbered items (product features, process steps): the chosen one cross-fades in next to the text; a tab bar below */
.feature-row.has-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.feature-row.side-right .feature-side { order: 1; }
.feature-side > .section-figure { margin: 0; }
/* Data sources: a list with numbered badges, one below the other */
.source-list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.source-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.source-row:hover, a.source-row:focus-visible { background: var(--accent-soft); }
.source-num {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--link);
  transition: border-color 0.2s ease;
}
.source-row:hover .source-num { border-color: var(--accent); }
.source-name { align-self: center; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.source-desc { grid-column: 2; color: var(--ink-soft); font-size: 0.95rem; white-space: pre-line; }
.source-arrow { display: inline-block; margin-left: 0.35rem; color: var(--link); font-size: 0.95rem; transition: transform 0.2s ease; }
a.source-row:hover .source-arrow { transform: translate(2px, -2px); }
.part:has(.feature-explorer) + .part { margin-top: 3rem; }
@media (max-width: 760px) {
  .source-row { padding: 0.8rem 0.4rem; }
}
.feature-link { position: relative; display: inline-block; margin-top: 0.9rem; font-weight: 600; text-decoration: none; }
.feature-link:hover { text-decoration: underline; }
.feature-panel .section-figure { position: relative; margin-bottom: 0; }
.feature-bar { display: flex; gap: 6px; margin: 2.2rem 0 0; padding-bottom: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.feature-bar::-webkit-scrollbar { display: none; }
.feature-tab {
  flex: 1 1 0;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: -3px;
  padding: 0.7rem 0.9rem 0.8rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 10px 10px 0 0;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.feature-tab:hover { color: var(--ink); background: var(--bg-soft); }
.feature-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), transparent); }
.feature-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.feature-num { font-size: 0.72rem; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; color: var(--link); }
.feature-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.section:nth-of-type(even) .feature-tab:hover { background: var(--bg); }
.feature-panels { display: grid; position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.feature-panel {
  grid-area: 1 / 1;
  position: relative;
  padding: 2rem 2.2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}
.feature-panel.is-active { opacity: 1; visibility: visible; transform: none; }
[data-theme="dark-blue"] .feature-panels {
  border-color: rgba(93, 144, 240, 0.3);
  background: radial-gradient(120% 90% at 0% 0%, rgba(93, 144, 240, 0.08), transparent 60%), var(--surface);
  box-shadow: 0 0 20px rgba(61, 120, 224, 0.16), 0 0 56px rgba(61, 120, 224, 0.07);
}
.feature-panel-num { position: absolute; top: 0.3rem; right: 1.4rem; font-size: 5.5rem; font-weight: 700; line-height: 1; color: var(--accent-soft); pointer-events: none; }
.feature-panel h3 { position: relative; margin: 0 0 0.8rem; font-size: 1.4rem; max-width: 80%; }
.feature-panel .prose { position: relative; font-size: 1.04rem; color: var(--ink-soft); }
/* Vertical: the list on the left, the bubble on the right */
.feature-explorer.is-vertical { display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.7fr); gap: 2.5rem; align-items: center; margin-top: 1.5rem; }
.is-vertical .feature-row { order: 1; }
.is-vertical .feature-bar { flex-direction: column; gap: 0; margin: 0; padding: 0; border-bottom: 0; border-left: 1px solid var(--line); overflow: visible; }
.is-vertical .feature-tab {
  flex: none;
  min-width: 0;
  flex-direction: row;
  align-items: baseline;
  gap: 0.9rem;
  margin: 0 0 0 -1px;
  padding: 0.75rem 1rem;
  border-bottom: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
}
.is-vertical .feature-tab:hover { background: none; }
.is-vertical .feature-tab[aria-selected="true"] { border-left-color: var(--accent); background: none; }
.part-content + .feature-explorer.is-vertical { margin-top: 2rem; }
@media (max-width: 760px) {
  .feature-explorer.is-vertical { grid-template-columns: 1fr; gap: 1.2rem; }
  .is-vertical .feature-row { order: 0; }
  .feature-tab { flex: 0 0 auto; min-width: 0; max-width: 70vw; }
  .feature-panel { padding: 1.6rem 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .feature-tab, .feature-panel { transition: none; }
}

.case-list { display: grid; gap: 20px; margin-top: 1.5rem; }
.case { display: grid; grid-template-columns: 280px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.case:not(:has(.case-image)) { grid-template-columns: 1fr; }
.case-image { width: 100%; height: 100%; object-fit: cover; }
.case-body { padding: 1.4rem; }
/* A case study's short texts (its map shows them the same way, map.css .case-info-meta): names and values in columns */
.case-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.1rem 0.8em; margin: 0.4rem 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; color: var(--ink-soft); }
.case-meta dt { font-weight: 700; opacity: 0.8; }
.case-meta dd { margin: 0; }
.case-summary { margin: 1rem 0; }
/* Unpublished (sections/case_studies.html; the editor's list item, editor.js): faded */
.case.is-unpublished, .list-item.is-unpublished > summary { opacity: 0.5; }
/* The whole card opens the case study page */
a.case { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
a.case:hover, a.case:focus-visible { border-color: var(--accent); box-shadow: 0 10px 30px rgba(22, 32, 42, 0.14); transform: translateY(-2px); }
[data-theme^="dark"] a.case:hover { border-color: var(--card-hover-border); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
a.case h3 { color: var(--ink); }
/* A case study title's further lines (sections/case_studies.html) */
a.case h3 .title-line { display: block; margin-top: 0.15em; font-size: 0.8em; font-weight: 400; }
.case-open { color: var(--link); font-weight: 600; font-size: 0.92rem; }
a.case:hover .case-open { text-decoration: underline; }

/* Map page (case study, interactive demo): a full-window map, the data editor under it */
/* --case-map-extra: the snapshot editor below its top row, added below the map (case_study.html) */
.case-map-frame { height: calc(var(--case-map-height, calc(100vh - 50px)) + var(--case-map-extra, 0px)); min-height: 420px; }
.case-map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
/* Viewers swapping the map in place (case_study.html): both frames stacked while the old one fades out */
.case-map-frame.is-swapping { position: relative; }
.case-map-frame.is-swapping iframe { position: absolute; inset: 0; }
/* A case study's map loaded unseen for its first view (case_study.html cameraOf): the same size as the shown one */
.case-map-frame:has(.case-map-probe) { position: relative; }
/* An interactive map kept for the way back (case_study.html): unseen, still */
.case-map-frame:has(.is-kept) { position: relative; }
.case-map-frame iframe.is-kept { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.case-map-frame .case-map-probe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; visibility: hidden; pointer-events: none; }
#case-editor { margin-bottom: 5rem; }
/* Theme selector in the header, for editors */
.header-theme { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: #b8c2cc; }
.header-theme select { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.4rem; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: #fff; }
.header-theme select option { color: #16202a; background: #fff; }

.section-figure { display: block; max-width: 100%; height: auto; margin: 1rem 0; border-radius: var(--radius); }
/* Spacing sits on the part, so an image next to the text lines up with the text */
.part + .part { margin-top: 1.8rem; }
.part > h3 { margin-top: 0; }
.part-body > :first-child { margin-top: 0; }
.part-beside .card-grid { margin-top: 0; }
.part-beside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.part-beside > .section-figure { margin-top: 0; }
@media (max-width: 760px) { .part-beside { grid-template-columns: 1fr; } }

.table-scroll { overflow-x: auto; margin: 1.2rem 0; }
/* Slightly see-through, so a section background shows behind it */
.data-table { border-collapse: collapse; width: 100%; background: color-mix(in srgb, var(--surface) 82%, transparent); font-size: 0.95rem; }
.data-table th, .data-table td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--table-head); color: var(--table-head-ink); font-weight: 600; }
.data-table td:first-child { font-weight: 600; }
.data-table th.col-highlight { background: var(--accent); color: var(--on-accent); }
.data-table td.col-highlight { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
/* The row under the pointer, highlighted column included (headers are not) */
.data-table tbody td { transition: background-color 0.12s; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.data-table tbody tr:hover td.col-highlight { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.table-editor .cell-highlight { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 400; margin-top: 4px; }
.notes { font-size: 0.9rem; color: var(--muted); }

.simulator { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin-top: 1.5rem; }
.simulator-options { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.simulator-options label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.simulator select, .editor-panel select, .section-card select, .inline-form select, .inline-form input, .login-form input {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  min-width: 160px;
}
.simulator-progress { margin-top: 1.2rem; }
.progress-bar { height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); }
/* An upload or its conversion running (editor.js), on one row: name, step and percentage, the bar, Cancel on the
   right; under the file field's buttons, or in its list card's header (seen while folded) */
.upload-slot:empty { display: none; }
.upload-inline { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; padding: 0.4rem 0.4rem 0.4rem 0.7rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); font-size: 0.88rem; }
.upload-name { flex: 0 1 auto; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { flex: 0 1 auto; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-inline .button { flex: none; margin-left: auto; }
/* Its whole length faintly filled: the scale the progress runs along */
.upload-progress { flex: 1 1 6rem; min-width: 4rem; background: color-mix(in srgb, var(--accent) 16%, transparent); }
summary .upload-inline { flex: 0 1 32rem; min-width: 0; margin: 0 0 0 auto; padding: 0.15rem 0.2rem 0.15rem 0.5rem; font-size: 0.8rem; font-weight: 400; }
summary .upload-inline .upload-name { display: none; }
summary .upload-inline .upload-status { max-width: 55%; }
summary .upload-inline + .list-item-actions { margin-left: 0.5rem; }
.upload-progress span { transition: width 0.2s ease; }
/* No percentage while the server works: a band moves along the bar */
.upload-progress.is-busy span { width: 30%; animation: upload-busy 1.4s ease-in-out infinite; }
@keyframes upload-busy { from { transform: translateX(-100%); } to { transform: translateX(333%); } }
@media (prefers-reduced-motion: reduce) { .upload-progress.is-busy span { animation: none; width: 100%; opacity: 0.5; } }
.simulator-result { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.simulator-result h3 { margin-top: 0; }

/* Embedded map spans the full window width, out of the page container: the section's width (100cqw), not 100vw,
   which takes in the scrollbar and puts the map's right edge (its widgets' margin) under it */
.map-frame { width: 100cqw; margin: 1.2rem 0 0 calc(50% - 50cqw); overflow: hidden; }
.section-interactive-map { overflow-x: clip; container-type: inline-size; }
/* No title and no introduction: the map starts the section */
.section-interactive-map.no-title:has(> .container > .map-frame:first-child) { padding-top: 0; }
.section-interactive-map.no-title .container > .map-frame:first-child { margin-top: 0; }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.demo-explore { margin: 1.2rem 0 0; text-align: center; }

.download-list { list-style: none; padding: 0; display: grid; gap: 12px; margin-top: 1.5rem; }
.download { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.download h3 { margin: 0 0.5rem 0.2rem 0; font-size: 1.05rem; display: inline; }
.download .prose { color: var(--ink-soft); font-size: 0.93rem; margin-top: 0.3rem; }

.endpoint { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-top: 1.2rem; }
.endpoint-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; font-size: 1.05rem; }
.method { font-weight: 700; font-size: 0.78rem; padding: 0.2rem 0.55rem; border-radius: 5px; color: #fff; background: #57606a; }
.method-get { background: #1a7f37; }
.method-post { background: var(--accent); }
.method-put { background: #9a6700; }
.method-delete { background: var(--danger); }
.tabs { display: flex; gap: 4px; margin-top: 0.8rem; }
.tab { border: 0; background: transparent; padding: 0.35rem 0.8rem; border-radius: 6px 6px 0 0; cursor: pointer; font: inherit; font-size: 0.85rem; color: var(--muted); }
.tab.active { background: #0f1720; color: #fff; }
.code { background: #0f1720; color: #dfe8f1; padding: 1rem; border-radius: 0 8px 8px 8px; overflow-x: auto; margin: 0 0 0.8rem; line-height: 1.5; }
.try-result .code { border-radius: 8px; max-height: 360px; }
.try-meta { font-size: 0.85rem; margin: 0.8rem 0 0.4rem; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--hero); padding: 24px; }
.login-form { background: var(--surface); padding: 2rem; border-radius: 14px; box-shadow: var(--shadow); width: min(380px, 100%); display: flex; flex-direction: column; gap: 0.8rem; }
.login-form h1 { font-size: 1.5rem; margin: 0; }
.login-form p { margin: 0; }

/* Editor */
.editor-panel, .section-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-top: 1.5rem; box-shadow: var(--shadow); }
.editor-panel h2 { font-size: 1.1rem; }
.editor-heading { font-size: 1.3rem; margin-top: 2.5rem; }
.add-section { background: var(--add-section-bg); border-style: dashed; margin-bottom: 4rem; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; }
.fields { display: grid; gap: 0.9rem; margin-top: 0.8rem; }
.field-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 0.25rem; }
.field input[type="text"], .field input[type="url"], .field input[type="number"], .field textarea, .field select {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.slider-field { display: flex; align-items: center; gap: 0.8rem; }
.slider-field input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.slider-value { min-width: 3.5em; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.field textarea { resize: vertical; min-height: 4.5em; line-height: 1.45; }
.field-json textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid rgba(31, 111, 235, 0.35); border-color: var(--accent); }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; cursor: pointer; }
/* A colour field (editor.js colorInput): picker, #rrggbb, and for a legend's file colour the file's colours to pick */
.color-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.field .color-picker { width: 2.6rem; height: 2rem; padding: 0.1rem; flex-shrink: 0; cursor: pointer; }
.field .color-picker.is-empty { opacity: 0.35; }
/* A colour's opacity (editor.js colorInput, field.alpha) */
.color-opacity-wrap { display: inline-flex; align-items: center; gap: 0.4rem; }
.color-opacity-wrap .color-opacity { width: 9rem; }
.field input.color-text { width: 7.5rem; flex: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.color-swatch { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.55rem 0.2rem 0.25rem; border: 1px solid var(--line);
  border-radius: 999px; background: none; font: inherit; font-size: 0.85rem; cursor: pointer; }
.color-swatch:hover { border-color: var(--accent); }
.color-swatches .field-hint { font-size: 0.85rem; color: var(--ink-soft); }
.color-swatch-chip { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.25); }
.file-field { display: grid; gap: 0.35rem; }
.file-path { display: flex; gap: 0.8rem; align-items: center; }
.file-path .input-wrap { flex: 1; min-width: 0; }
.file-path .file-open { flex-shrink: 0; font-size: 0.88rem; }
/* On a phone "Open" goes under the path */
@media (max-width: 760px) {
  .file-path { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .file-path .input-wrap { width: 100%; }
}
.file-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; font-size: 0.88rem; }
.file-actions .file-choose { width: auto; min-width: 9rem; max-width: min(20rem, 100%); padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.file-url { display: flex; gap: 0.5rem; align-items: center; }
.file-url[hidden] { display: none; }
.file-url input, .file-url select { flex: 1; min-width: 0; }

.section-card > summary, .list-item > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}
.section-card > summary::-webkit-details-marker, .list-item > summary::-webkit-details-marker { display: none; }
.section-card > summary::before, .list-item > summary::before { content: "\25B8"; color: var(--muted); transition: transform 0.15s; }
.section-card[open] > summary::before, .list-item[open] > summary::before { transform: rotate(90deg); }
.section-card-title { font-weight: 600; font-size: 1.05rem; }
.list-item-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Grid items no wider than their column, so a long card title ends in "..." instead of widening the form */
.fields > .field, .list-items > .list-item { min-width: 0; }
.list-item-actions { margin-left: auto; display: flex; gap: 4px; flex-shrink: 0; }
.section-card > .muted { margin: 0.6rem 0 0; font-size: 0.9rem; }

/* Editing: an open section's title sticks under the header while it is scrolled through;
   the section (or panel), list items and field last edited are highlighted (editor.js) */
/* The title bar fills the card's width, at the same place folded or not (nothing moves when it unfolds) */
.section-card > summary { margin: -1.2rem -1.4rem; padding: 0.8rem 1.4rem; border-radius: var(--radius); }
.section-card[open] > summary {
  position: sticky; top: var(--header-height, 48px); z-index: 5; margin-bottom: 0;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--line);
}
.section-card, .editor-panel, .list-item, .field { transition: box-shadow 0.15s, border-color 0.15s; }
:is(.section-card, .editor-panel) { --section-frame: var(--accent); }
/* Less saturated blue: clearly in the light theme (a touch warmer), slightly in the dark blue one */
:root:not([data-theme^="dark"]) :is(.section-card, .editor-panel) { --section-frame: color-mix(in oklab, var(--accent) 55%, #8c8494); }
[data-theme="dark-blue"] :is(.section-card, .editor-panel) { --section-frame: color-mix(in oklab, var(--accent) 75%, #6f7785); }
:is(.section-card, .editor-panel).is-current { border-color: var(--section-frame); box-shadow: 0 0 0 2px var(--section-frame), var(--shadow); }
/* Moved with its arrows (editor.js): framed until the next click elsewhere */
:is(.section-card, .list-item).is-moved { outline: 2px dashed var(--accent); outline-offset: 3px; }
.section-card.is-current > summary { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
/* Items: light blue in the light theme, the title row the same colour, an unfolded item's body lighter. In the dark
   themes a folded item and an unfolded one's title row are tinted blue / gold, lighter than the unfolded item's body. The item edited has
   a 2px frame (the section's is 3px) in its title row's colour; a shadow, so the layout does not shift */
:root:not([data-theme^="dark"]) .list-item { --item-bg: var(--accent-soft); --item-head: var(--accent-soft); }
[data-theme^="dark"] .list-item { --item-bg: var(--item-head); }
[data-theme="dark"] .list-item { --item-head: color-mix(in srgb, var(--surface) 84%, var(--accent)); }
[data-theme="dark"] .list-item[open] { background: color-mix(in srgb, var(--surface) 97%, #fff); }
[data-theme="dark-blue"] .list-item { --item-head: color-mix(in srgb, var(--surface) 78%, var(--accent)); }
[data-theme="dark-blue"] .list-item[open] { background: color-mix(in srgb, var(--surface) 94%, var(--accent)); }
:root:not([data-theme^="dark"]) .list-item[open] { background: color-mix(in srgb, var(--accent-soft) 50%, #fff); }
.list-item.is-current { border-color: var(--item-head); box-shadow: 0 0 0 1px var(--item-head); }
.list-item[open] > summary {
  margin: -0.55rem -0.8rem 0; padding: 0.55rem 0.8rem;
  background: var(--item-head); border-radius: 7px 7px 0 0; border-bottom: 1px solid var(--line);
}
/* Below the sub-section, only the control used (text box, dropdown) is highlighted */
:is(input:not([type="checkbox"], [type="radio"], [type="range"]), select, textarea).is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field.is-current:not(.field-list, .field-table) > :is(.field-label, .checkbox-label) { color: var(--accent-text); }

.list-items { display: grid; gap: 8px; margin-bottom: 0.6rem; }
.list-item { border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.8rem; background: var(--item-bg, var(--bg-soft)); }
.list-item > .field { margin-top: 0.7rem; }
.field-inactive { opacity: 0.45; }

.table-editor { border-collapse: collapse; }
.table-editor th, .table-editor td { border: 1px solid var(--line); padding: 4px; vertical-align: top; min-width: 150px; }
.table-editor th { background: var(--bg-soft); }
.table-editor .table-add, .table-editor td.cell-actions { min-width: 0; border: 0; background: transparent; white-space: nowrap; }
.table-editor .cell-actions { display: flex; gap: 3px; justify-content: flex-end; margin-top: 4px; }
.table-editor td.cell-actions { display: table-cell; }
.table-editor input { width: 100%; font: inherit; font-size: 0.9rem; padding: 0.3rem 0.45rem; border: 1px solid var(--input-border); border-radius: 5px; background: var(--surface); color: var(--ink); }

@media (max-width: 760px) {
  .feature-row.has-side, .case { grid-template-columns: 1fr; }
  .download { flex-direction: column; align-items: flex-start; }
  .site-header { flex-wrap: wrap; gap: 0.6rem; }
}

/* Save flow, accounts and history */
.button-save { background: var(--success); border-color: var(--success); color: #fff; }
.button-save:hover { background: #146c2e; border-color: #146c2e; }
.button-save:disabled { background: var(--success); }
.site-header .button:disabled { opacity: 0.45; }
.save-status.dirty { color: #ffd479; }
.user-badge { font-size: 0.8rem; color: #b8c2cc; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 0.1rem 0.6rem; }
.is-saving #site-editor, .is-saving #project-editor, .is-saving #project-grid { pointer-events: none; opacity: 0.6; }
.field input.invalid, .field textarea.invalid { border-color: var(--danger); }
.page-hero-small { padding: 2rem 0 1.5rem; }
.page-hero-small h1 { font-size: 1.9rem; }
.restore-status { display: inline-block; padding: 0.4rem 0.8rem; border-radius: 6px; background: var(--accent-soft); }
.restore-status.error { background: var(--danger-soft); color: var(--danger); }
.restore-status.saved { background: var(--success-soft); color: var(--success); }
.history-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; padding-block: 2rem 4rem; }
/* Every history as one nested list: main page, project pages, the shown project's sections */
.history-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history-nav ul ul { margin: 2px 0 6px 0.8rem; padding-left: 0.6rem; border-left: 1px solid var(--line); }
.history-nav a { display: block; text-decoration: none; padding: 0.35rem 0.6rem; border-radius: 6px; font-size: 0.92rem; }
.history-nav a:hover { background: var(--bg-soft); }
.history-nav a.is-current { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.history-main { min-width: 0; }
.history-table td { vertical-align: top; }
.history-table td:first-child { font-weight: 400; }
.history-table tr.selected td { background: var(--accent-soft); }
.history-actions { display: flex; gap: 6px; }
.nowrap { white-space: nowrap; }
.history-version { margin-top: 0; margin-bottom: 1.5rem; }
.history-version-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.json-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.json-compare .code { border-radius: 8px; max-height: 520px; font-size: 0.8rem; }
.json-compare h3 { font-size: 0.9rem; margin: 0.8rem 0 0.4rem; }
@media (max-width: 760px) {
  .history-layout, .json-compare { grid-template-columns: 1fr; }
}

/* Editor save bar: always visible at the bottom of the window */
/* History over the page (editor.js): a see-through, blurred cover tinted by the theme */
.history-modal {
  --modal-cover: rgba(22, 32, 42, 0.35);
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 4vh 4vw;
  background: var(--modal-cover); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: modal-in 0.15s ease;
}
[data-theme="dark"] .history-modal { --modal-cover: rgba(0, 0, 0, 0.55); }
[data-theme="dark-blue"] .history-modal { --modal-cover: rgba(2, 6, 16, 0.6); }
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.history-modal-box {
  position: relative; width: min(1200px, 100%); height: 100%; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.history-modal-box iframe { display: block; width: 100%; height: 100%; border: 0; }
.history-modal-close { position: absolute; top: 12px; right: 14px; z-index: 1; }
body.has-modal { overflow: hidden; }
/* The history page inside it: no site header */
body.in-modal > .site-header { display: none; }

.editor-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 0.7rem 24px calc(0.7rem + env(safe-area-inset-bottom, 0px));
  background: var(--bar);
  color: #fff;
  box-shadow: 0 -4px 16px rgba(22, 32, 42, 0.18);
}
.editor-bar .save-status { margin-right: auto; font-size: 0.9rem; }
.editor-bar .button-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.editor-bar .button-ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.editor-bar .button:disabled { opacity: 0.45; }
body.is-editing { padding-bottom: 72px; }
[data-theme^="dark"] .code { border: 1px solid var(--line); }

/* Publish page (the viewer-only package) */
.publish-layout { padding: 24px 0 64px; display: grid; gap: 18px; }
.publish-actions { display: flex; align-items: center; gap: 14px; margin: 0; }
.publish-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; }
.publish-card h2 { margin-top: 0; }
.publish-card ul { margin: 0 0 18px; padding-left: 20px; }
.publish-card li { margin-bottom: 4px; }
.publish-log { max-height: 320px; overflow: auto; margin: 0; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-2, rgba(0, 0, 0, 0.04)); font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; }
.save-status.is-error { color: #b42318; }
