/*
 * DriftwoodXI site styles — the launcher's driftwood/ocean tokens
 * (DriftwoodXI-Launcher src/renderer/src/theme/tokens.css) carried to the web,
 * so the site and the launcher read as one product.
 *
 * The type is the launcher's too, and self-hosted rather than pulled from
 * Google Fonts: the CSP in security.ts is `default-src 'self'` with no font-src
 * of its own, so a third-party font URL is simply blocked — and even if it were
 * allowed, a CDN round-trip on every page load to render a wordmark is a poor
 * trade. These are byte-identical to the launcher's own @fontsource files, so
 * the two products render the name from the same outlines.
 */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/cinzel-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/cinzel-latin-700-normal.woff2') format('woff2');
}

/* Variable weight axis, same file the launcher ships. */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  --dx-bg-deep: #050b13;
  --dx-bg: #081220;
  --dx-surface: rgba(13, 26, 43, 0.72);
  --dx-surface-raised: rgba(18, 34, 54, 0.85);
  --dx-line: rgba(151, 178, 201, 0.14);
  --dx-line-strong: rgba(151, 178, 201, 0.28);
  --dx-accent: #45c6b8;
  --dx-accent-strong: #6fe3d5;
  --dx-accent-deep: #2b9d92;
  --dx-accent-glow: rgba(69, 198, 184, 0.35);
  --dx-accent-soft: rgba(69, 198, 184, 0.14);
  --dx-accent-ink: #04211d;
  --dx-wood: #c9a87c;
  --dx-text: #dce8f2;
  --dx-text-dim: #8fa5b8;
  --dx-text-faint: #5b7186;
  --dx-ok: #4ade80;
  --dx-ok-soft: rgba(74, 222, 128, 0.14);
  --dx-err: #f87171;
  --dx-err-soft: rgba(248, 113, 113, 0.14);
  --dx-info: #7dd3fc;
  --dx-info-soft: rgba(125, 211, 252, 0.14);
  --dx-radius: 10px;
  --dx-radius-lg: 16px;
  /* Identical to the launcher's tokens.css. The fallbacks matter: with
     font-display: swap the first paint uses them, so a serif-for-serif and
     sans-for-sans fallback keeps the layout from lurching when the real faces
     land. */
  --dx-font-display: 'Cinzel', Georgia, serif;
  --dx-font-body: 'Inter Variable', 'Segoe UI', system-ui, sans-serif;
  --dx-font-mono: 'Cascadia Mono', 'Consolas', ui-monospace, monospace;
  --dx-wood-dim: #8a7357;
  --dx-accent-glow: rgba(69, 198, 184, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--dx-text);
  font-family: var(--dx-font-body);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(760px 420px at 22% 8%, rgba(69, 198, 184, 0.1), transparent 64%),
    radial-gradient(680px 380px at 78% 90%, rgba(201, 168, 124, 0.07), transparent 62%),
    linear-gradient(180deg, var(--dx-bg) 0%, var(--dx-bg-deep) 100%);
  background-attachment: fixed;
}

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 28px;
}

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

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* The wordmark, transcribed from the launcher's global.css .wordmark rules so
   the header reads identically in both places: wood-coloured DRIFTWOOD, the XI
   in sea-glass with its glow, wide tracking, the painted wave mark beside it.
   Larger here than the launcher's 13px title bar — a web header has the room,
   and this is the page's primary identity rather than window chrome. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  text-decoration: none;
  font-family: var(--dx-font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.brand .wm-type {
  display: inline-flex;
  align-items: baseline;
}

.brand .wm-drift { color: var(--dx-wood); }

.brand .wm-xi {
  color: var(--dx-accent-strong);
  margin-left: 0.35em;
  text-shadow: 0 0 14px var(--dx-accent-glow);
}

/* Height drives it and width follows the artwork — the wave is ~1.46:1, so a
   square box would letterbox it. No accent glow: the art is already teal, and a
   teal halo just re-traces the crop rectangle and makes it look pasted on. The
   asset's own feathered edges do the separating. */
.mark {
  flex: none;
  width: auto;
  height: 30px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* The painted lockup, as the home page's masthead. */
.hero-logo {
  display: block;
  width: 340px;
  max-width: 100%;
  height: auto;
  margin: 8px auto 4px;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.55));
}

