/* ==========================================================================
   Theme: subura

   The panel in the look of the game it hosts. Every colour below is the
   game's own, taken from the code that draws it rather than matched by eye:

   - the stage's dark ground and its light text -- static/css/game.css and
     static/modules/css/caesar.css (#2a2015, #e8d9b5);
   - the carved marble of the widgets -- STONE in caesar/art.mjs (light, base,
     dark, ink, title) and the gilt line and gold focus of caesar/paint.mjs
     (#b08a3a, #d99a1f), the parchment of its text field (#f4ead2);
   - roof terracotta and plaster -- the materials of caesar/brush.mjs
     (tile #b04a2e, tileDark #8a3620, plaster #e9dcc0);
   - the serif the canvas writes with -- FONT in caesar/gui.mjs.

   tests/caesar_panel_theme_tests.py reads those sources and fails when a value
   here stops being one of theirs.

   Like nebula, this file redefines tokens and adds what the palette alone
   cannot say. The chrome rules live in the shell's main_new.css and are
   written against var(); the narrow layout rules are the shell's and are not
   restated. Load order in index_subura.html: tailwind -> main_new.css -> this.

   No dark/light switch: the shell's themes are single palettes, and this one
   is the game's -- a dark stage around light marble, as in the game itself.
   ========================================================================== */
:root {
    /* The game's palette */
    --subura-stage: #2a2015;
    /* The stage, a shade deeper: for the strips that sit on the stage. */
    --subura-stage-deep: color-mix(in srgb, var(--subura-stage) 70%, black);
    --subura-stage-text: #e8d9b5;
    --subura-stone-light: #d9cdb2;
    --subura-stone: #c6b796;
    --subura-stone-dark: #8f7f5e;
    --subura-ink: #3b2a17;
    --subura-title: #7a1f12;
    --subura-gilt: #b08a3a;
    --subura-gold: #d99a1f;
    --subura-parchment: #f4ead2;
    --subura-plaster: #d2ccbe;
    --subura-terracotta: #6c7480;
    --subura-terracotta-dark: #565d68;
    --subura-muted: #6b5a40;
    --subura-font: Georgia, 'Times New Roman', serif;

    /* The grain of the marble: paintStone() in art.mjs scatters light and dark
       specks over the base; a turbulence filter says the same in one image. */
    --subura-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.16 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

    /* Chrome tokens, mapped onto that palette */
    --sidebar-bg: var(--subura-stage);
    --sidebar-fg: var(--subura-stage-text);
    --sidebar-header-bg: var(--subura-stage-deep);
    --sidebar-width: 16rem;
    --sidebar-width-collapsed: 64px;

    --nav-item-padding: 0.7rem 1.25rem;
    --nav-item-padding-collapsed: 0.7rem;
    --nav-item-radius: 0.25rem;
    --nav-item-fg: var(--subura-stage-text);
    --nav-item-bg: transparent;
    --nav-item-fg-hover: #ffffff;
    /* The game's hover is a warm film over stone; on the dark ground it reads
       as the gold of its focus ring, thinned. The active row is terracotta,
       the roof colour of the city. */
    --nav-item-bg-hover: rgba(217, 154, 31, 0.16);
    --nav-item-fg-active: var(--subura-parchment);
    --nav-item-bg-active: rgba(176, 74, 46, 0.55);
    --nav-item-icon-gap: 0.75rem;

    --modules-nav-max-height: calc(100vh - 200px);
    --modules-nav-padding: 8px 8px 16px;
    --sidebar-scrollbar-track: var(--subura-stage-deep);
    --sidebar-scrollbar-thumb: var(--subura-gilt);
    --sidebar-scrollbar-thumb-hover: var(--subura-gold);

    --chrome-transition: all 0.25s ease;

    /* Adaptive layout: values only, the rules are the shell's. */
    --layout-breakpoint: 768px;
    --drawer-bg: var(--subura-stage);
    --backdrop-color: color-mix(in srgb, var(--subura-stage-deep) 70%, transparent);

    --table-card-bg: var(--subura-parchment);
    --table-card-border: var(--subura-stone);
    --table-card-label-fg: var(--subura-muted);
    --table-sticky-bg: var(--subura-parchment);
    --table-sticky-header-bg: var(--subura-stone-light);
}

body.subura-theme {
    background-color: var(--subura-plaster);
    background-image: var(--subura-grain);
    color: var(--subura-ink);
}

/* The page's fixed ground: plaster with the marble's grain, darkening at the
   edges the way the game's panels sit on its stage. Never takes a click. */
.subura-ground {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 30%, transparent 55%, rgba(42, 32, 21, 0.18) 100%),
        var(--subura-grain),
        var(--subura-plaster);
}

/* --------------------------------------------------------------------------
   Chrome details that the palette alone cannot express.
   -------------------------------------------------------------------------- */
