/* Shadowspore Website — "Nachtlichtung" Visual Theme */

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/alegreya-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/alegreya-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/alegreya-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/alegreya-sans-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/alegreya-sans-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --night: #0a0712;
  --bark: #1a1226;
  --bark-2: #221836;
  --well: #0c0817;
  --edge-lit: #6d55b4;
  --edge-mid: #3b2a6e;
  --edge-dark: #120a22;
  --violet: #8b5cff;
  --lilac: #c9b4ff;
  --teal: #4fe3c1;
  --teal-face: #2fae92;
  --teal-deep: #156152;
  --gold: #f2c36b;
  --gold-deep: #9a6526;
  --red: #ff7d8c;
  --text: #ece4ff;
  --muted: #b5a7d4;
  --faint: #7d70a0;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "Alegreya", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-color: var(--edge-lit) var(--night);
}

@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--night);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--edge-mid);
    border: 2px solid var(--night);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--edge-lit);
  }
}

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

html {
  background-color: var(--night);
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(960px 440px at 28% 0%, rgba(139, 92, 255, 0.18), transparent 65%),
    radial-gradient(640px 380px at 84% 12%, rgba(79, 227, 193, 0.1), transparent 60%),
    var(--night);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--teal);
  color: var(--night);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--text);
}

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

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

a {
  color: var(--teal);
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
  background: var(--well);
  border: 1px solid var(--edge-mid);
  padding: 1px 6px;
  color: var(--gold);
}

.px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --- Header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 7, 18, 0.94);
  border-bottom: 2px solid var(--edge-mid);
}

.header-inner {
  width: min(1140px, 100% - 32px);
  margin: 0 auto;
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 8px 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.06em;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border: 2px solid var(--edge-lit);
  background: var(--well);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 4px 2px;
}

.top-nav a:hover {
  color: var(--gold);
}

.top-nav .nav-cta {
  padding: 6px 14px;
  background: var(--teal-deep);
  border: 2px solid var(--teal);
  color: #ecfff9;
  font-weight: 700;
}

.top-nav .nav-cta:hover {
  background: var(--teal-face);
  color: var(--night);
}

/* --- Main Layout & Stepped Plates --- */

main {
  flex: 1;
  width: min(1140px, 100% - 32px);
  margin: 0 auto;
  padding: 28px 0 64px;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

section[id] {
  scroll-margin-top: 76px;
}

.plate {
  background: linear-gradient(180deg, var(--bark-2) 0%, var(--bark) 100%);
  border: 2px solid var(--edge-mid);
  box-shadow:
    inset 2px 2px 0 rgba(109, 85, 180, 0.35),
    inset -2px -2px 0 var(--edge-dark),
    0 12px 28px rgba(4, 2, 10, 0.55);
}

/* --- Hero --- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 28px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--edge-lit);
  background: var(--well);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge--gold {
  border-color: var(--gold-deep);
  color: var(--gold);
}

.hero-logo-stage {
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 440 / 240;
  margin: 12px 0 8px;
  background: radial-gradient(circle at 50% 56%, rgba(139, 92, 255, 0.2), transparent 72%);
}

.logo-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}

.logo-orb-slot {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

/* Pixel positions match data/title_logo_layout.json (440x240 canvas, 40x40 orb frame) */
.logo-orb-slot--void {
  left: calc(243 / 440 * 100%);
  top: calc(77 / 240 * 100%);
  width: calc(40 / 440 * 100%);
  height: calc(40 / 240 * 100%);
}

.logo-orb-slot--life {
  left: calc(243 / 440 * 100%);
  top: calc(136 / 240 * 100%);
  width: calc(40 / 440 * 100%);
  height: calc(40 / 240 * 100%);
}

.logo-orb-strip {
  display: block;
  width: 800%;
  max-width: none;
  height: 100%;
  transform: translateX(0%);
}

.motion-toggle-btn {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(12, 8, 23, 0.88);
  border: 1px solid var(--edge-lit);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.motion-toggle-btn:hover {
  color: var(--text);
  border-color: var(--teal);
}

.hero-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.7vw, 30px);
  line-height: 1.25;
  color: var(--gold);
}

.hero-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16.5px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--edge-lit);
  background: var(--well);
  color: var(--text);
  box-shadow: inset 1px 1px 0 rgba(201, 180, 255, 0.2), inset -2px -2px 0 var(--edge-dark);
}

.btn:hover {
  border-color: var(--teal);
}

.btn-primary {
  background: linear-gradient(180deg, var(--teal-face) 0%, var(--teal-deep) 100%);
  border-color: var(--teal);
  color: #f4fffc;
}

.btn-primary:hover {
  border-color: var(--gold);
}

.btn-gold {
  background: linear-gradient(180deg, #52391c 0%, #342110 100%);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-gold:hover {
  border-color: #ffe39e;
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.hero-media {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shot-frame {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 2px solid var(--edge-lit);
  background: var(--well);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
}

.shot-frame:hover {
  border-color: var(--gold);
}

.shot-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.shot-frame--ratio52x29 img {
  aspect-ratio: 520 / 290;
}

.shot-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--well);
  border-top: 1px solid var(--edge-mid);
  font-size: 13.5px;
  color: var(--muted);
  text-align: left;
}

.shot-caption strong {
  color: var(--gold);
  font-weight: 700;
}

.shot-zoom-hint {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* --- Section Headings --- */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--edge-mid);
  padding-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 28px);
  color: var(--gold);
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* --- Feature Pillar Grid --- */

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.pillar-card {
  padding: 20px;
}

