/* The site's look: the shapes of a Dominions screen in quieter colours.
   Loaded after styles.css, which holds the layout; this file only dresses it.

   A charcoal panel in a rounded stone frame, the page title in Black
   Chancery on a stone tab, a deep-olive painted backdrop. Colour means one
   thing each: gold is a link you follow, wine is something to act on, stone
   is structure.

   None of it is Illwinter's art. The textures in theme/ are painted from
   noise by scripts/make_theme_art.py, everything else is CSS, and the
   heading font is Black Chancery, which is public domain. Body text uses
   the visitor's own serif. Keep it that way: game files must not be served
   here without Illwinter's permission. */

@font-face {
    font-family: 'Black Chancery';
    src: url(theme/fonts/BlackChancery.ttf) format('truetype');
    font-display: swap;
}

:root {
    --panel: #1a191b;
    --stone: #9d937f;
    --stone-light: #b9af9a;
    --stone-dark: #736a59;
    --stone-ink: #1f1a13;
    --stone-line: rgba(157, 147, 127, .4);
    --note: #261c1b;
    --wine: #5c2925;
    --wine-light: #733630;
    --wine-edge: #2a1512;
    --salmon: #8a372e;
    --seal: #a8402f;
    --cream: #ebe5d6;
    --gold: #dcc089;
    --gold-light: #f3e2b8;
    --gold-deep: #a98f58;

    --ink: var(--cream);
    --ink-soft: #b5ae9f;
    --bone: var(--cream);
    --label: #d3ccbd;

    /* The frame, as a border image: the wide one for panels, the thin one
       for the small cards a phone shows. */
    --frame: url(theme/frame.webp) 16 / 16px round;
    --frame-thin: url(theme/frame-thin.webp) 10 / 10px round;
    --frame-shadow: drop-shadow(0 6px 10px rgba(0, 0, 0, .55));
    --emboss: 0 1px 0 rgba(255, 250, 235, .4);

    /* The site's own colour names, pointed at the theme. */
    --discord-blue: var(--gold);
    --discord-grey: #a39c8d;
    --discord-dark: #12100d;
    --discord-light: #2a241c;
    --background-color: #111;
}

html {
    background-color: #1a1f12;
}

/* The backdrop - olive paint under a vignette - is its own fixed layer
   behind the page, not the body's background with
   `background-attachment: fixed`, which phones can't scroll smoothly: the
   whole background is repainted every frame. As a fixed layer it is painted
   once and only moved. */
body {
    background: none;
    color: var(--label);
    font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
    font-size: 1.05rem;
    text-shadow: none;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Tall enough for when a phone's address bar slides away. */
    height: 100vh;
    height: 100lvh;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, .5) 100%),
        #262d1a url(theme/backdrop.webp) repeat;
    will-change: transform;
}

a {
    color: var(--gold);
}

/* Top bar: charcoal over a stone rule, cream lettering, gold for the open
   page. */
.modern-nav {
    background: linear-gradient(#242326, #161517);
    border-bottom: 3px solid var(--stone);
    box-shadow: 0 1px 0 #26221c, 0 6px 14px rgba(0, 0, 0, .5);
    position: relative;
    z-index: 1;
}

.modern-nav .nav-brand {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 1.7rem;
    color: var(--cream);
    line-height: 1;
}

.modern-nav a,
.nav-logout button {
    font-family: 'Black Chancery', serif;
    font-size: 1.2rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--cream);
    text-shadow: none;
}

.modern-nav-links a.nav-discord {
    color: var(--cream);
}

.modern-nav .nav-brand:hover,
.modern-nav .nav-brand:focus,
.modern-nav-links a:hover,
.modern-nav-links a.nav-discord:hover,
.modern-nav-links a.nav-discord:focus,
.nav-account a:hover,
.nav-logout button:hover,
.nav-logout button:focus {
    color: var(--gold);
}

.modern-nav-links a[aria-current="page"] {
    color: var(--gold);
    border-bottom-color: var(--gold-deep);
}

.nav-account {
    border-left-color: rgba(157, 147, 127, .45);
}

.nav-user {
    font-style: italic;
    color: var(--cream);
}

