/* ==========================================================================
   gribLib — "modern mycology" design system
   Layered ON TOP of Bootstrap 5 (loaded after bootstrap.min.css).
   Everything visual traces back to a token in :root — no magic values.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */

:root {
    /* Palette — calm forest */
    --moss: #2f5d3e;
    --moss-hover: #26492f;
    --moss-active: #1f3d27;
    --moss-tint: #e9f0ea;
    --moss-tint-strong: #d8e5da;
    --amber: #d9a441;
    --amber-deep: #7a5410;
    --amber-tint: #fbf3e1;
    --red: #b4433a;
    --red-hover: #9c3830;
    --red-tint: #f9edeb;
    --bg: #f7f6f2;
    --surface: #ffffff;
    --border: #e6e3dc;
    --input-border: #d8d4cc;
    --text: #1e2320;
    --text-muted: #6b7068;
    --text-faint: #9a9e96;

    /* Shape & depth */
    --radius-card: 14px;
    --radius-control: 10px;
    --radius-pill: 999px;
    --shadow-card: 0 1px 3px rgb(0 0 0 / 0.06);
    --shadow-lift: 0 8px 24px rgb(30 35 32 / 0.09);

    /* Type */
    --font-sans:
        system-ui,
        -apple-system,
        "Segoe UI",
        "Helvetica Neue",
        "Liberation Sans",
        sans-serif;

    /* Motion — GPU-composited properties only */
    --ease: 150ms ease;

    /* Bootstrap variable remapping */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-body-font-family: var(--font-sans);
    --bs-border-color: var(--border);
    --bs-link-color: var(--moss);
    --bs-link-hover-color: var(--moss-hover);
    --bs-primary: var(--moss);
}

/* ---------- 2. Base ---------- */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1600px;
}

main.container {
    flex: 1 0 auto;
    width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text);
}

h1,
.h1 {
    font-size: clamp(1.65rem, 1.35rem + 1.1vw, 2.15rem);
}

h2,
.h2 {
    font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.7rem);
}

h3,
.h3 {
    font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
}

a {
    text-decoration: none;
    transition: color var(--ease);
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

::selection {
    background: var(--moss-tint-strong);
    color: var(--text);
}

/* ---------- 3. Overline & page header ---------- */

.overline {
    display: block;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}

.page-head h1 {
    margin-bottom: 0;
}

/* ---------- 4. Navbar — translucent sticky bar ---------- */

.navbar-grib {
    background-color: rgb(255 255 255 / 0.82);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
    padding-block: 0.55rem;
}

.navbar-grib .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    padding-block: 0.35rem;
}

.navbar-grib .navbar-brand:hover {
    color: var(--moss);
    text-decoration: none;
}

.navbar-grib .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--moss-tint);
    color: var(--moss);
    flex: 0 0 auto;
}

.navbar-grib .nav-link {
    color: var(--text-muted);
    font-weight: 550;
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.9rem;
    margin-inline: 0.1rem;
    transition:
        color var(--ease),
        background-color var(--ease);
}

.navbar-grib .nav-link:hover,
.navbar-grib .nav-link:focus-visible {
    color: var(--moss);
    background-color: var(--moss-tint);
    text-decoration: none;
}

.navbar-grib .nav-link.active {
    color: var(--moss);
    background-color: var(--moss-tint-strong);
}

.navbar-grib .navbar-user {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 550;
}

.navbar-grib a.navbar-user {
    text-decoration: none;
}

.navbar-grib a.navbar-user:hover,
.navbar-grib a.navbar-user:focus-visible {
    color: var(--moss);
}

.navbar-grib .dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lift);
    padding: 0.4rem;
    margin-top: 0.5rem;
}

.navbar-grib .dropdown-item {
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    color: var(--text);
    font-weight: 500;
}

.navbar-grib .dropdown-item:hover,
.navbar-grib .dropdown-item:focus-visible {
    background-color: var(--moss-tint);
    color: var(--moss);
}

.navbar-grib .navbar-toggler {
    border-color: var(--border);
    border-radius: var(--radius-control);
}

.navbar-grib .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.22);
}

/* ---------- 5. Buttons ---------- */

.btn {
    border-radius: var(--radius-control);
    font-weight: 600;
    padding: 0.5rem 1.05rem;
    transition:
        background-color var(--ease),
        border-color var(--ease),
        color var(--ease),
        box-shadow var(--ease),
        transform var(--ease);
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.25);
}

.btn-primary {
    --bs-btn-bg: var(--moss);
    --bs-btn-border-color: var(--moss);
    --bs-btn-hover-bg: var(--moss-hover);
    --bs-btn-hover-border-color: var(--moss-hover);
    --bs-btn-active-bg: var(--moss-active);
    --bs-btn-active-border-color: var(--moss-active);
    --bs-btn-disabled-bg: var(--moss);
    --bs-btn-disabled-border-color: var(--moss);
}

