/* SPDX-License-Identifier: MIT */
/* Logion landing — dark editorial default with light fallback. */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --bg: #050608;
  --bg-soft: #0a0d12;
  --fg: #e9eef5;
  --fg-dim: #7d8794;
  --muted: #4a525e;
  --rule: #1b2129;
  --rule-strong: #2b333d;
  --accent: #c9a76a; /* aged-bronze */
  --accent-bright: #f5d68a;
  --bolt: #aed7ff;
  --panel: rgba(12, 16, 22, 0.72);
  --panel-edge: rgba(201, 167, 106, 0.32);
  --focus: #aed7ff;
  --serif: "Libre Baskerville", "Times New Roman", Times, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  --max-width: 1080px;
  --hud-glow: 0 0 18px rgba(201, 167, 106, 0.12);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f2e9;
    --bg-soft: #ece8db;
    --fg: #15171a;
    --fg-dim: #4d5460;
    --muted: #7d8794;
    --rule: #d8d2c1;
    --rule-strong: #b7ad94;
    --accent: #8a6a2b;
    --accent-bright: #5a4517;
    --bolt: #1f4a80;
    --panel: rgba(255, 252, 244, 0.85);
    --panel-edge: rgba(138, 106, 43, 0.32);
    --focus: #1f4a80;
    --hud-glow: 0 0 14px rgba(138, 106, 43, 0.08);
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 3px;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 160ms ease, border-color 160ms ease;
}

a:hover {
  color: var(--accent-bright);
  border-color: var(--accent);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--bg);
}

/* --- HUD scaffolding ---------------------------------------------------- */

.hud {
  position: relative;
  z-index: 1;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

#silhouette {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: max-content;
  height: max-content;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  white-space: pre;
  font-family: var(--mono);
  font-size: 10px; /* JS overrides with computed fit-to-viewport size */
  line-height: 1;
  letter-spacing: 0;
  color: rgba(201, 167, 106, 0.78);
  text-shadow: 0 0 10px rgba(201, 167, 106, 0.22);
  background: transparent;
  border: 0;
  -webkit-user-select: none;
  user-select: none;
}

#silhouette::before {
  content: none;
}

@media (prefers-color-scheme: light) {
  #silhouette {
    color: rgba(90, 69, 23, 0.78);
    text-shadow: none;
  }
}

.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 32px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
}

.site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
}

.site-brand .greek {
  font-size: 22px;
  color: var(--accent-bright);
  letter-spacing: 0.34em;
  text-shadow: var(--hud-glow);
}

.site-brand .latin {
  font-size: 11px;
  color: var(--fg-dim);
}

.site-nav {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.site-nav a {
  border-bottom: 0;
  color: var(--fg-dim);
}

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

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 32px 96px;
  position: relative;
  z-index: 2;
}

.hud-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.hud-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: 50%;
}

/* --- Visually hidden ---------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- CTA ---------------------------------------------------------------- */

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 28px;
}

.copy-cta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(100%, 900px);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border: 1px solid var(--accent);
  background: linear-gradient(
    180deg,
    rgba(201, 167, 106, 0.14),
    rgba(201, 167, 106, 0.04)
  );
  color: var(--accent-bright);
  text-decoration: none;
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  position: relative;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease,
    background 160ms ease;
  box-shadow: var(--hud-glow);
}

button.cta {
  font-family: inherit;
}

.cta--primary {
  width: 100%;
  max-width: 100%;
  min-height: 58px;
}

.cta::before,
.cta::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent-bright);
}

.cta::before {
  top: -3px;
  left: -3px;
  border-right: 0;
  border-bottom: 0;
}

.cta::after {
  bottom: -3px;
  right: -3px;
  border-left: 0;
  border-top: 0;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(
    180deg,
    rgba(201, 167, 106, 0.24),
    rgba(201, 167, 106, 0.08)
  );
  box-shadow: 0 0 24px rgba(201, 167, 106, 0.28);
  color: var(--accent-bright);
}

.cta-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-bright);
  fill: none;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cta-cmd {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--fg);
  padding: 10px 16px;
  border-left: 1px solid var(--panel-edge);
  margin-left: 6px;
  background: rgba(0, 0, 0, 0.25);
  max-width: 620px;
  overflow-wrap: anywhere;
  white-space: nowrap;
  text-align: left;
}

.cta--ghost {
  align-self: flex-start;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--fg-dim);
  box-shadow: none;
}

.cta--ghost::before,
.cta--ghost::after {
  border-color: var(--rule-strong);
}

.cta--ghost:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: rgba(201, 167, 106, 0.06);
  box-shadow: var(--hud-glow);
}