.site-footer {
    background: var(--panel);
    border-top: 3px solid var(--stone);
    box-shadow: 0 -1px 0 #2e281f;
    color: var(--discord-grey);
    font-family: inherit;
    font-size: 0.95rem;
}

.site-footer a {
    color: var(--gold);
}

.site-footer a:hover,
.site-footer a:focus {
    color: var(--gold-light);
}

/* Page title: Black Chancery in dark ink on a stone tab, which stands on a
   stone rule that fades out at the ends, as the game's title tabs stand on
   their frames. The tab and the rule are layers behind the lettering. */
.page-heading,
body.donate h2 {
    position: relative;
    z-index: 0;
    display: table;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 26px;
    padding: 5px 52px 3px;
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 2.3rem;
    color: var(--stone-ink);
    text-shadow: var(--emboss);
}

.page-heading::before,
body.donate h2::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(var(--stone-light), var(--stone) 40%, var(--stone-dark));
    clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 100%, 0 100%);
}

.page-heading::after,
body.donate h2::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: min(88vw, 860px);
    height: 3px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(157, 147, 127, 0), var(--stone) 18%, var(--stone) 82%, rgba(157, 147, 127, 0));
}

/* Lines that sit straight on the backdrop. */
.turn-summary,
.fair-example,
.servers-empty,
.last-updated {
    color: var(--cream);
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, .9);
}

.turn-summary {
    font-size: 1.15rem;
}

/* Notes, the home page's pitch and errors each have a layer behind the
   content that draws their box. */
.info-panel,
.home-hero,
.error-container {
    position: relative;
    isolation: isolate;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--ink);
}

.info-panel::before,
.home-hero::before,
.error-container::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* Notes read as prose: left-aligned, a comfortable measure, one size down,
   in a quiet box with a wine edge so it doesn't outweigh the data below. */
.info-panel {
    padding: 20px 30px 20px 34px;
    text-align: left;
    font-size: 1rem;
}

.info-panel::before {
    background: var(--note);
    border: 1px solid rgba(157, 147, 127, .28);
    border-left: 4px solid var(--wine);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
}

.info-panel p {
    color: var(--ink);
    text-align: left;
    font-size: .98rem;
    line-height: 1.6;
    max-width: 74ch;
}

.info-panel a {
    color: var(--gold);
    font-weight: bold;
}

/* The home page's pitch and an error are dialogs: charcoal in the frame. */
.home-hero,
.error-container {
    filter: var(--frame-shadow);
}

.home-hero::before,
.error-container::before {
    background: var(--panel);
    background-clip: padding-box;
    border: 16px solid transparent;
    border-image: var(--frame);
}

.error-container h1 {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 2.8rem;
    color: var(--cream);
}

/* Data sits on charcoal in the stone frame. */
.table-container > .table-responsive,
.tab-pane > .table-responsive,
body.donate .card,
body.donate .card.bg-dark {
    background: var(--panel) !important;
    background-clip: padding-box !important;
    border: 16px solid transparent;
    border-image: var(--frame);
    border-radius: 0;
    box-shadow: none;
    filter: var(--frame-shadow);
    padding: 2px 6px 6px;
}

.table {
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* Rows are barely striped, and warm to wine under the pointer. */
.table-container .table.table-dark {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 245, 225, .035);
    --bs-table-striped-color: var(--label);
    --bs-table-hover-bg: rgba(92, 41, 37, .55);
    --bs-table-hover-color: #fff;
    border-color: rgba(157, 147, 127, .14);
    color: var(--label);
}

.table-container .table thead {
    background: none !important;
}

/* Column headers: small capitals in the reading face, on a wine bar. Black
   Chancery is kept for titles, where it has room. */
.table-container .table.table-dark thead th {
    background: var(--wine);
    color: #f2e8d5;
    font-family: inherit;
    font-size: .74rem;
    font-weight: bold;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    padding-top: 9px;
    padding-bottom: 8px;
    border-bottom: 4px solid var(--panel);
}

.table-container .table.table-dark td {
    font-variant-numeric: lining-nums tabular-nums;
}

/* My games */
.games-table tbody tr.needs-turn > td:first-child {
    box-shadow: inset 4px 0 0 var(--seal);
}

.game-title a {
    color: var(--gold);
    font-size: 1.1rem;
}

