/*
  Starhallow Online - portal stylesheet
  Cozy storybook MMO front-end
*/

/* ------------------------------------------------------------------
   Fonts
------------------------------------------------------------------ */

@font-face {
  font-family: "Fraunces";
  font-weight: 600;
  font-style: normal;
  src: url("/static/fonts/fraunces-600.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  font-weight: 600;
  font-style: italic;
  src: url("/static/fonts/fraunces-600-italic.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  font-weight: 200 1000;
  src: url("/static/fonts/nunito-variable.woff2") format("woff2");
  font-display: swap;
}

/* ------------------------------------------------------------------
   Design tokens
------------------------------------------------------------------ */

:root {
  --bg: #f7efe2;
  --bg-2: #fff8ec;
  --card: #fffaf1;
  --ink: #2c2420;
  --ink-2: #5d5048;
  --line: #e2d4bd;
  --accent: #b8541f;
  --accent-ink: #8a3b10;
  --glow: #ffb347;
  --glow-soft: rgba(255,179,71,0.35);
  --focus: #1f6f8b;
  --shadow: 0 10px 30px rgba(80,50,20,0.12);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1824;
    --bg-2: #241f30;
    --card: #2a2436;
    --ink: #f1e8da;
    --ink-2: #c3b7a6;
    --line: #3d3449;
    --accent: #f0a04b;
    --accent-ink: #ffc47a;
    --focus: #8fd3ea;
    --glow-soft: rgba(255,179,71,0.22);
    --shadow: 0 10px 30px rgba(0,0,0,0.45);
  }
}

/* ------------------------------------------------------------------
   Reset & base
------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--glow-soft), transparent),
    radial-gradient(ellipse 50% 40% at 20% 30%, var(--glow-soft), transparent);
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  overflow-x: hidden;
}

body::after {
  content: "";
  position: sticky;
  top: 0;
  left: 0;
  width: 100vw;
  height: 0;
  pointer-events: none;
}

main {
  flex: 1;
  min-width: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

a {
  color: var(--accent-ink);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ------------------------------------------------------------------
   Utilities
------------------------------------------------------------------ */

.skip {
  position: absolute;
  top: -120px;
  left: 16px;
  padding: 12px 20px;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: 10px;
  z-index: 100;
  font-weight: 700;
  transition: top 0.15s ease;
}

.skip:focus {
  top: 16px;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.container {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.narrow {
  width: min(760px, 100% - 32px);
  margin-inline: auto;
}

/* ------------------------------------------------------------------
   Header
------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(var(--bg), 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.main-nav {
  display: flex;
  gap: 4px;
  margin-inline-start: 12px;
}

.main-nav a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.main-nav a:hover {
  background: var(--bg-2);
  color: var(--ink);
}

.main-nav a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--card);
  border: 1px solid var(--line);
}

.nav-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-actions form {
  margin: 0;
  display: flex;
}

.nav-actions form button,
.nav-actions form a {
  white-space: nowrap;
}

/* ------------------------------------------------------------------
   Buttons
------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-ink);
  box-shadow: 0 0 0 4px var(--glow-soft), 0 6px 20px rgba(80,50,20,0.25);
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #1b1824;
  }

  .btn-primary:hover {
    box-shadow: 0 0 0 4px var(--glow-soft), 0 6px 20px rgba(0,0,0,0.35);
  }
}

.btn-ghost {
  background: transparent;
  border: 2px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ------------------------------------------------------------------
   Pill (status badge)
------------------------------------------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.pill::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-online::before {
  background: #2f9e5b;
}

.pill-offline::before {
  background: #b53b3b;
}

/* ------------------------------------------------------------------
   Hero
------------------------------------------------------------------ */

.hero {
  position: relative;
  min-height: clamp(420px, 62vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background-image:
    linear-gradient(
      180deg,
      rgba(20, 14, 30, 0.35) 0%,
      rgba(20, 14, 30, 0.75) 100%
    ),
    url("/static/img/hero.webp");
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.hero-inner {
  padding-block: 64px;
  max-width: 760px;
  width: 100%;
  margin-inline: 0 auto;
  padding-inline: 16px;
}

.hero h1 {
  color: #fff;
  margin-bottom: 0.4em;
}

.hero p {
  font-size: 1.2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1.7;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--glow);
  margin-bottom: 0.4em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.hero .btn-ghost {
  border: 2px solid #fff;
  color: #fff;
  background: transparent;
}

.hero .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hero .pill {
  background: rgba(20, 14, 30, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ------------------------------------------------------------------
   Sections
------------------------------------------------------------------ */

.section {
  padding-block: clamp(40px, 7vw, 80px);
}

.section-title {
  margin-bottom: 24px;
}

.features {
  background: var(--bg-2);
}

/* ------------------------------------------------------------------
   Cards
------------------------------------------------------------------ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.news-card .meta {
  font-size: 0.8rem;
  color: var(--ink-2);
}

.news-card .meta small {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.news-card h3 a {
  text-decoration: none;
  color: var(--ink);
}

.news-card h3 a:hover {
  color: var(--accent);
}

.feature h3 {
  color: var(--accent-ink);
  margin-bottom: 0.3em;
}

/* ------------------------------------------------------------------
   Auth
------------------------------------------------------------------ */

.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 2rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 700;
  font-size: 0.95rem;
}

.field input:not([type="hidden"]) {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s ease;
}

.field input:focus {
  border-color: var(--accent);
  outline: none;
}

.field-hint {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin: 0;
}

.field-error {
  font-size: 0.85rem;
  color: #b53b3b;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .field-error {
    color: #ff8a8a;
  }
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid;
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-error {
  background: #fdf2f0;
  border-color: #e8b4ae;
  color: #a03830;
}

@media (prefers-color-scheme: dark) {
  .alert-error {
    background: rgba(181, 59, 59, 0.12);
    border-color: #b53b3b;
    color: #ff8a8a;
  }
}

.alert-info {
  background: #fff8ec;
  border-color: #e8c48e;
  color: #8a6d30;
}

@media (prefers-color-scheme: dark) {
  .alert-info {
    background: rgba(255, 212, 100, 0.08);
    border-color: var(--glow);
    color: #ffe4a8;
  }
}

.auth-form .btn-primary {
  width: 100%;
}

.pw-toggle {
  justify-self: end;
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.85rem;
  border-width: 1px;
}

/* ------------------------------------------------------------------
   Content
------------------------------------------------------------------ */

.content-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 40px);
  margin-block: 40px;
}

ul.list-clean {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.list-clean li {
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}

ul.list-clean li:last-child {
  border-bottom: none;
}

ol.list-clean {
  padding-left: 1.4em;
}

ol.list-clean li {
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}

ol.list-clean li:last-child {
  border-bottom: none;
}

.back-link {
  display: inline-block;
  margin-top: 16px;
}

.prose p {
  line-height: 1.7;
}

.prose a {
  text-decoration: underline;
}

.account-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
}

.kv dt {
  font-weight: 700;
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
}

/* Account profile: long values and the inline "Send confirmation email" form stay inside the card. */
.account-grid .kv dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-grid .kv dd form {
  margin: 6px 0 0;
}

.account-grid .kv dd form .btn {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 22px;
  font-size: 0.95rem;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------
   Footer
------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 28px;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--focus);
}

.site-footer a:hover {
  color: var(--accent);
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}

.foot-inner p {
  margin: 0;
  line-height: 1.5;
}

/* ------------------------------------------------------------------
   Responsive
------------------------------------------------------------------ */

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    margin: 0;
    gap: 4px;
  }

  .main-nav a {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  .nav-actions {
    margin-inline-start: auto;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero .pill {
    width: 100%;
    justify-content: center;
  }

  .hero-inner {
    padding-block: 32px;
    padding-inline: 12px;
  }

  .hero p {
    font-size: 1.05rem;
  }

  .auth-card {
    padding: 24px;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .kv dt {
    margin-bottom: 2px;
  }
}

/* ------------------------------------------------------------------
   Reduced motion
------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}
