/* hots site styles — bespoke components for the dark-fantasy storefront.
 *
 * Colors, fonts, spacing, breakpoints, radii and shadows all come from design-tokens.css (the shared
 * source of truth consumed by both this site and the Foundry module). Do NOT add new color/spacing values
 * here — extend design-tokens.css instead so they stay shared. This file owns only component structure:
 * layout, cards, buttons, nav/dropdown, ambient effects. Bootstrap is used as the basis for the numeric
 * scaffolding in design-tokens.css; its component CSS is intentionally not shipped (it would fight this theme). */

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--hots-color-bg);
  color: var(--hots-color-text);
  font-family: var(--hots-font-body);
  line-height: var(--hots-line-height);
}
a {
  color: inherit;
  text-decoration: none;
}

.nav {
  position: fixed;
  z-index: var(--hots-z-nav);
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  background: linear-gradient(#080b10f2, #080b10b8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hots-line);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.sigil {
  width: 34px;
  height: 34px;
  border: 1px solid var(--hots-color-accent);
  transform: rotate(45deg);
  display: grid;
  place-items: center;
}
.sigil span {
  transform: rotate(-45deg);
  color: var(--hots-color-accent);
}
.links {
  display: flex;
  gap: 26px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.links a:hover {
  color: var(--hots-color-accent-soft);
}
.menu {
  display: none;
}

/* Profile dropdown (issue #37): the trigger is an inline link in `.links`; the menu panel hangs below it.
 * Hidden by default, revealed when JS adds `.open` to the container — that's why every option was stacked
 * and unstyled before: these rules never existed. */
.profile {
  position: relative;
  display: inline-flex;
}
.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--hots-line);
  border-radius: 6px;
  color: var(--hots-color-text);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.profile-trigger:hover {
  background: var(--hots-color-panel-alt);
  border-color: var(--hots-color-accent);
}
.profile-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--hots-color-text);
}
.profile-trigger:hover .profile-icon,
.profile.open .profile-icon {
  color: var(--hots-color-accent);
}
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  background: var(--hots-color-surface);
  border: 1px solid var(--hots-line);
  border-radius: 8px;
  box-shadow: var(--hots-shadow-2);
  z-index: var(--hots-z-profile-menu);
  display: none;
}
.profile.open .profile-menu {
  display: block;
}
.profile-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--hots-color-text);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.profile-menu a:hover {
  background: var(--hots-color-panel-alt);
  color: var(--hots-color-accent-soft);
}
.profile-logout {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--hots-line);
}
.profile-logout button {
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--hots-line);
  border-radius: 6px;
  color: var(--hots-color-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.profile-logout button:hover {
  background: var(--hots-color-panel-alt);
  color: var(--hots-color-accent-soft);
}

.hero {
  /* Fixed aspect-ratio (image is 1672×941) so the hero's shape — and thus the
     background image scale — never depends on how much header text it holds.
     This keeps home consistent with the shorter sub-page headers. */
  aspect-ratio: 1672 / 941;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 120px 6vw 80px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(4, 7, 11, 0.28), rgba(4, 7, 11, 0.55) 52%, #080b10 100%),
    url("assets/hall-hero.jpg") center/cover no-repeat;
}
.hero:after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, transparent 0 28%, rgba(0, 0, 0, 0.38) 78%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  text-shadow: 0 2px 22px #000;
}
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--hots-color-accent-soft);
}
h1 {
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.95;
  margin: 0.2em 0 0.18em;
  font-weight: 500;
  letter-spacing: 0.035em;
}
h2 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.08;
  font-weight: 500;
  margin: 0.25em 0;
}
.lead {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  max-width: 780px;
  margin: 22px auto;
  color: #eee8dc;
}
.cta-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
}
.btn {
  display: inline-block;
  padding: 14px 24px;
  border: 1px solid var(--hots-color-accent);
  background: #111720d9;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  transition: 0.2s;
}
.btn:hover {
  background: var(--hots-color-accent);
  color: #090b0e;
  transform: translateY(-2px);
}
.btn.ghost {
  background: transparent;
}
.section {
  padding: 100px 7vw;
  max-width: 1400px;
  margin: auto;
}
.section.center {
  text-align: center;
}
.kicker {
  color: var(--hots-color-accent);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.72rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 42px;
}
.card {
  padding: 32px;
  border: 1px solid var(--hots-line);
  background: linear-gradient(145deg, #121923, #0b0f15);
  min-height: 250px;
  position: relative;
  overflow: hidden;
}
.card:before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border: 1px solid var(--hots-line);
  border-radius: 50%;
  right: -45px;
  top: -45px;
}
.card h3 {
  color: var(--hots-color-accent-soft);
  font-size: 1.45rem;
  margin-top: 0;
}
.card p {
  color: var(--hots-color-muted);
}
.card .arrow {
  color: var(--hots-color-accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.quote {
  border-left: 2px solid var(--hots-color-accent);
  padding: 8px 0 8px 28px;
  font-size: 1.35rem;
  color: #f4ecde;
}
.visual {
  min-height: 430px;
  border: 1px solid var(--hots-line);
  background:
    linear-gradient(135deg, rgba(5, 8, 12, 0.25), rgba(5, 8, 12, 0.65)),
    url("assets/hall-hero.jpg") center/cover no-repeat;
  box-shadow: 0 25px 80px #0008;
}
.band {
  border-top: 1px solid var(--hots-line);
  border-bottom: 1px solid var(--hots-line);
  background: #0d1219;
  padding: 70px 7vw;
  text-align: center;
}
.page-hero {
  /* Same fixed aspect-ratio as .hero so the shared image sits at one consistent scale across every
     page regardless of how tall the header text grows. The left-to-right gradient is a readability
     backdrop for the title, not a reason to stretch the hero's shape. */
  width: 100%;
  aspect-ratio: 1672 / 941;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 80px 6vw;
  background:
    linear-gradient(90deg, #080b10 5%, #080b10a8 55%, #080b1030),
    url("assets/hall-hero.jpg") center/cover no-repeat;
}
.page-hero .inner {
  max-width: 850px;
}
.feature {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 30px;
  padding: 35px 0;
  border-bottom: 1px solid var(--hots-line);
}
.num {
  font-size: 3rem;
  color: var(--hots-color-accent);
  opacity: 0.7;
}
.feature h3 {
  margin: 0.15em 0;
  font-size: 1.55rem;
}
.feature p {
  color: var(--hots-color-muted);
  max-width: 850px;
}
.pill {
  display: inline-block;
  border: 1px solid var(--hots-line);
  padding: 6px 10px;
  margin: 4px;
  color: var(--hots-color-accent-soft);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}
.footer {
  padding: 50px 7vw;
  border-top: 1px solid var(--hots-line);
  color: #8f918f;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer b {
  color: var(--hots-color-text);
}
hr {
  border: none;
  border-top: 1px solid var(--hots-line);
  margin: 2.25rem auto;
  max-width: 220px;
  opacity: 0.85;
}
.sound-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--hots-z-sound-toggle);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: 1px solid var(--hots-line);
  border-radius: 999px;
  background: linear-gradient(145deg, #121923, #0c1016);
  color: var(--hots-color-text);
  font-family: var(--hots-font-body);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--hots-shadow-1);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.sound-toggle:hover {
  background: var(--hots-color-accent);
  color: #090b0e;
  transform: translateY(-2px);
}
.sound-icon {
  font-size: 1.05rem;
  line-height: 1;
  transition: opacity 0.2s;
}
/* playing (enabled) note is bright; muted note dims */
.sound-toggle.on .sound-icon {
  color: var(--hots-color-accent);
}
.sound-toggle:not(.on) .sound-icon {
  opacity: 0.45;
}
.dashboard {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--hots-color-muted);
  padding: 60px 24px;
}
.dashboard h1 {
  margin: 0.1em 0 0.35em;
}
.dashboard > p {
  margin-top: 0;
}

/* --- Ambient effects / "Living Hall" (issue #37) ---------------------------
 * The JS in app.js injects an .atmosphere overlay and drives a subtle cursor
 * parallax via --mx/--my on :root. These rules own that layer. background-size
 * is padded 42px beyond the element so the parallax shift never exposes the
 * image edge — without it the hero "loses" full width when you move the mouse. */
:root {
  --mx: 0;
  --my: 0;
}
.hero,
.page-hero,
.visual {
  background-position: calc(50% + var(--mx) * 18px) calc(50% + var(--my) * 12px);
  background-size: calc(100% + 42px) auto;
  transition: background-position 0.12s linear;
}
.hero-inner,
.page-hero .inner {
  transform: translate(calc(var(--mx) * -9px), calc(var(--my) * -7px));
  transition: transform 0.14s ease-out;
}
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: var(--hots-z-atmosphere);
  pointer-events: none;
  overflow: hidden;
}
.vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 130px #0009;
}
.dust {
  position: absolute;
  inset: -10%;
  opacity: 0.18;
  background-image: radial-gradient(circle, #f6dfad 0 1px, transparent 1.5px);
  background-size: 79px 71px;
  animation: dustDrift 28s linear infinite;
}
.embers {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 75%, #ffb44b88 0 1px, transparent 2px),
    radial-gradient(circle at 89% 64%, #ffc45f77 0 1px, transparent 2px);
  background-size: 57px 91px, 83px 67px;
  opacity: 0.18;
  animation: emberRise 9s linear infinite;
}
.mote {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9bdcff;
  box-shadow: 0 0 8px #6cc8ff, 0 0 18px #408ee9;
  opacity: 0;
  animation: mote var(--d) ease-in-out var(--delay) infinite;
}
.spell {
  position: absolute;
  width: var(--size);
  height: var(--size);
  border: 1px solid #72c8ff;
  border-radius: 50%;
  box-shadow: 0 0 12px #73d5ff, 0 0 35px #497effaa, inset 0 0 12px #a5e8ff;
  opacity: 0;
  animation: spell 2.6s ease-out forwards;
}
.spell:before,
.spell:after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c9efff;
  text-shadow: 0 0 12px #75caff;
  font-size: 45%;
  animation: spin 2.2s linear infinite;
}
.spell:after {
  content: "";
  inset: 18%;
  border: 1px solid #bdefff;
  transform: rotate(45deg);
}

@keyframes dustDrift {
  to {
    transform: translate(70px, -55px);
  }
}
@keyframes emberRise {
  from {
    background-position: 0 90px, 0 65px;
  }
  to {
    background-position: 15px -90px, -10px -67px;
  }
}
@keyframes mote {
  0%,
  100% {
    opacity: 0;
    transform: translate(0, 12px) scale(0.5);
  }
  40% {
    opacity: 0.75;
  }
  70% {
    opacity: 0.2;
    transform: translate(14px, -35px) scale(1.4);
  }
}
@keyframes spell {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-20deg);
  }
  18% {
    opacity: 0.8;
  }
  55% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
    transform: scale(1.8) rotate(35deg);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Settings dashboard (issue #37) ---------------------------------------- */
/* The shared .dashboard centers its children vertically — fine for the small
   account page, but settings has several stacked sections that need room to
   breathe. Override the centering here so content flows top-to-bottom and the
   widest section can open up instead of being pinned to a narrow middle band. */
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.settings {
  min-height: auto;
  justify-content: flex-start;
  align-items: center;
  padding: 80px 24px 120px;
  max-width: 900px;
  width: 100%;
}
.settings h1 {
  margin-bottom: 0.15em;
}
/* The "Signed in as …" line under the title — give it room and let it sit left
   with the page rather than competing for center stage. */
.settings > p.muted {
  max-width: none;
  margin-bottom: 3rem;
}

/* Each section (API keys, Profile) becomes a grouped card so the eye reads them
   as distinct blocks instead of one crowded column of floating content. */
.settings-block {
  background: var(--hots-color-surface);
  border: 1px solid var(--hots-line);
  border-radius: var(--hots-radius-md);
  padding: 36px 40px;
  margin-bottom: 2rem;
  text-align: left;
}
.settings-block h2 {
  margin-top: 0;
}
.settings-block > p.muted {
  max-width: none;
}

/* The divider between sections — widen it to span the content and tone it down. */
.settings hr {
  max-width: none;
  opacity: 0.5;
}

/* Profile form: stack each field (label above input) so the four fields read as
   a clean vertical list instead of cramped inline label+input pairs. */
.profile-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  align-items: start;
}
.profile-form > label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--hots-color-muted);
  letter-spacing: 0.02em;
}
.profile-form input {
  background: #0b0f15;
  border: 1px solid var(--hots-line);
  border-radius: var(--hots-radius-sm);
  color: var(--hots-color-text);
  padding: 10px 12px;
  font-family: var(--hots-font-body);
  font-size: 0.95rem;
}
.profile-form input:focus {
  outline: none;
  border-color: var(--hots-color-accent);
}
/* The Save profile button spans the full width below the grid. */
.profile-form .btn {
  grid-column: 1 / -1;
  align-self: start;
}

