/* =========================================
   Lorewalker Core Theme
   Base visual system for all worlds
   ========================================= */

/* Fonts (body: Merriweather, UI: Inter, headings: Cinzel) */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&family=Inter:wght@300;400;600&family=Cinzel:wght@400;600;700&display=swap');

/* =========================================
   Design tokens (Lorewalker-neutral)
   ========================================= */

:root {
  /* ---- Core Neutrals (background + surfaces) ---- */
  --lw-bg-deep: #070510;        /* cosmic void */
  --lw-bg-alt: #0f0a1a;         /* secondary backdrop */
  --lw-surface: #1a1326;        /* main cards/panels */
  --lw-surface-soft: #221931;   /* softer blocks */
  --lw-surface-contrast: #2a1f3c;

  /* ---- Ink & Parchment ---- */
  --lw-parchment: #d9cab3;      /* parchment / highlights */
  --lw-ink: #3e3a45;            /* UI outlines, low-contrast text */

  /* ---- Text ---- */
  --lw-text-main: #f0e9ff;
  --lw-text-muted: #b7adc9;
  --lw-text-soft: #9b93b0;

  /* ---- Primary Accents (tweak per world) ---- */
  --lw-primary: #a452ff;            /* Electric Amethyst */
  --lw-primary-soft: #b38ddb;       /* Crystal Lavender */
  --lw-primary-strong: #d580ff;     /* Vivid Violet Flame */

  /* ---- Secondary Accents ---- */
  --lw-secondary: #5fd5b2;
  --lw-secondary-soft: #4cae93;

  /* ---- Semantic Colors ---- */
  --lw-success: #7bdf9c;    /* gentle verdant */
  --lw-warning: #ffb266;    /* warm amber */
  --lw-danger:  #ff7e7e;    /* muted crimson */

  /* ---- Borders & Lines ---- */
  --lw-border-subtle: rgba(255, 255, 255, 0.06);
  --lw-border-strong: rgba(255, 255, 255, 0.18);

  /* ---- Radii ---- */
  --lw-radius-xs: 2px;
  --lw-radius-sm: 2px;
  --lw-radius-md: 2px;
  --lw-radius-lg: 2px;
  --lw-radius-pill: 999px;

  /* ---- Shadows ---- */
  --lw-shadow-subtle: 0 6px 18px rgba(0, 0, 0, 0.75);
  --lw-shadow-soft:   0 10px 26px rgba(0, 0, 0, 0.85);

  /* ---- Spacing ---- */
  --lw-spacing-page-x: 2.25rem;
  --lw-spacing-page-y: 2.25rem;

  /* ---- Max widths ---- */
  --lw-max-width-narrow: 720px;
  --lw-max-width-page:   960px;

  /* ---- Neutral home-layout tokens (shared layout-lorewalker.css) ---- */
  --home-bg:     var(--lw-bg-deep);
  --home-card:   var(--lw-surface);
  --home-text:   var(--lw-text-main);
  --home-muted:  var(--lw-text-muted);
  --home-accent: var(--lw-primary);
}

/* =========================================
   Base shell
   ========================================= */

body.lw-site {
  min-height: 100vh;
  margin: 0;
  font-family: "Merriweather", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", serif;
  line-height: 1.7;
  color: var(--lw-text-main);
  background-color: #05030a;
  background-image:
    radial-gradient(circle at 0 0, rgba(213, 128, 255, 0.16), transparent 58%),
    radial-gradient(circle at 100% 100%, rgba(101, 194, 195, 0.12), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(213, 128, 255, 0.12), transparent 56%),
    radial-gradient(circle at 0 100%, rgba(95, 213, 178, 0.12), transparent 58%),
    linear-gradient(to bottom, #05030a, #080412, #06030e);
  background-attachment: fixed;
}

/* Apply global padding/background only when not using Lorewalker home layout */
body.lw-site:not(.home-page) {
  padding: var(--lw-spacing-page-y) var(--lw-spacing-page-x);
}

/* Center column for prose-heavy views */
body.lw-site .lw-page-shell {
  max-width: var(--lw-max-width-page);
  margin: 0 auto;
  position: relative;
}

/* Optional subtle frame */
body.lw-site .lw-page-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  border: 1px solid rgba(208, 168, 255, 0.24);
  pointer-events: none;
}