/* The lockup is the visible title, so the real <h1> is for the outline and
   screen readers only. Not display:none — that would take it out of the
   accessibility tree along with everything else. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Centred under the masthead, and held to a comfortable measure — full-width
   text under a centred logo reads as two unrelated things. */
.lede {
  max-width: 62ch;
  margin-inline: auto;
  text-align: center;
}

nav { display: flex; gap: 4px; flex-wrap: wrap; }

nav a {
  color: var(--dx-text-dim);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--dx-radius);
  font-size: 14.5px;
}

nav a:hover { color: var(--dx-text); background: var(--dx-surface); }

nav a.active { color: var(--dx-accent-strong); background: var(--dx-accent-soft); }

/* --- main -------------------------------------------------------------- */

main { flex: 1; }

h1 {
  font-family: var(--dx-font-display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: 0.03em;
  margin: 6px 0 14px;
}

h2 {
  font-family: var(--dx-font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.03em;
  margin: 26px 0 10px;
}

p { margin: 10px 0; }

a { color: var(--dx-accent-strong); }

.muted { color: var(--dx-text-dim); }

.card {
  background: var(--dx-surface);
  border: 1px solid var(--dx-line);
  border-radius: var(--dx-radius-lg);
  padding: 22px 24px;
  margin: 16px 0;
  backdrop-filter: blur(9px);
}

.card + .card { margin-top: 14px; }

/* --- forms ------------------------------------------------------------- */

form.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field-label { font-size: 13.5px; color: var(--dx-text-dim); letter-spacing: 0.02em; }

.field-hint { font-size: 12.5px; color: var(--dx-text-faint); }

input {
  background: rgba(4, 10, 18, 0.55);
  border: 1px solid var(--dx-line-strong);
  border-radius: var(--dx-radius);
  color: var(--dx-text);
  font: inherit;
  padding: 10px 12px;
}

input:focus {
  outline: none;
  border-color: var(--dx-accent);
  box-shadow: 0 0 0 3px var(--dx-accent-soft);
}

button, .btn {
  display: inline-block;
  background: linear-gradient(180deg, var(--dx-accent-strong), var(--dx-accent-deep));
  color: var(--dx-accent-ink);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--dx-radius);
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 24px -6px var(--dx-accent-glow);
}

button:hover, .btn:hover { filter: brightness(1.07); }

.btn-quiet {
  background: var(--dx-surface-raised);
  color: var(--dx-text);
  box-shadow: none;
  border: 1px solid var(--dx-line-strong);
}

/* --- notices ----------------------------------------------------------- */

.notice {
  border-radius: var(--dx-radius);
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 14.5px;
  border: 1px solid;
}

.notice-ok { background: var(--dx-ok-soft); border-color: var(--dx-ok); color: var(--dx-ok); }

.notice-err { background: var(--dx-err-soft); border-color: var(--dx-err); color: var(--dx-err); }

.notice-info { background: var(--dx-info-soft); border-color: var(--dx-info); color: var(--dx-info); }

.dev-note { color: var(--dx-text-faint); font-size: 13px; font-style: italic; }

/* --- download page ----------------------------------------------------- */

.dl-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--dx-text-dim);
  font-size: 14px;
  margin: 12px 0;
}

.hash {
  font-family: var(--dx-font-mono);
  font-size: 12.5px;
  color: var(--dx-text-dim);
  background: rgba(4, 10, 18, 0.55);
  border: 1px solid var(--dx-line);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-all;
  user-select: all;
}

ol.steps { padding-left: 22px; }

ol.steps li { margin: 8px 0; }

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

footer {
  border-top: 1px solid var(--dx-line);
  padding-top: 16px;
  color: var(--dx-text-faint);
  font-size: 12.5px;
}

/* --- news ---------------------------------------------------------------- */

/* Lede under a left-aligned <h1>, so it must not centre like the home one. */
.lede-left { max-width: 68ch; }

.post-list {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

/* The whole card is the link — a "read more" would be a smaller target saying
   the same thing. */
.post-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--dx-line);
  border-radius: var(--dx-radius-lg);
  background: var(--dx-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms, background 160ms, transform 160ms;
}

