/* =========================================================
   Era Online Forever — site-wide styles
   Warm parchment palette with a muted-crimson accent and
   a pixel-font (VT323) for display type.
   MudBlazor handles layout; this file adds theming + texture.
   ========================================================= */

:root {
    --parchment: #f4ecd8;
    --parchment-alt: #efe4c4;          /* subtle section alternation */
    --parchment-surface: #faf3e0;
    --ink: #2c1f14;
    --ink-muted: #5a4636;
    --crimson: #8b1e1e;
    --crimson-hover: #a02a2a;
    --brass: #b8893a;
    --forest: #4a6b4a;
    --rule: rgba(44, 31, 20, 0.15);
}

/* ---------- Global ---------- */

html, body {
    background: var(--parchment);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.display-font {
    font-family: 'VT323', ui-monospace, monospace !important;
    letter-spacing: 0.01em;
}

.text-center { text-align: center; }

/* MudBlazor's MudPaper uses Surface background by default; make sure
   our alternate sections read correctly. */
section.section {
    padding: 5rem 0;
}

section.section-parchment {
    background: var(--parchment);
}

section.section-parchment-alt {
    background: var(--parchment-alt);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.section-header {
    margin-bottom: 3rem;
}

.section-subtitle {
    color: var(--ink-muted);
    max-width: 640px;
    margin: 1rem auto 0;
    line-height: 1.7;
}

/* --- Tool-page modifiers ---
   Tighten vertical chrome on pages whose primary content is a single
   embedded surface (the World Map canvas, the Manual iframe). Goal: no
   page scroll on a normal-height viewport — the embedded surface gets
   the room, the header + footer fit alongside it.
   --tool-chrome-px is the rough total of app bar + section padding +
   header + footer + a small margin. Tune that one number to retitrate. */
section.section--tool {
    --tool-chrome-px: 280px;
    padding: 1.5rem 0;
}

.section-header--compact {
    margin-bottom: 1rem;
}

.section-header--compact .section-subtitle {
    margin-top: 0.4rem;
    line-height: 1.4;
}

.tool-wrapper {
    height: calc(100vh - var(--tool-chrome-px, 280px));
    min-height: 420px;
}

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

.hero-section {
    position: relative;
    min-height: calc(100vh - 48px); /* viewport minus the dense MudAppBar */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #1b1209;    /* dark wood frame behind the hero image */
    color: var(--parchment);
    padding: 6rem 0 5rem;
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    background-image: url('/assets/theatre-hero.jpg');
    background-size: cover;
    background-position: center 35%;
    filter: brightness(0.5) saturate(0.8) contrast(1.05);
    transform: scale(1.05); /* prevent edges from showing when we blur */
    z-index: 0;
}

.hero-backdrop::after {
    /* vignette for legibility of hero copy */
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        rgba(27, 18, 9, 0.25) 0%,
        rgba(27, 18, 9, 0.65) 75%,
        rgba(27, 18, 9, 0.8) 100%);
}

.hero-container {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
}

.hero-sword {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6));
    margin-bottom: 1.5rem;
    animation: swordFloat 4s ease-in-out infinite;
}

@keyframes swordFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.hero-title {
    color: var(--parchment) !important;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    margin: 0 0 0.75rem !important;
}

.hero-tagline {
    color: rgba(244, 236, 216, 0.85) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0.02em;
    margin: 0 !important;
}

.play-button {
    background: var(--crimson) !important;
    color: var(--parchment) !important;
    padding: 14px 32px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 20px rgba(139, 30, 30, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.play-button:hover {
    background: var(--crimson-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(139, 30, 30, 0.55);
}

/* ---------- Live player count ---------- */

.live-status {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: rgba(244, 236, 216, 0.12);
    border: 1px solid rgba(244, 236, 216, 0.2);
    border-radius: 999px;
    color: var(--parchment);
    backdrop-filter: blur(6px);
}

.live-status .live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5fb365;
    box-shadow: 0 0 8px rgba(95, 179, 101, 0.8);
    animation: livePulse 2s ease-in-out infinite;
}

.live-status .MudTypography {
    color: var(--parchment) !important;
}

.live-status strong { color: var(--parchment) !important; }

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(1.25); }
}

