:root {
    --brand: #4f6fd8;
    --brand-dark: #3a55b5;
    --brand-light: #7cc0f0;
    --ink: #2b303b;
    --muted: #5d6474;
    --line: #e2e6ee;
    --bg: #f5f7fb;
    --card: #fff;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand-dark); }
a:hover { color: var(--brand); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.skip {
    position: absolute; left: -9999px; top: 8px;
    background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 10;
}
.skip:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--brand-light); outline-offset: 2px; }

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 28px 0 22px;
    text-align: center;
}
.logo { display: inline-block; }
.logo img { display: block; margin: 0 auto 14px; width: 300px; max-width: 80vw; height: auto; }
.site-header h1 { margin: 0 0 10px; font-size: 2.125rem; line-height: 1.2; letter-spacing: -.01em; color: var(--brand); }
.lede { max-width: 720px; margin: 0 auto 14px; color: var(--muted); text-wrap: balance; }
.lede + .lede { margin-top: -6px; }
.lede:last-child { margin-bottom: 0; }

/* Filters */
.filters {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin: 24px 0 12px;
}
.ranges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
    font: inherit; font-size: .875rem; cursor: pointer;
    padding: 5px 12px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--bg); color: var(--ink);
    text-decoration: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select {
    font: inherit; font-size: .95rem; width: 100%;
    padding: 8px 10px; border: 1px solid #cdd3de; border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(79, 111, 216, .2); }
.dates { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dates[hidden] { display: none; }
.actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

.btn {
    font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
    display: inline-block; padding: 8px 18px; border-radius: 8px;
    border: 1px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-quiet { background: transparent; color: var(--brand-dark); border-color: var(--line); }
.btn-quiet:hover { background: var(--bg); color: var(--brand-dark); border-color: var(--brand); }

.summary { color: var(--muted); font-size: .95rem; margin: 16px 2px; min-height: 1em; }
.summary:focus { outline: none; }

/* Updates */
.update {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    scroll-margin-top: 16px;
}
.update.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79, 111, 216, .25), var(--shadow); }
.update-head {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px 16px;
    padding: 14px 20px;
    background: linear-gradient(90deg, #eef2fd, #eef7fd);
    border-bottom: 1px solid var(--line);
}
.update-head h2 { margin: 0; font-size: 1.15rem; }
.toggle {
    font: inherit; color: var(--ink); background: none; border: 0; padding: 0; margin: 0;
    cursor: pointer; text-align: left;
}
.toggle:hover { color: var(--brand-dark); }
.js .update-head { cursor: pointer; user-select: none; }
.js .update-head:hover { background: linear-gradient(90deg, #e6ecfc, #e6f3fc); }
.title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.title .current-badge { font-size: .68rem; }
.when { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.3; }
.head-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.count { font-size: .8rem; color: var(--muted); }
.chevron { display: none; }
.js .chevron {
    display: block;
    width: 9px; height: 9px; margin: -4px 2px 0 4px;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(45deg); transition: transform .15s ease;
}
.update.is-collapsed .chevron { transform: rotate(-45deg); margin-top: 0; }
.update.is-collapsed .update-head { border-bottom: 0; }
.update.is-collapsed { margin-bottom: 10px; }
.update.is-collapsed .items { display: none; }

.summary-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 16px 2px; }
.summary-row .summary { margin: 0; }
.expand-all { display: flex; gap: 16px; font-size: .9rem; }
.expand-all[hidden] { display: none; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--brand-dark); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.update-head time { color: var(--muted); }
.version { font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.current-badge {
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    background: var(--brand); color: #fff; padding: 2px 8px; border-radius: 999px;
}

.items { list-style: none; margin: 0; padding: 0; }
.item {
    display: grid; grid-template-columns: 1fr 190px; gap: 8px 24px;
    padding: 16px 20px;
    border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item-body { min-width: 0; overflow-wrap: anywhere; }
.item-body > :first-child { margin-top: 0; }
.item-body > :last-child { margin-bottom: 0; }
.item-body b, .item-body strong { color: #1d2230; }
.item-body ul, .item-body ol { margin: .6em 0 .6em 1em; padding-left: 1.25em; }
.item-body li { margin: .25em 0; padding-left: .25em; }
.item-body ul { list-style: none; padding-left: 1.1em; }
.item-body ul > li { position: relative; }
.item-body ul > li::before {
    content: ""; position: absolute; left: -1em; top: .6em;
    box-sizing: border-box; width: 6px; height: 6px; border-radius: 50%;
    background: var(--brand);
}
.item-body ul ul > li::before { background: transparent; border: 1.5px solid var(--brand); }
.item-body ol > li::marker { color: var(--brand); font-weight: 600; }
.item-body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; }
.item-body iframe { max-width: 100%; }
.item-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

.tag {
    display: inline-block; font-size: .8rem; line-height: 1.3;
    padding: 3px 9px; border-radius: 6px;
    background: #f0f2f6; color: var(--muted);
}
.type { font-weight: 600; }
.type-module   { background: #efe7fd; color: #5b33a8; }
.type-feature  { background: #e5f5ec; color: #1f7a45; }
.type-enhance  { background: #e6effd; color: #2c55a8; }
.type-fix      { background: #fdefe3; color: #a2501b; }
.type-minor    { background: #f0f2f6; color: #4d5566; }
.type-redesign { background: #e3f6f7; color: #16717a; }
.type-misc     { background: #f0f2f6; color: #4d5566; }

mark { background: #fff1a8; color: inherit; border-radius: 2px; padding: 0 1px; }

.empty {
    text-align: center; padding: 40px 20px;
    background: var(--card); border: 1px dashed #cdd3de; border-radius: var(--radius);
}
.empty h2 { margin: 0 0 6px; font-size: 1.2rem; }
.empty p { margin: 0 0 16px; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 8px 0 32px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 20px 0; text-align: center; font-size: .9rem; }

.to-top {
    position: fixed; right: 16px; bottom: 16px;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand); color: #fff; text-decoration: none; font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(20, 30, 60, .2);
}
.to-top:hover { background: var(--brand-dark); color: #fff; }
.to-top[hidden] { display: none; }

@media (max-width: 720px) {
    .site-header { padding: 20px 0 16px; }
    .site-header h1 { font-size: 1.75rem; }
    .fields { grid-template-columns: 1fr 1fr; }
    .field-search { grid-column: 1 / -1; }
    .actions .btn { flex: 1; text-align: center; }
    .item { grid-template-columns: 1fr; padding: 14px 16px; }
    .item-meta { flex-direction: row; flex-wrap: wrap; }
    .update-head { padding: 12px 16px; }
    /* Phones: title and arrow on the first line, date, version and badge wrap below. */
    .update-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
    .title, .when, .head-end { display: contents; }
    .update-head h2 { flex: 1 0 calc(100% - 40px); }
    .js .chevron { align-self: center; }
    .update-head time, .count, .version, .current-badge { order: 2; }
}

@media print {
    body { background: #fff; }
    .filters, .to-top, .pager, .skip, .expand-all, .chevron { display: none !important; }
    .update.is-collapsed .items { display: block; }
    .update { box-shadow: none; break-inside: avoid-page; }
}

/* Reviewer preview of an unpublished update (index.php?preview=N) */
.preview-banner {
    margin: 24px 0 0; padding: 12px 16px; border-radius: var(--radius);
    background: #fdf4de; border: 1px solid #f1dca8; color: #6b4600;
}
.preview-banner a { margin-left: 8px; font-weight: 600; color: #6b4600; }