/* TEMP: alias for existing rhome-page-shell until full migration */
body.lw-site .rhome-page-shell {
  max-width: var(--lw-max-width-page);
  margin: 0 auto;
  position: relative;
}
body.lw-site .rhome-page-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  border: 1px solid rgba(208, 168, 255, 0.24);
  pointer-events: none;
}

/* =========================================
   Typography
   ========================================= */

/* Headings: Cinzel */
body.lw-site h1,
body.lw-site h2,
body.lw-site h3,
body.lw-site h4 {
  font-family: "Cinzel", "Georgia", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lw-parchment);
  margin-top: 1.8rem;
  margin-bottom: 0.75rem;
}

body.lw-site h1 {
  font-size: 2.4rem;
}

body.lw-site h2 {
  font-size: 1.7rem;
}

body.lw-site h3 {
  font-size: 1.35rem;
}

body.lw-site h4 {
  font-size: 1.1rem;
}

/* Body text: Merriweather */
body.lw-site p,
body.lw-site ul,
body.lw-site ol {
  font-size: 0.98rem;
  color: var(--lw-text-main);
  margin-bottom: 0.9rem;
  max-width: 70ch;
}

body.lw-site p.small {
  font-size: 0.9rem;
  color: var(--lw-text-soft);
}

body.lw-site ul,
body.lw-site ol {
  padding-left: 1.4rem;
}

body.lw-site ul li,
body.lw-site ol li {
  margin-bottom: 0.2rem;
}

/* Eyebrow / label headings */
body.lw-site .lw-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--lw-text-soft);
  margin-bottom: 0.5rem;
}

/* TEMP: alias for existing .rhome-eyebrow usage */
body.lw-site .rhome-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--lw-text-soft);
  margin-bottom: 0.5rem;
}

/* Links */
body.lw-site a {
  color: var(--lw-primary-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(164, 82, 255, 0.5);
  transition: color 150ms ease, text-shadow 150ms ease, border-color 150ms ease;
}

body.lw-site a:hover {
  color: var(--lw-primary-strong);
  border-color: rgba(213, 128, 255, 0.7);
  text-shadow: 0 0 8px rgba(164, 82, 255, 0.5);
}

body.lw-site hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 1.75rem 0;
}

/* Blockquotes */
body.lw-site blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid rgba(164, 82, 255, 0.8);
  background: rgba(12, 7, 26, 0.9);
  border-radius: 3px;
  font-style: italic;
  color: var(--lw-text-soft);
}

/* =========================================
   Cards / panels
   ========================================= */

/* Canonical Lorewalker card (shared with home tiles) */
.home-card,
.lw-card {
  background:
    radial-gradient(circle at 0 0, rgba(213, 128, 255, 0.14), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(95, 213, 178, 0.10), transparent 55%),
    var(--lw-surface);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--lw-shadow-subtle);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  color: var(--lw-text-main);
}

.home-card:hover,
.lw-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--lw-shadow-soft);
  border-color: color-mix(in srgb, var(--home-accent) 45%, transparent);
}

.home-card,
.lw-card {
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

/* Card titles */
body.lw-site .lw-card-title,
.home-card h2 {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lw-parchment);
  margin-bottom: 0.5rem;
}

/* Supporting lede text */
body.lw-site .lw-lede {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--lw-text-muted);
  max-width: 60ch;
}

/* =========================================
   Pills / tags (Lorewalker generic)
   ========================================= */

body.lw-site .lw-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.9rem;
}