#sidebar {
    background-image:
        linear-gradient(180deg, rgba(255, 245, 210, 0.04), transparent 40%),
        var(--subura-grain);
    /* The gilt line the game draws round its panels. */
    border-right: 2px solid var(--subura-gilt);
    box-shadow: inset -1px 0 0 rgba(255, 250, 235, 0.08), 2px 0 10px rgba(29, 22, 14, 0.35);
    font-family: var(--subura-font);
}

#sidebar > div:first-child {
    background-color: var(--sidebar-header-bg);
    border-bottom: 1px solid var(--subura-gilt);
}

#main-nav {
    position: relative;
}

.nav-item {
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.nav-item:hover {
    border-color: rgba(176, 138, 58, 0.45);
}

.nav-item.active {
    border-color: var(--subura-gilt);
    box-shadow: inset 3px 0 0 var(--subura-gold);
}

.toggle-sidebar-btn {
    color: var(--subura-stage-text);
    border-radius: 0.25rem;
}

.toggle-sidebar-btn:hover {
    color: var(--subura-gold);
    background-color: rgba(217, 154, 31, 0.12);
}

.toggle-sidebar-btn:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--subura-gold);
    outline-offset: -2px;
}

/* The name as the game sets its titles: serif, spaced capitals, in gold. */
.logo-text {
    font-family: var(--subura-font);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--subura-gold);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.logo-text .logo-image {
    max-height: 28px;
    width: auto;
    display: block;
}

/* --------------------------------------------------------------------------
   Content area. The header is a slab of the game's marble with the gilt line
   under it; the sections keep their own cards, on the plaster ground.
   -------------------------------------------------------------------------- */
.main-content {
    color: var(--subura-ink);
}

.main-content > header.app-header {
    background-color: var(--subura-stone-light);
    background-image:
        linear-gradient(180deg, rgba(255, 250, 235, 0.35), transparent 60%),
        var(--subura-grain);
    border-bottom: 2px solid var(--subura-gilt);
    box-shadow: 0 2px 6px rgba(42, 32, 21, 0.25);
}

#current-section-title {
    font-family: var(--subura-font);
    color: var(--subura-title);
    letter-spacing: 0.02em;
}

.app-header-actions,
.app-header .nav-toggle-btn {
    color: var(--subura-ink);
}

.content-section {
    background-color: transparent;
}

.section-title {
    color: var(--subura-title);
    font-family: var(--subura-font);
}

/* Sections hang their modals on <body>, outside .main-content (nebula says
   why): their ink is set on the overlay itself. */
body > .fixed,
.auth-block {
    color: var(--subura-ink);
}

/* The build strip at the bottom is the stage colour, not slate. */
#versionPanel {
    background-color: var(--subura-stage-deep);
    border-top-color: var(--subura-gilt);
    color: var(--subura-stage-text);
}

/* --------------------------------------------------------------------------
   Sign-in. The page carries the shell's markup with its blue utilities; the
   window is restyled here as a marble tablet on the dark stage, the way the
   game's own lobby greets a player.
   -------------------------------------------------------------------------- */
.auth-block {
    background-color: var(--subura-stage) !important;
    background-image:
        radial-gradient(ellipse at 50% 40%, rgba(217, 154, 31, 0.10), transparent 60%),
        var(--subura-grain) !important;
}

.auth-block > div {
    background-color: var(--subura-stone-light);
    background-image:
        linear-gradient(180deg, rgba(255, 250, 235, 0.35), transparent 50%),
        var(--subura-grain);
    border: 2px solid var(--subura-gilt);
    border-radius: 0.375rem;
    box-shadow: inset 0 0 0 1px rgba(255, 250, 235, 0.5), 0 12px 30px rgba(0, 0, 0, 0.45);
}

.auth-block h3 {
    font-family: var(--subura-font);
    color: var(--subura-title);
}

.auth-block label,
.auth-block p {
    color: var(--subura-ink);
}

.auth-block input[type="text"],
.auth-block input[type="password"],
.auth-block input[type="email"],
.auth-block input[type="tel"] {
    background-color: var(--subura-parchment);
    border-color: var(--subura-stone-dark);
    color: var(--subura-ink);
}

.auth-block input:focus {
    outline: 2px solid var(--subura-gold);
    outline-offset: 0;
    box-shadow: none;
}

.auth-block .tab-button {
    color: var(--subura-muted);
    font-family: var(--subura-font);
}

.auth-block .tab-button.text-blue-600,
.auth-block .tab-button.active {
    color: var(--subura-title);
    border-bottom-color: var(--subura-terracotta);
}

.auth-block button[type="submit"] {
    background-color: var(--subura-terracotta);
    border: 1px solid var(--subura-terracotta-dark);
    color: var(--subura-parchment);
    font-family: var(--subura-font);
    letter-spacing: 0.04em;
}

.auth-block button[type="submit"]:hover {
    background-color: var(--subura-terracotta-dark);
}

.auth-block a {
    color: var(--subura-title);
}

/* The tab underline of the shell is blue; here it is the active row's
   terracotta, wherever tabs appear. */
.tab-button.active {
    border-bottom-color: var(--subura-terracotta);
    color: var(--subura-title);
}