.post-card:hover {
  border-color: var(--dx-accent-deep);
  background: var(--dx-surface-raised);
  transform: translateY(-1px);
}

.post-card h2 {
  margin: 6px 0 6px;
  font-size: 20px;
}

.post-card p { margin: 0; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--dx-text-faint);
}

.tag {
  font-family: var(--dx-font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dx-accent-strong);
  background: var(--dx-accent-soft);
  border-radius: 999px;
  padding: 3px 9px;
}

.post { max-width: 70ch; }

.post h1 { margin: 10px 0 8px; }

/* The excerpt is the post's own summary, so it leads the body rather than
   repeating inside it. */
.post-excerpt {
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--dx-text-dim);
  border-left: 2px solid var(--dx-accent-deep);
  padding-left: 14px;
  margin: 0 0 24px;
}

/* Rendered markdown. Matches the launcher's news panel rhythm. */
.md > :first-child { margin-top: 0; }
.md h2 { font-size: 21px; margin: 30px 0 10px; }
.md h3 { font-size: 17px; margin: 24px 0 8px; }
.md p, .md ul { margin: 0 0 14px; }
.md li { margin-bottom: 6px; }
.md code {
  font-family: var(--dx-font-mono);
  font-size: 0.9em;
  background: var(--dx-surface-raised);
  border: 1px solid var(--dx-line);
  border-radius: var(--dx-radius-sm);
  padding: 1px 5px;
}

/* Wide tables scroll in their own box; the page never scrolls sideways. */
.md-table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
}

.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

.md-table th, .md-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--dx-line);
}

.md-table th {
  font-family: var(--dx-font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dx-text-dim);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--dx-line);
  font-size: 14.5px;
}

.post-nav a { color: var(--dx-text-dim); text-decoration: none; }
.post-nav a:hover { color: var(--dx-accent-strong); }

/* Checklist bullets for the home page's feature lists. */
ul.tick {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

ul.tick li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 10px;
}

ul.tick li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.55em;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--dx-accent);
  box-shadow: 0 0 10px var(--dx-accent-glow);
}

/* --- the news rail ------------------------------------------------------- */
/* The launcher's "More from the log" carousel (its pages.css .news-rail
   rules), moved to the top of the news page. One card at a time, arrows
   either side, a count on the right. */

.news-rail {
  display: grid;
  gap: 9px;
  padding: 14px 18px 18px;
  border: 1px solid var(--dx-line);
  border-radius: var(--dx-radius-lg);
  background: var(--dx-surface);
  backdrop-filter: blur(9px);
  margin-bottom: 26px;
}

.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.rail-label {
  font-family: var(--dx-font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dx-text-faint);
  margin: 0;
}

.rail-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--dx-text-faint);
}

.rail-count-sep { opacity: 0.55; }

.rail-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.rail-slot { display: grid; min-width: 0; }

.rail-arrow {
  align-self: center;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--dx-line);
  color: var(--dx-text-dim);
  background: var(--dx-surface-sunken, rgba(4, 10, 18, 0.55));
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}

.rail-arrow:hover {
  color: var(--dx-accent-strong);
  border-color: var(--dx-accent-deep);
  background: var(--dx-accent-soft);
}

/* Before news-rail.js runs, every card is visible and the rail reads as a
   plain list — the no-JS fallback. Once it takes over, the rail stacks its
   cards and shows the current one. */
.news-rail:not(.is-live) .rail-slot { gap: 10px; }

.news-rail.is-live .rail-slot > .post-card { display: none; }
.news-rail.is-live .rail-slot > .post-card.is-current { display: block; }

/* The rail's card is the same component as the list's, with a little more room
   to breathe since it is alone. */
.rail-slot .post-card { min-height: 118px; }

@media (max-width: 520px) {
  .rail-body { gap: 8px; }
  .news-rail { padding: 12px 12px 14px; }
}

/* On a touch screen the arrows are the only way to step the rail, so they get a
   44px target — the size a fingertip actually needs. Keyed on pointer type
   rather than viewport width: a narrow window on a desktop still has a mouse,
   and a large tablet still has fingers. Only the hit area grows; the glyph
   inside stays put. */
@media (pointer: coarse) {
  .rail-arrow {
    width: 44px;
    height: 44px;
  }
}
