/* Somnium landing page.
 *
 * Palette is lifted from the auth module's client (client/styles.css), which in
 * turn mirrors the chat module's indigo design system — the landing page is the
 * first screen of the same product, so it should not look like a different one.
 * Dark only, matching the apps.
 *
 * No build step, no dependencies: Caddy file_servers this directory as-is.
 */

:root {
  --bg: #11131a;
  --panel: #1a1d28;
  --elevated: #232735;
  --border: #2e3344;
  --text: #e6e8ef;
  --text-dim: #9aa0b4;
  --accent: #6d5dfc;
  --accent-hover: #5847f0;

  --radius: 14px;
  --shell: 1080px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* A single soft indigo bloom behind the hero. Fixed so it doesn't repeat as
     the page scrolls past it. */
  background-image: radial-gradient(
    60rem 32rem at 50% -10rem,
    color-mix(in srgb, var(--accent) 18%, transparent),
    transparent 70%
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--elevated);
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}

.site-header > .shell {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 68px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
}

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

/* The auth slot is the only part of the page that depends on JS. Both states
   stay hidden until app.js resolves the session, so neither flashes. */
.auth-slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 36px;
}

[data-auth="pending"] .signed-in,
[data-auth="pending"] .signed-out,
[data-auth="in"] .signed-out,
[data-auth="out"] .signed-in {
  display: none;
}

[data-auth="in"] .signed-in,
[data-auth="out"] .signed-out {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.identity {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: right;
  max-width: 15rem;
}

.identity .email {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity .tier {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--panel);
}

.btn-large {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
}

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

.hero {
  padding: clamp(4rem, 12vw, 8rem) 0 clamp(3rem, 8vw, 5rem);
  text-align: center;
}

.hero .eyebrow {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  max-width: 18ch;
  margin-inline: auto;
}

.hero .lede {
  margin: 1.5rem auto 0;
  max-width: 60ch;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin-top: 2.25rem;
}

/* The three-step pipeline strip under the hero. */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 3rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.pipeline .step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pipeline .step b {
  color: var(--text);
  font-weight: 550;
}

.pipeline .arrow {
  color: var(--border);
}

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

.section {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

.section-head {
  max-width: 52ch;
  margin-bottom: 3rem;
}

.section-head h2 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
}

.section-head p {
  margin-top: 0.85rem;
  color: var(--text-dim);
}

/* ---------------- module feature rows ---------------- */

.module {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 5vw, 3rem) 0;
  border-top: 1px solid var(--border);
}

.module:first-of-type {
  border-top: none;
  padding-top: 0;
}

.module h3 {
  font-size: 1.5rem;
  margin-bottom: 0.85rem;
}

.module .summary {
  color: var(--text-dim);
}

.module ul {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.7rem;
}

.module li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.module li svg {
  width: 16px;
  height: 16px;
  margin-top: 0.3rem;
  color: var(--accent);
  flex: none;
}

.module .btn {
  margin-top: 1.75rem;
}

/* The illustration side: a framed panel with the module's glyph. */
.module-art {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(
      22rem 14rem at 50% 30%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 75%
    ),
    var(--panel);
}

.module-art svg {
  width: 42%;
  max-width: 160px;
  height: auto;
  color: var(--accent);
  opacity: 0.9;
}

/* ---------------- module launcher grid ---------------- */

.cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--elevated);
}

.card .icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.card .icon svg {
  width: 22px;
  height: 22px;
}

.card .name {
  font-weight: 600;
  font-size: 1.1rem;
}

.card .desc {
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* Shown only while signed out: the module gate will bounce you to /auth first. */
.gate-note {
  margin-top: 1.5rem;
  color: var(--text-dim);
  font-size: 0.88rem;
}

[data-auth="in"] .gate-note,
[data-auth="pending"] .gate-note {
  display: none;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.site-footer > .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  color: var(--text-dim);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------------- responsive ---------------- */

@media (max-width: 820px) {
  .module {
    grid-template-columns: 1fr;
  }

  /* Art above the copy on every row, regardless of source order. */
  .module-art {
    order: -1;
    aspect-ratio: 16 / 9;
  }

  .site-nav {
    display: none;
  }

  .auth-slot {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