.btn-outline-primary {
    --bs-btn-color: var(--moss);
    --bs-btn-border-color: var(--moss);
    --bs-btn-hover-bg: var(--moss);
    --bs-btn-hover-border-color: var(--moss);
    --bs-btn-active-bg: var(--moss-active);
    --bs-btn-active-border-color: var(--moss-active);
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--input-border);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: var(--moss-tint);
    --bs-btn-hover-border-color: var(--input-border);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--moss-tint-strong);
    --bs-btn-active-border-color: var(--input-border);
}

.btn-danger {
    --bs-btn-bg: var(--red);
    --bs-btn-border-color: var(--red);
    --bs-btn-hover-bg: var(--red-hover);
    --bs-btn-hover-border-color: var(--red-hover);
    --bs-btn-active-bg: var(--red-hover);
    --bs-btn-active-border-color: var(--red-hover);
}

.btn-outline-danger {
    /* One step darker than --red: #B4433A on the off-white bg fails AA */
    --bs-btn-color: var(--red-hover);
    --bs-btn-border-color: var(--red-hover);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--red-hover);
    --bs-btn-hover-border-color: var(--red-hover);
    --bs-btn-active-bg: var(--red-hover);
    --bs-btn-active-border-color: var(--red-hover);
}

.btn-sm {
    border-radius: 8px;
}

.btn-group {
    gap: 0.4rem;
}

.btn-group > .btn {
    border-radius: var(--radius-control) !important;
}

/* ---------- 6. Cards ---------- */

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.card-body {
    padding: 1.25rem 1.4rem;
}

/* ---------- 7. Tables — modern card table ---------- */

.table-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
    --bs-table-striped-bg: transparent;
}

.table {
    --bs-table-border-color: var(--border);
    color: var(--text);
}

.table thead th {
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    background-color: #fbfaf7;
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1.1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.85rem 1.1rem;
    border-color: var(--border);
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color var(--ease);
}

.table tbody tr:hover {
    background-color: var(--moss-tint);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table a {
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--moss-tint-strong);
    text-underline-offset: 3px;
}

.table a:hover {
    color: var(--moss);
    text-decoration-color: var(--moss);
}

/* Spores table: fixed layout with explicit widths for all six columns
   (sum = 100%). Widths are sized for the uppercase letter-spaced HEADER
   text, which needs more room than the values; headers wrap to two lines
   with hyphenation instead of bleeding into the next column. Below
   ~680px of table width the percentages stop fitting the nowrap date
   values, so the card scrolls horizontally instead of colliding. */
.table-card-scroll {
    overflow-x: auto;
}

.table-spores {
    table-layout: fixed;
    min-width: 680px;
}

.table-spores thead th {
    white-space: normal;
    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: break-word;
}

/* Widths follow the measured one-line header widths at 1440px so no
   header wraps (ФОТО included) while the tbody stays readable. */
.table-spores th:nth-child(1) {
    width: 9%;
}

.table-spores th:nth-child(2) {
    width: 11%;
}

.table-spores th:nth-child(3) {
    width: 16%;
}

.table-spores th:nth-child(4) {
    width: 14%;
}

.table-spores th:nth-child(5) {
    width: 19%;
}

.table-spores th:nth-child(6) {
    width: 11%;
}

.table-spores th:nth-child(7) {
    width: 20%;
}

.lot-thumb {
    object-fit: cover;
}

.lot-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--bs-border-radius);
    background: var(--moss-tint);
    color: var(--moss);
}

.lot-photo,
.lot-photo-current {
    object-fit: cover;
    max-width: 100%;
}

/* ---------- 8. Badges — soft pills ---------- */

.badge {
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    padding: 0.32em 0.75em;
    vertical-align: middle;
}

.badge.text-bg-success {
    background-color: var(--moss-tint-strong) !important;
    color: var(--moss-active) !important;
}

.badge.text-bg-secondary {
    background-color: #efede8 !important;
    color: var(--text-muted) !important;
}

.badge.text-bg-light {
    background-color: var(--surface) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border);
}

.badge.text-bg-warning {
    background-color: var(--amber-tint) !important;
    color: var(--amber-deep) !important;
}

.badge.text-bg-danger {
    background-color: var(--red-tint) !important;
    color: var(--red) !important;
}

/* ---------- 9. Forms ---------- */

.form-label,
.col-form-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

legend.form-label {
    font-size: 0.88rem;
}

.form-control,
.form-select {
    border: 1px solid var(--input-border);
    border-radius: var(--radius-control);
    padding: 0.55rem 0.85rem;
    color: var(--text);
    background-color: var(--surface);
    transition:
        border-color var(--ease),
        box-shadow var(--ease);
}