.live-status.pulse {
    animation: statusPulse 1.5s ease-out;
}

@keyframes statusPulse {
    0% { background: rgba(212, 175, 125, 0.4); }
    100% { background: rgba(244, 236, 216, 0.12); }
}

/* ---------- About paragraph ---------- */

.about-paragraph {
    font-family: 'Inter', sans-serif !important;
    font-size: 1.25rem !important;
    line-height: 1.8 !important;
    color: var(--ink);
    font-weight: 400;
}

/* ---------- Era cards ---------- */

.era-card {
    background: var(--parchment-surface) !important;
    border: 1px solid var(--rule) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    height: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.era-card--code {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.era-card--museum {
    text-align: center;
    cursor: pointer;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.era-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(44, 31, 20, 0.15);
    border-color: var(--crimson) !important;
}

.card-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--crimson);
}

.card-title {
    margin: 0 !important;
    color: var(--ink) !important;
}

.card-body {
    color: var(--ink-muted) !important;
    line-height: 1.7 !important;
    flex-grow: 1;
}

.card-cta {
    align-self: flex-start;
    text-transform: none !important;
    margin-top: 0.5rem;
}

.museum-icon {
    color: var(--crimson) !important;
    margin-bottom: 0.5rem;
}

.museum-title {
    color: var(--ink) !important;
    margin: 0 !important;
}

.museum-body {
    color: var(--ink-muted) !important;
    line-height: 1.6 !important;
}

/* ---------- Pivot card (2006 source release on timeline) ---------- */