body.lw-site .lw-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.6rem;
  border-radius: 3px;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--lw-text-muted);
}

/* Semantic variants */
body.lw-site .lw-pill--primary {
  color: var(--lw-primary-soft);
}

body.lw-site .lw-pill--life {
  color: var(--lw-secondary-soft);
}

body.lw-site .lw-pill--danger {
  color: #ffc1c1;
}

/* TEMP: map rhome-pill classes onto lw-pill for backward compatibility */
body.lw-site .rhome-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.9rem;
}

body.lw-site .rhome-pill,
body.lw-site .rhome-pill--primary,
body.lw-site .rhome-pill--life,
body.lw-site .rhome-pill--danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.6rem;
  border-radius: 3px;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--lw-text-muted);
}
body.lw-site .rhome-pill--primary { color: var(--lw-primary-soft); }
body.lw-site .rhome-pill--life    { color: var(--lw-secondary-soft); }
body.lw-site .rhome-pill--danger  { color: #ffc1c1; }

/* =========================================
   Notes / callouts
   ========================================= */

body.lw-site .lw-note {
  position: relative;
  margin: 1.4rem 0;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 8, 30, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.72);
  font-size: 0.9rem;
  color: var(--lw-text-soft);
}

body.lw-site .lw-note strong {
  color: var(--lw-parchment);
}

body.lw-site .lw-note-label {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.21em;
  color: var(--lw-primary-soft);
  margin-bottom: 0.35rem;
}

/* TEMP: rhome-note aliases */
body.lw-site .rhome-note {
  position: relative;
  margin: 1.4rem 0;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 8, 30, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.72);
  font-size: 0.9rem;
  color: var(--lw-text-soft);
}

body.lw-site .rhome-note strong {
  color: var(--lw-parchment);
}

body.lw-site .rhome-note-label {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.21em;
  color: var(--lw-primary-soft);
  margin-bottom: 0.35rem;
}

/* =========================================
   Tables
   ========================================= */

body.lw-site table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

body.lw-site thead {
  background: linear-gradient(
    90deg,
    rgba(164, 82, 255, 0.24),
    rgba(95, 213, 178, 0.10)
  );
}

body.lw-site th,
body.lw-site td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.lw-site th {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  text-align: left;
  color: var(--lw-parchment);
}

body.lw-site tbody tr:nth-child(even) {
  background-color: rgba(14, 8, 26, 0.8);
}

/* Scroll wrapper if needed */
body.lw-site .table-scroll {
  width: 100%;
  overflow-x: auto;
}

/* =========================================
   Code / preformatted
   ========================================= */

body.lw-site code {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
               Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
               monospace;
  font-size: 0.82rem;
  padding: 0.12rem 0.32rem;
  border-radius: 3px;
  background: rgba(33, 22, 55, 0.9);
  border: 1px solid rgba(208, 168, 255, 0.35);
  color: var(--lw-parchment);
}

body.lw-site pre {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
               Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
               monospace;
  font-size: 0.83rem;
  padding: 0.8rem 0.95rem;
  border-radius: 3px;
  background:
    radial-gradient(circle at 0 0, rgba(213, 128, 255, 0.16), transparent 60%),
    rgba(12, 6, 30, 0.98);
  border: 1px solid rgba(208, 168, 255, 0.32);
  color: var(--lw-parchment);
  overflow-x: auto;
}

/* =========================================
   Buttons
   ========================================= */

body.lw-site .btn-lw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;

  padding: 0.55rem 1.1rem;
  border-radius: 3px;
  border: 1px solid rgba(164, 82, 255, 0.75);

  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lw-parchment);
  background: rgba(23, 11, 35, 0.9);
  box-shadow: var(--lw-shadow-subtle);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

body.lw-site .btn-lw:hover {
  transform: translateY(-1px);
  box-shadow: var(--lw-shadow-soft);
}
