/* Quart — thème clair. Tokens puis mise en page ; composants dans css/components.css. */
@import url("/css/components.css");
@import url("/css/towns.css");
@import url("/css/targets.css");
@import url("/css/world.css");
@import url("/css/logs.css");
@import url("/css/guide.css");
@import url("/css/attacks.css");
@import url("/css/operations.css");

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e8ebf0;
    --line: #e3e6ea;
    --line-strong: #cfd4db;
    --text: #1a1d21;
    --muted: #5b6470;
    --accent: #4a5f7a;
    --accent-strong: #3a4c63;
    --accent-soft: #e7edf5;
    --ok: #2f7d4f;
    --ok-soft: #e4f3ea;
    --warn: #b7791f;
    --warn-soft: #fbf0dc;
    --danger: #c0392b;
    --danger-soft: #fbe6e3;
    --wood: #a67c52;
    --stone: #8a939e;
    --iron: #6b7f99;
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --r-sm: 8px;
    --r-md: 12px;
    --shadow-sm: 0 1px 2px rgba(26, 29, 33, 0.06);
    --shadow-md: 0 8px 24px rgba(26, 29, 33, 0.10);
    --shadow-lg: -8px 0 32px rgba(26, 29, 33, 0.14);
    --backdrop: rgba(26, 29, 33, 0.28);
    --rail-w: 200px;
    --drawer-w: 440px;
    --drawer-wide: 640px;
    --ease: 180ms ease;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.drawer-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--accent); }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
b, strong { font-weight: 600; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
    position: absolute;
    left: 12px;
    top: -48px;
    z-index: 50;
    padding: 8px 12px;
    background: var(--accent);
    color: var(--surface);
    border-radius: var(--r-sm);
}
.skip:focus { top: 12px; }

/* ---- Coquille ---- */
.shell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 20px 12px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mark {
    display: block;
    padding: 4px 10px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}

.rail-links { display: flex; flex-direction: column; gap: 2px; }
.rail-links a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}
.rail-links a:hover { background: var(--surface-2); color: var(--text); }
.rail-links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

.content { min-width: 0; padding: 0 32px 64px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    margin: 0 -8px 8px;
    padding-inline: 8px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 15px; }
.topbar-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.topbar-error { color: var(--danger); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.idle { background: var(--stone); }

.pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 0 2px var(--surface);
    margin-left: 2px;
}

.notices { display: grid; gap: 8px; }
.notices:empty { display: none; }
.notice {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
}
.notice.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.notice.danger { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- Pages ---- */
.page { display: grid; gap: 24px; padding-top: 12px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.block { display: grid; gap: 10px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.stack { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.section-title h2 { font-size: 16px; font-weight: 600; }
.section-title a { font-size: 13px; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.town-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }

.tab-panel { display: grid; gap: 16px; }
.tab-panel[hidden] { display: none; }

.empty { color: var(--muted); padding: 12px 0; }

/* ---- Grilles ---- */
.town-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card-skeleton { height: 150px; border-radius: var(--r-md); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .shell { display: block; }
    .rail {
        position: sticky;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 8px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        z-index: 6;
    }
    .rail-links { flex-direction: row; gap: 4px; overflow-x: auto; }
    .rail-links a { white-space: nowrap; padding: 6px 10px; }
    .content { padding: 0 14px 48px; }
    .topbar { position: static; flex-direction: column; align-items: stretch; }
    .topbar-actions { justify-content: flex-start; }
    .two-col { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: flex-start; }
    /* Les tableaux gardent leurs colonnes lisibles et défilent horizontalement. */
    .rules-table, .journal-table, .commands-table { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .rules-table .table, .journal-table .table, .commands-table .table { min-width: 720px; }
    :root { --drawer-w: 100vw; --drawer-wide: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