.game-title a:hover,
.game-title a:focus {
    color: var(--gold-light);
}

.turn-badge,
.host-log-tag {
    background: var(--salmon);
    color: #f6ead6;
    border: 1px solid var(--wine-edge);
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 220, 200, .2);
}

.turn-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 8px 1px 5px;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: .3px;
}

/* A plain wax-seal dot. */
.turn-badge::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e0583f, #8e1d0f 60%, #4d0b05);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(0, 0, 0, .15);
}

.your-nation {
    color: var(--bone);
    font-style: italic;
}

/* Smaller, secondary actions are stone, not gold. */
.link-button {
    color: var(--stone-light);
    font-family: inherit;
}

.link-button:hover,
.link-button:focus-visible {
    color: var(--cream);
}

.nation-list {
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(185, 171, 143, .35);
    border-radius: 2px;
    font-size: 0.95rem;
}

.nation-list .nation-name {
    color: var(--bone);
}

.you-tag {
    background: var(--gold-deep);
    color: #1b150b;
    border-radius: 2px;
    font-weight: bold;
}

.countdown {
    color: var(--bone);
}

.status-key {
    color: var(--discord-grey);
    font-size: 0.9rem;
    margin-top: 12px;
}

.loader {
    border-color: var(--stone-line);
    border-top-color: var(--gold);
}

/* Nation winrates. The era switch is a row of tabs on a stone rule: the
   open one is stone, the others dark with cream lettering. */
.era-tabs {
    border-bottom: 3px solid var(--stone);
    gap: 4px;
}

.era-tabs .nav-link {
    background: #232225;
    color: var(--label);
    border: none;
    box-shadow: inset 0 0 0 1px rgba(157, 147, 127, .45);
    padding: 4px 26px 2px;
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%);
    font-family: 'Black Chancery', serif;
    font-size: 1.3rem;
}

.era-tabs .nav-link:hover,
.era-tabs .nav-link:focus {
    color: #fff;
}

.era-tabs .nav-link.active {
    background: linear-gradient(var(--stone-light), var(--stone));
    color: var(--stone-ink);
    text-shadow: var(--emboss);
    box-shadow: none;
}

.stats-table > tbody > tr > td:first-child,
.nation-short {
    color: var(--bone);
}

.nation-epithet {
    color: #948d7f;
    font-style: italic;
}

.fair-bar::before {
    background-color: rgba(255, 255, 255, .55);
}

.fair-level {
    background-color: #7d7466;
}

/* Logged-out home page: the whole pitch in one framed dialog */
.home-hero {
    margin-top: 24px;
    padding: 44px 56px 48px;
}

.home-hero h1 {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 4rem;
    line-height: 1;
    color: var(--cream);
}

.home-tagline {
    color: var(--ink);
    font-size: 1.25rem;
}

.home-note {
    color: var(--ink-soft);
    font-style: italic;
}

.home-hero .home-secondary-link,
.home-join a {
    color: var(--gold);
    font-weight: bold;
}

.home-hero .home-secondary-link:hover,
.home-hero .home-secondary-link:focus {
    color: #fff;
}

/* Buttons: wine with cream Chancery lettering, the frame's own corner, and
   a lit top edge so they look raised. */
.button-primary,
body.donate .donate-link,
.join-copy {
    background: var(--wine);
    color: var(--cream);
    border: 1px solid var(--wine-edge);
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 220, 200, .22), 0 0 0 1px var(--stone-dark), 0 3px 8px rgba(0, 0, 0, .5);
    font-family: 'Black Chancery', serif;
    font-size: 1.35rem;
    text-shadow: none;
}

.button-primary:hover,
.button-primary:focus,
body.donate .donate-link:hover,
body.donate .donate-link:focus,
.join-copy:hover,
.join-copy:focus {
    background: var(--wine-light);
    color: #fff;
}

/* Donate */
body.donate {
    color: var(--label);
    font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}

body.donate .card-title {
    font-family: 'Black Chancery', serif;
    font-size: 1.5rem;
    color: var(--gold);
}

body.donate .card-text {
    color: var(--label);
}

.highlight-text {
    color: var(--gold);
}