.form-control::placeholder {
    color: var(--text-faint);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--moss);
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.18);
    outline: 0;
}

/* Native file inputs: the "Choose file" button joins the design system */
.form-control::file-selector-button {
    background: var(--moss-tint);
    color: var(--moss);
    border: 1px solid var(--moss-tint-strong);
    border-radius: var(--radius-control);
    padding: 0.3rem 0.8rem;
    margin-right: 0.75rem;
    font-weight: 600;
    transition:
        background-color var(--ease),
        color var(--ease);
}

.form-control::file-selector-button:hover {
    background: var(--moss-tint-strong);
}

/* WebKit paints autofilled inputs grey; force them onto the design surface */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    border-color: var(--input-border);
    transition: background-color 999999s ease-in-out 0s;
}

input:-webkit-autofill:focus {
    border-color: var(--moss);
    -webkit-box-shadow:
        0 0 0 1000px var(--surface) inset,
        0 0 0 3px rgb(47 93 62 / 0.18);
}

.form-control:disabled,
.form-select:disabled {
    background-color: #f1efe9;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-check-input {
    accent-color: var(--moss);
    border-color: var(--input-border);
    width: 1.05em;
    height: 1.05em;
    margin-top: 0.18em;
}

.form-check-input:checked {
    background-color: var(--moss);
    border-color: var(--moss);
}

.form-check-input:focus {
    border-color: var(--moss);
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.18);
}

.form-check-label {
    font-weight: 500;
    color: var(--text);
}

.text-danger {
    color: var(--red) !important;
    font-size: 0.85rem;
}

/* Date-range multiwidgets render adjacent inputs */
.form-control + .form-control {
    margin-top: 0.5rem;
}

/* CheckboxSelectMultiple renders as nested <div>s; the group container
   carries the widget's class (checkbox-list), inherited by its inputs. */
form div.checkbox-list {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0;
}

form div.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

form div.checkbox-list input[type="checkbox"] {
    accent-color: var(--moss);
    width: 1.05em;
    height: 1.05em;
    margin: 0;
    flex: 0 0 auto;
}

/* CKEditor 5 wrapper matches the control styling */
.ck-editor {
    border-radius: var(--radius-control);
    overflow: hidden;
}

.ck.ck-editor__main > .ck-editor__editable {
    background-color: var(--surface);
    min-height: 220px;
}

.ck.ck-editor__main > .ck-editor__editable:focus {
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.18);
}

/* ---------- 10. Filter sidebar ---------- */

.filter-card {
    position: sticky;
    top: 84px;
}

.filter-card .card-body {
    padding: 1.15rem 1.25rem;
}

/* ---------- 11. Pagination — pills ---------- */

.pagination {
    gap: 0.35rem;
    margin-top: 1.5rem;
}

.page-item .page-link {
    border: 1px solid var(--border);
    border-radius: var(--radius-pill) !important;
    background-color: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.42rem 0.95rem;
    transition:
        background-color var(--ease),
        color var(--ease),
        border-color var(--ease);
}

.page-item .page-link:hover {
    background-color: var(--moss-tint);
    color: var(--moss);
    border-color: var(--moss-tint-strong);
}

.page-item.active .page-link {
    background-color: var(--moss);
    border-color: var(--moss);
    color: #fff;
}

.page-item.disabled .page-link {
    background-color: transparent;
    color: var(--text-faint);
    border-color: var(--border);
}

.page-link:focus {
    box-shadow: 0 0 0 3px rgb(47 93 62 / 0.18);
}

/* ---------- 12. Alerts & flash messages ---------- */

.messages-container {
    padding-top: 1.25rem;
}

.alert {
    border-radius: var(--radius-card);
    border: 1px solid transparent;
    font-weight: 500;
    padding: 0.8rem 1.1rem;
}

.alert-success {
    background-color: var(--moss-tint);
    border-color: var(--moss-tint-strong);
    color: var(--moss-active);
}

.alert-info {
    background-color: #eef1f4;
    border-color: #dde3e8;
    color: #3d5568;
}

.alert-warning {
    background-color: var(--amber-tint);
    border-color: #f0e2bf;
    color: var(--amber-deep);
}

.alert-danger,
.alert-error {
    background-color: var(--red-tint);
    border-color: #eccfcb;
    color: var(--red);
}

.alert .btn-close {
    font-size: 0.75rem;
}

/* ---------- 13. Login page ---------- */

body.auth-page {
    background:
        radial-gradient(1100px 600px at 18% -10%, var(--moss-tint) 0%, transparent 55%),
        radial-gradient(900px 550px at 105% 110%, var(--amber-tint) 0%, transparent 50%),
        var(--bg);
}

body.auth-page main.container {
    display: flex;
    flex-direction: column;
}

