/* ───────────── MythosLoom theme: dark parchment-and-ember ───────────── */
/*
   Taken from the prototype's app.css so the two look like one product. Only what Phase 1 renders is
   here — the prototype's stat blocks, spell cards, initiative rows, plot clocks, meters and table-view
   styles are left behind rather than carried over as dead rules. They come back with the screens that
   need them, in Phase 2 and Phase 3.

   The custom properties are the whole theme. Anything new should use them rather than a literal colour;
   a hard-coded hex is how a palette stops being a palette.
*/
:root {
    --bg: #0f0e13;
    --bg-2: #17161d;
    --bg-3: #1f1d27;
    --panel: #1b1a22;
    --border: #2d2b38;
    --text: #e8e3d8;
    --muted: #9c97a8;
    --accent: #d9822b;      /* ember */
    --accent-2: #8b5cf6;    /* arcane violet */
    --danger: #d64545;
    --ok: #3fae6a;
    --warn: #e0b341;
    --radius: 10px;
    --font-display: "Cinzel", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body { background: var(--bg); color: var(--text); font-family: var(--font-body); }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #f0a050; }
h1, h2, h3, h4, .brand { font-family: var(--font-display); letter-spacing: .02em; color: var(--text); }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
h1:focus { outline: none; }
::selection { background: var(--accent-2); color: white; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.content { padding: 1.5rem 2rem 4rem; max-width: 1400px; }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .content { padding: 1rem; }
}

.brand { font-size: 1.25rem; color: var(--accent); display: block; padding: .25rem .5rem 1rem; }
.brand small { display: block; font-family: var(--font-body); font-size: .7rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: .9rem .5rem .3rem; }
.nav a { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem; border-radius: 8px; color: var(--text); font-size: .93rem; }
.nav a:hover { background: var(--bg-3); }
.nav a.active { background: rgba(217,130,43,.15); color: var(--accent); }
.nav a .ico { width: 1.2rem; text-align: center; opacity: .8; }

/* panels & cards */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; }
.panel + .panel { margin-top: 1rem; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { color: var(--text); --bs-card-bg: var(--bg-3); background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; transition: border-color .15s; }
.card:hover { border-color: #3f3c4e; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
/* A horizontal group of controls. Deliberately NOT called .row.
   The prototype redefines Bootstrap's .row as a flex row and neutralises its gutters. That is fine in a
   project whose own markup uses it that way, and wrong here: the Identity account pages are laid out with
   Bootstrap's grid, and overriding .row flattened their columns so content ran off the side of the page.
   A separate name leaves the grid alone. */
.inline-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-row > .spacer { flex: 1 1 auto; }
.inline-row.between { justify-content: space-between; }
.spacer { flex: 1; }
hr { border-color: var(--border); opacity: 1; }

/* forms */
input, select, textarea, .form-control, .form-select {
    background: var(--bg) !important; color: var(--text) !important; border: 1px solid var(--border) !important; border-radius: 8px !important;
}
input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(217,130,43,.2) !important; }
label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem; display: block; }
.field { margin-bottom: .7rem; }
.form-check-input { background-color: var(--bg); border-color: var(--border); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-label { text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--text); display: inline; }
.form-text { color: var(--muted); font-size: .8rem; }
textarea { min-height: 90px; }

/* The floating-label forms from the Identity scaffold sit badly against uppercase muted labels, so the
   label reverts to ordinary text inside them rather than every account page being rewritten. */
.form-floating > label { text-transform: none; letter-spacing: 0; color: var(--muted); }