/* Flash messages */
.flash-message {
    background: var(--panel);
    border: 1px solid var(--stone-dark);
    border-left: 4px solid var(--stone);
    color: var(--bone);
}

.flash-error {
    border-left-color: var(--seal);
}

/* Join page: the framed dialog, with the address set in a dark well */
.join-panel h1.join-title {
    font-size: 3rem;
}

.join-manual {
    border-top: 1px solid var(--stone-line);
    padding-top: 18px;
}

.join-manual h2 {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    color: var(--cream);
}

.join-address {
    color: var(--ink);
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--stone-dark);
    border-radius: 3px;
}

.join-copy {
    font-size: 1.1rem;
}

/* Envoy's servers: the capacity bar is gold, or the seal's red when the
   servers are full. */
.capacity-panel .capacity-headline {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 1.6rem;
    color: var(--gold);
}

.capacity-bar {
    background-color: rgba(0, 0, 0, .35);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6);
}

.capacity-fill {
    background-color: var(--gold-deep);
}

.capacity-full {
    background-color: var(--seal);
}

.capacity-panel .capacity-paused {
    color: var(--gold);
    font-weight: bold;
}

.servers-table > tbody > tr > td.server-game {
    color: var(--bone);
}

.servers-table > tbody > tr > td.server-game a {
    color: var(--gold);
    text-decoration: none;
}

.servers-table > tbody > tr > td.server-game a:hover,
.servers-table > tbody > tr > td.server-game a:focus {
    color: var(--gold-light);
    text-decoration: underline;
}

/* My games: the server mark in the meta line, Launch in gold */
.server-tag {
    color: var(--bone);
}

.launch-link {
    color: var(--gold);
}

.launch-link:hover,
.launch-link:focus {
    color: var(--gold-light);
}

/* One game's page: facts in the note, the tables as on the servers page */
.server-game-facts dt {
    color: var(--ink-soft);
}

.server-game-facts dd,
.server-game-facts .countdown,
.server-game-facts .deadline {
    color: var(--ink);
}

.server-game-section {
    font-family: 'Black Chancery', serif;
    color: var(--gold);
}

.server-nation {
    color: var(--bone);
}

.host-log-failed .host-log-when,
.host-log-failed td {
    opacity: 0.85;
}

/* A server game's More time and Server controls panels. Everything stacks and
   wraps, so the page fits a 360px phone without scrolling sideways. */
.action-panels {
    display: grid;
    gap: 1rem;
    max-width: 44rem;
    margin: 1.5rem auto;
    min-width: 0;
}

.action-panel,
.action-result {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.action-result {
    max-width: 44rem;
    margin: 1.5rem auto 0;
}

.action-panel-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.action-buttons .btn {
    min-height: 44px;
    white-space: normal;
}

.action-form {
    margin-top: 0.75rem;
}

.action-form summary {
    cursor: pointer;
    min-height: 44px;
    padding: 0.6rem 0;
    font-weight: 600;
}

.action-form label {
    display: block;
    margin: 0.75rem 0 0.25rem;
}

.action-form .form-control {
    width: 100%;
    max-width: 100%;
    /* 16px stops phones zooming in on the field. */
    font-size: 1rem;
}

.action-form .form-control::placeholder {
    font-size: 0.875rem;
}

.action-form .btn {
    min-height: 44px;
    margin-top: 0.75rem;
    white-space: normal;
}

.action-ask-reason {
    margin: 0.75rem 0;
    padding-left: 0.75rem;
    border-left: 3px solid currentColor;
    white-space: pre-line;
}

.action-note,
.action-warning {
    margin: 0.5rem 0;
    font-weight: 600;
}

.action-result-ok {
    border-left: 4px solid #4f9d69;
}

.action-result-refused {
    border-left: 4px solid #c9553f;
}

.action-hint {
    display: block;
    margin-top: 0.25rem;
}

/* A form that is always open, and the tables beside it. */
.control-form {
    margin-top: 0;
}

.control-details {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.control-detail + .control-detail {
    margin-top: 0.5rem;
}

/* Two small number boxes, each inside its sentence: "At least [ ] wins". */
.control-limits label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-form .control-limits .form-control {
    width: 6.5rem;
}

.control-table form {
    margin: 0;
}

.control-table td {
    vertical-align: middle;
}

/* Help: each card and the article are small charcoal dialogs in the thin
   frame; the contents list is a quiet box beside them. */
.help-card,
.help-article {
    background: var(--panel);
    background-clip: padding-box;
    border: 10px solid transparent;
    border-image: var(--frame-thin);
    border-radius: 0;
    color: var(--cream);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5));
}