.auth-screen {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lift);
    padding: 2.1rem 2rem 2rem;
}

.auth-card .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--moss-tint);
    color: var(--moss);
    margin-bottom: 1rem;
}

.auth-card h1 {
    font-size: 1.45rem;
    margin-bottom: 0.25rem;
}

.auth-card .auth-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1.4rem;
}

/* ---------- 14. Dashboard (index) ---------- */

.dash-hero {
    padding: 1.5rem 0 0.5rem;
}

.dash-card {
    display: block;
    height: 100%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.5rem 1.5rem 1.35rem;
    color: var(--text);
    transition:
        box-shadow var(--ease),
        transform var(--ease),
        border-color var(--ease);
}

.dash-card:hover {
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
    border-color: var(--moss-tint-strong);
    text-decoration: none;
    color: var(--text);
}

.dash-card .dash-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--moss-tint);
    color: var(--moss);
    margin-bottom: 1rem;
}

.dash-card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}

.dash-card p {
    color: var(--text-muted);
    font-size: 0.94rem;
    margin-bottom: 0;
}

/* ---------- 15. Article (post detail) ---------- */

.article-head {
    margin-bottom: 1.5rem;
}

.article-head h1 {
    margin-bottom: 0.4rem;
}

.meta-line {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.post-body {
    font-size: 1.03rem;
    line-height: 1.75;
    max-width: 72ch;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-control);
}

.post-body blockquote {
    border-left: 3px solid var(--moss-tint-strong);
    padding-left: 1rem;
    color: var(--text-muted);
    margin: 1.25rem 0;
}

.post-body h2,
.post-body h3,
.post-body h4 {
    margin-top: 1.6em;
}

/* Image grid — rounded thumbs, subtle hover zoom */
.image-grid .card {
    overflow: hidden;
    transition:
        box-shadow var(--ease),
        transform var(--ease);
}

.image-grid .card:hover {
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}

.image-grid .thumb {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.image-grid .thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform 300ms ease;
}

.image-grid .thumb.rounded {
    border-radius: var(--radius-control);
}

.image-grid .card:hover .thumb img {
    transform: scale(1.04);
}

/* ---------- 16. Comments — timeline cards ---------- */

.comment-thread {
    position: relative;
    margin-left: 0.5rem;
    padding-left: 1.4rem;
    border-left: 2px solid var(--moss-tint-strong);
    display: grid;
    gap: 1rem;
}

.comment-item {
    position: relative;
}

.comment-item::before {
    content: "";
    position: absolute;
    left: calc(-1.4rem - 6px);
    top: 1.6rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--surface);
    border: 2px solid var(--moss);
}

.comment-item .card {
    box-shadow: none;
}

.comment-author {
    font-weight: 650;
}

.comment-date {
    color: var(--text-faint);
    font-size: 0.85rem;
}

/* ---------- 17. Definition list (detail pages) ---------- */

.dl-card dt {
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-top: 0.55rem;
}

.dl-card dd {
    padding-top: 0.55rem;
    margin-bottom: 0.35rem;
}

/* ---------- 18. Empty states ---------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--input-border);
    border-radius: var(--radius-card);
    background-color: var(--surface);
    color: var(--text-muted);
}

.empty-state svg {
    color: var(--text-faint);
}

.empty-state p {
    margin-bottom: 0;
    font-weight: 550;
}

/* ---------- 19. Delete confirmation ---------- */

.confirm-card {
    max-width: 560px;
    margin: 2rem auto 0;
    text-align: center;
    padding: 2rem 1.8rem;
}

.confirm-card .confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--red-tint);
    color: var(--red);
    margin-bottom: 1rem;
}

/* ---------- 20. Misc ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-weight: 550;
    font-size: 0.92rem;
}

.back-link:hover {
    color: var(--moss);
}

/* ---------- 21. Lightbox ---------- */

[data-lightbox-group] {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 24, 20, 0.92);
    opacity: 1;
    transition: opacity var(--ease);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    max-width: 92vw;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius-control);
}

.lightbox-caption {
    color: rgb(255 255 255 / 0.85);
    font-size: 0.95rem;
    text-align: center;
}

.lightbox-counter {
    position: absolute;
    top: 1rem;
    right: 4.5rem;
    color: rgb(255 255 255 / 0.75);
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: rgb(255 255 255 / 0.08);
    color: rgb(255 255 255 / 0.9);
    transition: background-color var(--ease);
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgb(255 255 255 / 0.2);
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-counter[hidden],
.lightbox-close[hidden],
.lightbox-nav[hidden],
.lightbox-caption[hidden] {
    display: none;
}

/* ---------- 22. Icon action buttons ---------- */

.action-cell {
    width: 90px;
}

.action-buttons {
    display: inline-flex;
    gap: 0.375rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
}

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