/* API key list — tidy the bare <ul> and empty state. */
.key-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
}
.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--hots-line);
  border-radius: var(--hots-radius-sm);
  margin-bottom: 10px;
  background: #0b0f15;
}
.key-name {
  color: var(--hots-color-text);
  font-size: 0.95rem;
}
.key-empty {
  padding: 4px 0;
}

/* The key-label input in the create form — match the profile inputs and sit
   beside its Generate button on one row. */
.create-key-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.create-key-form input {
  background: #0b0f15;
  border: 1px solid var(--hots-line);
  border-radius: var(--hots-radius-sm);
  color: var(--hots-color-text);
  padding: 10px 12px;
  font-family: var(--hots-font-body);
  font-size: 0.95rem;
  flex: 1 1 240px;
}
.create-key-form input:focus {
  outline: none;
  border-color: var(--hots-color-accent);
}

/* Result/error line shown after a key is minted or revoked. */
.key-result {
  margin-top: 16px;
  font-size: 0.9rem;
}

@media (max-width: 850px) {
  .links {
    display: none;
  }
  .menu {
    display: block;
    color: var(--hots-color-accent);
  }
  .grid,
  .split {
    grid-template-columns: 1fr;
  }
  .feature {
    grid-template-columns: 1fr;
  }
  .num {
    font-size: 2rem;
  }
  .hero {
    background-position: 58% center;
  }
  .section {
    padding: 75px 6vw;
  }
  h1 {
    font-size: clamp(2.7rem, 13vw, 5rem);
  }
}

@media (max-width: 850px) {
  .hero,
  .page-hero,
  .visual {
    background-size: cover;
  }
  .sound-label {
    display: none;
  }
  .sound-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dust,
  .embers,
  .mote,
  .spell,
  .sound-icon {
    animation: none !important;
  }
  .hero,
  .page-hero,
  .visual,
  .hero-inner,
  .page-hero .inner {
    transform: none !important;
    background-position: center !important;
  }
}
