/*
 * Cereus Media Engine -- public website styles.
 *
 * One stylesheet, no build step, no web fonts, no JavaScript. Palette is
 * carried over from the customer app (web/src/styles/tokens.css): near-black
 * "night" surfaces with a warm sand accent -- a nod to the night-blooming
 * cereus that Cereus Enterprises is named after. A warm "paper" light theme
 * is served to visitors whose system prefers light mode.
 */

:root {
  --bg: #0b0b0d;
  --bg-raised: #131316;
  --surface: #18181c;
  --border: #2a2a2f;
  --border-subtle: #202024;
  --text: #f2f1ed;
  --text-muted: #b8b6ae;
  --text-faint: #8c8a83;
  --accent: #d8c9a3;
  --accent-strong: #ecdfbd;
  --on-accent: #14130f;
  --glow: rgba(216, 201, 163, 0.16);
  --planned: #93b4d9;
  --review-bg: #3a2f12;
  --review-border: #d9b26a;
  --review-text: #f5e2b8;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --content-width: 1120px;
  --prose-width: 70ch;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f4ec;
    --bg-raised: #efe9dc;
    --surface: #fffdf8;
    --border: #d9d0bd;
    --border-subtle: #e6dfcf;
    --text: #18171a;
    --text-muted: #4a4740;
    --text-faint: #6b675e;
    --accent: #6f5a28;
    --accent-strong: #574620;
    --on-accent: #fffdf8;
    --glow: rgba(111, 90, 40, 0.12);
    --planned: #2f5a8a;
    --review-bg: #fff1cc;
    --review-border: #a87a1c;
    --review-text: #4a3505;
    color-scheme: light;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
}

h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.25rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 720px) {
  .container {
    padding: 0 32px;
  }
}

/* ---------------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: none;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand-name small {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-raised);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  padding: 56px 0 64px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 70vw;
  max-width: 760px;
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  pointer-events: none;
}

.hero .container {
  position: relative;
  display: grid;
  gap: 40px;
  align-items: center;
}

@media (min-width: 900px) {
  .hero {
    padding: 88px 0 96px;
  }

  .hero .container {
    grid-template-columns: 1.25fr 1fr;
  }
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede {
  max-width: 40rem;
  color: var(--text-muted);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
}

.status-note {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 8px 0 28px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.status-note strong {
  color: var(--text);
}

.hero-bloom {
  justify-self: center;
  width: min(100%, 220px);
  color: var(--accent);
}

@media (min-width: 900px) {
  .hero-bloom {
    width: min(100%, 420px);
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button-secondary {
  color: var(--text);
  border-color: var(--border);
}

.button-secondary:hover {
  border-color: var(--accent);
}

/* -------------------------------------------------------------- sections */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--border-subtle);
}

@media (min-width: 900px) {
  .section {
    padding: 88px 0;
  }
}

.section-intro {
  max-width: 44rem;
  margin-bottom: 40px;
  color: var(--text-muted);
}

.section-intro h2 {
  color: var(--text);
}

.grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 720px) and (max-width: 979px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 980px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card p {
  color: var(--text-muted);
}

.card-label {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-label.is-planned {
  color: var(--planned);
}

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding: 10px 0 10px 28px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.checklist li:first-child {
  border-top: 0;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.05em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.checklist.is-planned li::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--planned);
}

.steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 22px 22px 22px 76px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.steps h3 {
  margin-bottom: 4px;
}

.steps p {
  margin: 0;
  color: var(--text-muted);
}

.section-subtitle {
  margin: 56px 0 16px;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
}

.scope-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.scope-table caption {
  text-align: left;
  padding-bottom: 12px;
  color: var(--text-muted);
}

.scope-table th,
.scope-table td {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.scope-table thead th {
  border-top: 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scope-table code {
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .scope-table tbody th code {
    white-space: nowrap;
    overflow-wrap: normal;
  }
}

.table-wrap + .meta {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 8px 16px;
}

@media (max-width: 719px) {
  .scope-table thead {
    display: none;
  }

  .scope-table tr,
  .scope-table th,
  .scope-table td {
    display: block;
  }

  .scope-table tr {
    padding: 8px 0;
    border-top: 1px solid var(--border);
  }

  .scope-table tbody tr:first-child {
    border-top: 0;
  }

  .scope-table th,
  .scope-table td {
    border-top: 0;
    padding: 6px 0;
  }

  .scope-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg-raised);
}

.cta-band {
  padding: 48px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 85% 20%, var(--glow), transparent 55%), var(--surface);
  text-align: center;
}

.cta-band p {
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-muted);
}

.cta-band .actions {
  justify-content: center;
}

/* ----------------------------------------------------------------- prose */

.page-header {
  padding: 56px 0 32px;
}

.page-header p {
  color: var(--text-muted);
  max-width: var(--prose-width);
}

.prose {
  max-width: var(--prose-width);
  padding-bottom: 72px;
}

.prose h2 {
  margin-top: 2.2em;
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  scroll-margin-top: 16px;
}

.prose h3 {
  margin-top: 1.6em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose dl {
  margin: 0 0 1em;
}

.prose dt {
  font-weight: 600;
  margin-top: 0.8em;
}

.prose dd {
  margin: 0.2em 0 0;
  color: var(--text-muted);
}

.toc {
  margin: 0 0 40px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.toc ol {
  margin: 0;
  padding-left: 1.3em;
  columns: 2 16rem;
  column-gap: 32px;
}

.toc li {
  margin-bottom: 0.3em;
  break-inside: avoid;
}

.meta {
  color: var(--text-faint);
  font-size: 0.95rem;
}

/* --------------------------------------------- review placeholders/notes */

/* Anything wrapped in .review is DRAFT text that needs owner/counsel
 * approval. It is deliberately loud so it can never be published by
 * accident; `python site/scripts/validate.py --release` fails while any
 * remain. */
.review {
  padding: 0.05em 0.4em;
  border: 1px dashed var(--review-border);
  border-radius: 4px;
  background: var(--review-bg);
  color: var(--review-text);
  font-size: 0.92em;
}

.review-banner {
  margin: 0 0 32px;
  padding: 16px 20px;
  border: 1px dashed var(--review-border);
  border-radius: var(--radius-md);
  background: var(--review-bg);
  color: var(--review-text);
}

.review-banner p:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0 48px;
  color: var(--text-faint);
  font-size: 0.92rem;
}

.site-footer .container {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .site-footer .container {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}

.site-footer p {
  margin: 0 0 6px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .site-nav a {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