.pillar-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.pillar-card h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text);
}

.pillar-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* --- Screenshot Gallery --- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* --- Changelog / Beta Highlights --- */

.release-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.release-card {
  padding: 22px;
}

.release-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.release-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  color: var(--gold);
}

.release-date {
  font-size: 12.5px;
  color: var(--lilac);
  background: var(--well);
  border: 1px solid var(--edge-mid);
  padding: 2px 8px;
}

.release-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 14.5px;
}

.release-list strong {
  color: var(--text);
}

/* --- Download Card --- */

.download-box {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 820px) {
  .download-box {
    grid-template-columns: 1fr;
    padding: 20px 18px;
  }
}

.meta-table {
  margin: 14px 0 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.meta-cell {
  background: var(--well);
  border: 1px solid var(--edge-mid);
  padding: 10px 12px;
}

.meta-label {
  display: block;
  font-size: 12px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-value {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-size: 14.5px;
}

.hash-box {
  background: var(--well);
  border: 1px solid var(--edge-mid);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hash-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  color: var(--teal);
  word-break: break-all;
}

.steps-card {
  background: var(--well);
  border: 1px solid var(--edge-mid);
  padding: 18px;
}

.steps-card h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold);
}

.steps-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 14.5px;
}

/* --- Portal Form (forms + validate-input-after-interaction) --- */

.portal {
  padding: 26px;
}

@media (max-width: 720px) {
  .portal {
    padding: 20px 18px;
  }
}

.portal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.portal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 28px);
  color: var(--gold);
}

.mode-fieldset {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.mode-fieldset legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.mode-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--well);
  border: 2px solid var(--edge-mid);
  cursor: pointer;
}

.mode-option:has(input:checked) {
  border-color: var(--teal);
  background: rgba(21, 97, 82, 0.28);
}

.mode-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--teal);
  flex-shrink: 0;
}

.mode-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
}

.mode-desc {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

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

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

.field label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.field-req {
  color: var(--teal);
  font-weight: 700;
}

.field-opt {
  color: var(--faint);
  font-weight: 400;
  font-size: 13px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 2px solid var(--edge-mid);
  background: var(--well);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.field input.has-pw-toggle {
  padding-right: 46px;
}

.field input.input-key {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.field input:focus {
  outline: none;
  border-color: var(--teal);
}

.field input:is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--red);
  background: rgba(255, 125, 140, 0.08);
}

.field input:user-valid {
  border-color: var(--teal-face);
}

.pw-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  min-width: 38px;
  padding: 0 8px;
  background: var(--bark);
  border: 1px solid var(--edge-mid);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pw-toggle:hover {
  color: var(--text);
  border-color: var(--teal);
}

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

.error-msg {
  margin: 0;
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
}

.portal-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.endpoint-hint {
  font-size: 13px;
  color: var(--faint);
}

.portal-status {
  margin: 16px 0 0;
  padding: 13px 16px;
  border: 2px solid var(--edge-mid);
  background: var(--well);
  font-size: 14.5px;
  line-height: 1.5;
}

.portal-status.is-ok {
  border-color: var(--teal);
  background: rgba(21, 97, 82, 0.25);
  color: #d6fff4;
}

.portal-status.is-err {
  border-color: var(--red);
  background: rgba(130, 26, 44, 0.25);
  color: #ffdbe1;
}

.portal-status.is-wait {
  border-color: var(--violet);
  color: var(--lilac);
}

/* --- Gallery Lightbox (<dialog closedby="any">) --- */

dialog#gallery-dialog {
  margin: auto;
  padding: 0;
  width: min(1040px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 2px solid var(--edge-lit);
  background: var(--bark);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

dialog#gallery-dialog:modal {
  overscroll-behavior: contain;
}

dialog#gallery-dialog::backdrop {
  background: rgba(6, 4, 12, 0.88);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--well);
  border-bottom: 1px solid var(--edge-mid);
}

.dialog-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--gold);
}

.dialog-close {
  padding: 6px 12px;
  background: var(--bark);
  border: 2px solid var(--edge-lit);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.dialog-close:hover {
  border-color: var(--red);
  color: var(--red);
}

.dialog-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  background: var(--night);
  border: 1px solid var(--edge-mid);
}

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.dialog-nav {
  display: inline-flex;
  gap: 8px;
}

/* --- Footer --- */

.site-footer {
  border-top: 2px solid var(--edge-mid);
  background: var(--well);
  padding: 20px 16px;
}

.footer-inner {
  width: min(1140px, 100% - 32px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* --- Opt-In Motion Only (prefers-reduced-motion: no-preference) --- */

@keyframes orb-cycle {
  from {
    transform: translateX(0%);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .shot-frame,
  .top-nav a,
  .mode-option {
    transition:
      border-color 160ms var(--ease),
      background-color 160ms var(--ease),
      transform 160ms var(--ease);
  }

  .btn:hover {
    transform: translateY(-2px);
  }

  .hero-logo-stage:not(.is-motion-paused) .logo-orb-strip--void {
    animation: orb-cycle 3.2s steps(8, end) infinite;
  }

  .hero-logo-stage:not(.is-motion-paused) .logo-orb-strip--life {
    animation: orb-cycle 1.15s steps(8, end) infinite;
  }

  .hero-logo-stage:not(.is-motion-paused) .logo-layer--glow {
    animation: glow-pulse 2.6s ease-in-out infinite;
  }

  dialog#gallery-dialog[open] {
    animation: dialog-in 180ms var(--ease);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