.era-card--pivot {
    background: linear-gradient(135deg, var(--parchment-surface) 0%, #f5e0b8 100%) !important;
    border: 2px solid var(--brass) !important;
    box-shadow: 0 10px 30px rgba(184, 137, 58, 0.25);
}

/* ---------- Timeline tweaks ---------- */

.era-year {
    color: var(--crimson);
    margin: 0;
}

.mud-timeline .mud-timeline-item-opposite {
    padding: 1rem 1.5rem;
}

.mud-timeline .mud-timeline-item-content {
    padding: 1rem 1.5rem;
}

/* ---------- Top nav ---------- */

.era-appbar {
    background: var(--ink) !important;
    color: var(--parchment) !important;
    border-bottom: 2px solid var(--brass);
}

.nav-link {
    color: var(--parchment) !important;
    text-transform: none;
    font-weight: 500;
    position: relative;
    padding-bottom: 2px;
    text-decoration: none !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -2px;
    width: 0; height: 2px;
    background: var(--brass);
    transition: width 0.25s ease;
}

.nav-link:hover::after { width: 100%; }

/* ---------- Overworld map (World Map page) ---------- */

.overworld-wrapper {
    position: relative;
    width: 100%;
    margin: 1rem 0 0.5rem;
    border: 2px solid var(--brass);
    border-radius: 10px;
    overflow: hidden;
    background: #1b1209;
    box-shadow: 0 10px 28px rgba(44, 31, 20, 0.25);
    /* height comes from .tool-wrapper when present; legacy callers fall
       back to a generous default. */
    height: 72vh;
    min-height: 480px;
}
.overworld-wrapper.tool-wrapper {
    height: calc(100vh - var(--tool-chrome-px, 280px));
    min-height: 420px;
}

/* Hosts the original 1999 Era Online manual frameset verbatim. Sized to
   match the World Map's wrapper for visual consistency. The brass border
   reads as "this is a museum exhibit, not chrome of the surrounding site." */
.manual-frame-wrapper {
    width: 100%;
    margin: 1rem 0 0.5rem;
    border: 2px solid var(--brass);
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 28px rgba(44, 31, 20, 0.25);
}

.manual-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.overworld-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.overworld-canvas:active {
    cursor: grabbing;
}

.overworld-tooltip {
    position: absolute;
    display: none;
    pointer-events: none;
    padding: 4px 10px;
    background: rgba(27, 18, 9, 0.92);
    color: var(--parchment);
    border: 1px solid var(--brass);
    border-radius: 4px;
    font-family: 'VT323', ui-monospace, monospace;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    white-space: pre-line;
    line-height: 1.25;
    z-index: 2;
}

.overworld-sidebar {
    /* Matches the canvas wrapper's vertical extent so they sit as a
       balanced pair on md+ screens; on xs the sidebar simply stacks
       below the canvas (MudGrid handles the wrap). */
    margin: 2rem 0 1rem;
    padding: 1rem;
    background: var(--parchment-surface);
    border: 2px solid var(--brass);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(44, 31, 20, 0.25);
}

.overworld-sidebar .overworld-sidebar-title {
    font-family: 'VT323', ui-monospace, monospace;
    letter-spacing: 0.04em;
    font-size: 1.4rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.overworld-sidebar .overworld-sidebar-section {
    margin-bottom: 1.25rem;
}

.overworld-sidebar .overworld-sidebar-section:last-child {
    margin-bottom: 0;
}

.overworld-sidebar .overworld-sidebar-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-bottom: 0.4rem;
}

/* Item-finder stepper — prev / index/total / next, plus the picked
   instance's coordinate. Sits directly under the item autocomplete. */
.overworld-item-stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.overworld-item-stepper-label {
    font-family: 'VT323', ui-monospace, monospace;
    font-size: 1.05rem;
    color: var(--ink);
    min-width: 3em;
    text-align: center;
}

.overworld-item-stepper-coord {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-left: 0.4rem;
    font-family: 'VT323', ui-monospace, monospace;
    letter-spacing: 0.04em;
}

/* Snapshot slider readout — name and (optional) note below the slider. */
.overworld-snapshot-label {
    margin-top: 0.25rem;
    font-family: 'VT323', ui-monospace, monospace;
    font-size: 1.05rem;
    color: var(--ink);
}

.overworld-snapshot-note {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
    line-height: 1.35;
}

/* Per-cell stack-conflict picker. Shown when a conflict badge is clicked.
   Same parchment/brass language as the sidebar but interactive — buttons
   take pointer events, ink text on a parchment surface. */
.overworld-conflict-menu {
    position: absolute;
    display: none;
    z-index: 3;
    min-width: 160px;
    padding: 6px 0;
    background: var(--parchment-surface);
    border: 1px solid var(--brass);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(44, 31, 20, 0.35);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
}

.overworld-conflict-menu .overworld-conflict-menu-header {
    padding: 4px 12px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 4px;
}

.overworld-conflict-menu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    font-family: 'VT323', ui-monospace, monospace;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}

.overworld-conflict-menu button:hover {
    background: rgba(184, 137, 58, 0.18);  /* brass tint */
}

.overworld-conflict-menu button.is-current {
    color: var(--forest);
    font-weight: 600;
}

.overworld-conflict-menu .overworld-conflict-menu-reset {
    border-top: 1px solid var(--rule);
    margin-top: 4px;
    color: var(--ink-muted);
    font-style: italic;
}

/* ---------- Scroll cue (hero bottom) ---------- */

.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 28px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--parchment);
    opacity: 0.85;
    text-decoration: none !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    animation: scroll-cue-bounce 2.4s ease-in-out infinite,
               scroll-cue-fade linear both;
    animation-timeline: auto, scroll(root);
    animation-range: auto, 0 360px;
}

.scroll-cue:hover {
    opacity: 1;
}

.scroll-cue .mud-icon-root {
    color: var(--parchment) !important;
}

@keyframes scroll-cue-bounce {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, 8px); }
}

@keyframes scroll-cue-fade {
    from { opacity: 0.85; }
    to   { opacity: 0; }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    background: #fbe9a7;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--ink);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    section.section { padding: 3rem 0; }
    .hero-section { min-height: auto; padding: 5rem 0 4rem; }
    .hero-sword { width: 120px; height: 120px; }
}