/* buttons */
.btn { border-radius: 8px; font-weight: 500; border: 1px solid transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a0f05; }
.btn-primary:hover { background: #f0a050; border-color: #f0a050; color: #1a0f05; }
.btn-outline-primary { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); color: #1a0f05; }
.btn-outline-secondary, .btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline-secondary:hover, .btn-ghost:hover { background: var(--bg-3); border-color: #4a4759; color: var(--text); }
.btn-danger, .btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover, .btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-outline-success { background: transparent; border-color: var(--ok); color: var(--ok); }
.btn-outline-success:hover { background: var(--ok); color: #08160d; }
.btn-link { color: var(--accent); }
.btn-sm { font-size: .8rem; padding: .25rem .6rem; }

/* The account pages use nav-pills, whose active state is a Bootstrap colour that belongs to neither the
   light theme it assumes nor this one. Matched to the sidebar so the two navigations agree. */
.nav-pills .nav-link { color: var(--text); border-radius: 8px; }
.nav-pills .nav-link:hover { background: var(--bg-3); }
.nav-pills .nav-link.active { background: rgba(217,130,43,.15); color: var(--accent); }

/* badges & tags */
.badge { border-radius: 6px; font-weight: 500; padding: .25em .5em; }
.tag { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem; font-size: .72rem; color: var(--muted); margin: .1rem .15rem .1rem 0; }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.tag.danger { border-color: var(--danger); color: var(--danger); }

/* tables — Bootstrap's defaults assume a light background, so they are overridden rather than fought */
.table { --bs-table-color: var(--text); --bs-table-bg: transparent; --bs-table-border-color: var(--border); color: var(--text); font-size: .92rem; }
.table > thead th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--border); }
.table > tbody td { border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: rgba(255,255,255,.02); color: var(--text); }
.table-warning, .table-warning > * { --bs-table-accent-bg: rgba(224,179,65,.12); color: var(--text); }
.table > :not(caption) > * > * { background-color: transparent; }

/* alerts */
.alert { border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.alert-info { border-color: var(--accent-2); background: rgba(139,92,246,.12); }
.alert-warning { border-color: var(--warn); background: rgba(224,179,65,.1); }
.alert-danger { border-color: var(--danger); background: rgba(214,69,69,.12); }
.alert-success { border-color: var(--ok); background: rgba(63,174,106,.12); }

/* landing — its own layout, with no sidebar */
.landing { display: flex; flex-direction: column; min-height: 100vh; }
.landing-content { flex: 1 0 auto; padding: 2rem 2rem 3rem; max-width: 1000px; margin: 0 auto; width: 100%; }
.landing-footer { border-top: 1px solid var(--border); padding: 1rem 2rem; max-width: 1000px; margin: 0 auto; width: 100%; }
.landing-footer a { color: var(--muted); }
.landing-footer a:hover { color: var(--accent); }

.masthead { display: flex; align-items: center; gap: 1rem; padding-top: 1rem; }
.masthead-logo { width: 96px; height: 96px; object-fit: contain; }
.masthead-title { font-size: 2.6rem; margin: 0; color: var(--accent); letter-spacing: .04em; }
@media (max-width: 600px) {
    .masthead-logo { width: 64px; height: 64px; }
    .masthead-title { font-size: 2rem; }
    .landing-content, .landing-footer { padding-left: 1rem; padding-right: 1rem; }
}

.hero { padding: 2rem 0; max-width: 800px; }
/* The masthead carries the h1, so the hero's own line is an h2 and is sized up to read as the headline. */
.hero h2 { font-size: 2.6rem; line-height: 1.1; }
.hero p.lead { color: var(--muted); font-size: 1.15rem; }
.feature { padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.feature .ico { font-size: 1.6rem; }
.feature h3 { margin: .4rem 0 .2rem; font-size: 1.05rem; }

/* legal documents rendered from markdown */
.legal { max-width: 70ch; }
.legal h1 { margin-bottom: .25rem; }
.legal h2 { margin-top: 2rem; }
.legal blockquote { border-left: 3px solid var(--warn); padding-left: 1rem; color: var(--muted); }
.legal table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.legal th, .legal td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.legal th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.legal code { color: var(--accent); }

.validation-message { color: var(--danger); font-size: .8rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ok); }
.invalid { outline: 1px solid var(--danger); }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; color: black; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 3.7rem; color: white; }
.darker-border-checkbox.form-check-input { border-color: #929292; }