.copy-status {
  min-height: 16px;
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .cta-row {
    flex-direction: column;
  }

  .copy-cta,
  .cta {
    width: 100%;
  }

  .cta {
    justify-content: flex-start;
  }

  .cta-cmd {
    max-width: none;
    white-space: normal;
  }
}

@media (max-width: 540px) {
  .cta--primary {
    align-items: flex-start;
    flex-direction: column;
  }

  .cta-cmd {
    width: 100%;
    margin-left: 0;
    border-left: 0;
    border-top: 1px solid var(--panel-edge);
  }
}

/* --- Hero --------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 82vh;
  padding-bottom: 72px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
}

.hero-copy {
  max-width: 620px;
  position: relative;
  z-index: 2;
}

.hero-copy h1 {
  margin: 22px 0 16px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(72px, 13vw, 168px);
  line-height: 0.84;
  letter-spacing: 0.03em;
  color: var(--accent-bright);
  text-shadow:
    0 0 22px rgba(201, 167, 106, 0.28),
    0 2px 0 rgba(0, 0, 0, 0.45);
}

.hero-copy h1 .accent {
  color: var(--fg);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.hero-sub {
  font-size: clamp(18px, 1.9vw, 22px);
  color: var(--fg);
  margin: 24px 0 28px;
  max-width: 38ch;
  font-weight: 500;
}

.hero-body {
  color: var(--fg);
  margin: 0 0 32px;
  max-width: 52ch;
  font-size: 16px;
  line-height: 1.7;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  max-width: 420px;
}

.hero-meta dt {
  color: var(--accent-bright);
}

.hero-meta dd {
  margin: 0;
  color: var(--fg);
  letter-spacing: 0.1em;
  font-weight: 500;
}

.hero-readout {
  position: fixed;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: var(--hud-glow);
  z-index: 3;
}

.hero-readout.br {
  bottom: 22px;
  right: 32px;
  color: var(--fg-dim);
}

/* --- Content sections / HUD panels -------------------------------------- */

.content-section {
  position: relative;
  padding: 56px 0;
  border-bottom: 1px solid var(--rule);
}

.content-section h2 {
  margin: 12px 0 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--fg);
}

.content-section > p {
  max-width: 60ch;
  color: var(--fg);
  font-size: 16px;
}

.content-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.content-list li {
  position: relative;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  backdrop-filter: blur(6px);
}

.content-list li::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 14px;
  height: 14px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}

.content-list li::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

.content-list strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-bright);
  font-size: 11px;
}

.content-list span {
  color: var(--fg);
  font-size: 14px;
  line-height: 1.65;
}

pre,
code {
  font-family: var(--mono);
}

pre {
  background: var(--bg-soft);
  border: 1px solid var(--rule-strong);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg);
  overflow-x: auto;
  max-width: 100%;
  position: relative;
}

pre::before {
  content: "$";
  position: absolute;
  left: 6px;
  top: 14px;
  color: var(--accent);
  opacity: 0.5;
}

pre code {
  padding-left: 14px;
  display: block;
}

.release-note {
  margin: 8px 0 0;
  max-width: 68ch;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.6;
}

.hero-ascii {
  align-self: stretch;
  min-height: 420px;
  margin: 0;
  display: flex;
  align-items: center;
  white-space: pre;
  color: var(--accent-bright);
  background: linear-gradient(180deg, rgb(0 255 210 / 8%), rgb(0 0 0 / 28%));
  text-shadow: 0 0 12px rgb(0 255 210 / 40%);
}

.hero-ascii::before {
  content: none;
}

.cli-install {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.install-option {
  display: grid;
  gap: 8px;
}

.install-option span {
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.install-option--primary {
  grid-column: 1 / -1;
}

.install-option--primary pre {
  border-color: var(--accent);
  box-shadow: 0 0 28px rgb(0 255 210 / 12%);
}

@media (min-width: 640px) {
  .cli-install {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Legal pages -------------------------------------------------------- */

.legal {
  max-width: 720px;
  color: var(--fg);
}

.legal h1 {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

/* --- Footer ------------------------------------------------------------- */

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 32px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.site-footer nav {
  display: flex;
  gap: 22px;
}

.site-footer a {
  border-bottom: 0;
  color: var(--fg-dim);
}

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

/* --- View transitions (cross-document) ---------------------------------- */
/* https://developer.chrome.com/docs/web-platform/view-transitions
 * TEMPORARILY DISABLED while investigating a Safari tab-switch repaint bug
 * where the page goes blank for several seconds before recovering. */

/* @view-transition {
  navigation: auto;
} */

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

::view-transition-old(root) {
  animation-name: logion-fade-out;
}

::view-transition-new(root) {
  animation-name: logion-fade-in;
}

@keyframes logion-fade-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes logion-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* --- Reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}