.help-contents {
    background-color: var(--panel);
    border: 1px solid var(--stone-line);
    border-radius: 6px;
}

.help-card h3,
.help-article h2 {
    font-family: 'Black Chancery', serif;
    font-weight: normal;
    font-size: 1.6rem;
}

.help-article h3 {
    color: var(--cream);
}

.help-section + .help-section,
.help-intro + .help-section {
    border-top-color: rgba(157, 147, 127, .28);
}

.help-article code {
    background-color: rgba(0, 0, 0, .4);
    color: var(--gold-light);
}

.help-ask {
    color: var(--cream);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, .9);
}

/* The notice in the corner */
.site-toast {
    background: var(--panel);
    border: 1px solid var(--stone-dark);
    border-left: 4px solid var(--gold-deep);
    color: var(--bone);
}

.site-toast-title {
    color: var(--gold);
}

.site-toast a {
    color: var(--gold);
    text-decoration: underline;
}

.site-toast a:hover,
.site-toast a:focus {
    color: var(--gold-light);
}

.site-toast-close {
    color: var(--label);
}

.site-toast-close:hover,
.site-toast-close:focus {
    color: var(--gold);
}

@media (max-width: 768px) {
    /* On phones each game is its own small dialog, in the thin frame. */
    .table-container > .table-responsive {
        background: none !important;
        border: none;
        border-image: none;
        filter: none;
        padding: 0;
    }

    .games-table tbody tr,
    .servers-table tbody tr,
    .server-nations-table tbody tr,
    .host-log-table tbody tr {
        background: var(--panel);
        background-clip: padding-box;
        border: 10px solid transparent;
        border-image: var(--frame-thin);
        border-radius: 0;
        box-shadow: none;
        margin-bottom: 12px;
    }

    .games-table tbody tr.needs-turn {
        box-shadow: inset 5px 0 0 var(--seal);
    }

    .status-key {
        background: var(--panel);
        border: 1px solid var(--stone-dark);
        padding: 8px;
    }

    .tab-pane > .table-responsive {
        border: 10px solid transparent;
        border-image: var(--frame-thin);
        padding: 0;
    }

    /* Smaller headers that may wrap, so the winrates table fits without
       scrolling sideways. */
    .table-container .table.table-dark.stats-table thead th {
        font-size: .72rem;
        letter-spacing: .05em;
        line-height: 1.1;
        white-space: normal;
        vertical-align: bottom;
    }

    .page-heading,
    body.donate h2 {
        font-size: 1.8rem;
        padding: 4px 34px 2px;
        margin-bottom: 22px;
    }

    .era-tabs .nav-link {
        padding: 4px 16px 2px;
    }

    .home-hero {
        padding: 36px 28px 40px;
    }

    .home-hero h1 {
        font-size: 3.2rem;
    }

    .info-panel {
        padding: 16px 18px 16px 20px;
    }
}

@media (max-width: 600px) {
    .join-panel h1.join-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 576px) {
    .modern-nav .nav-brand {
        font-size: 1.4rem;
    }

    .modern-nav a,
    .nav-logout button {
        font-size: 1.02rem;
    }

    .era-tabs .nav-link {
        font-size: 1.1rem;
    }
}

/* Phones: with several pages in the top bar, tighter spacing keeps it
   narrow. */
@media (max-width: 400px) {
    .nav-inner {
        gap: 6px;
        padding: 0 10px;
    }

    .modern-nav-links,
    .nav-account {
        gap: 6px;
    }

    .nav-account {
        padding-left: 8px;
    }

    .modern-nav a,
    .nav-logout button {
        font-size: 0.95rem;
    }
}

/* The smallest phones: a slimmer bar so the winrates table fits. */
@media (max-width: 359.98px) {
    .fair-bar {
        width: 44px;
        margin-right: 4px;
    }
}
