/* SWORDEX SECURITY administration: custom CSS in the Heritage theme (navy, gold, ivory). */
@import '@fontsource-variable/inter';
@import '@fontsource-variable/cormorant/wght.css';
@import '@fontsource-variable/cormorant/wght-italic.css';

:root {
    --navy: #030164;
    --navy-2: #02014a;
    --indigo: #363199;
    --steel: #226079;
    --gold: #e8e085;
    --brass: #ad9b3c;
    --ivory: #f8f5ee;
    --ivory-2: #f0ebdd;
    --ink: #0c0d2e;
    --ink-soft: #4b4d6e;
    --hair: #ddd6c3;
    --red: #9b1c1c;
    --display: 'Cormorant Variable', Georgia, serif;
    --body: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --side: 272px;
    --top: 64px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
[hidden] {
    display: none !important;
}
body {
    margin: 0;
    font-family: var(--body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--ivory);
    overflow-wrap: anywhere;
}
h1,
h2 {
    font-family: var(--display);
    font-weight: 500;
    line-height: 1.1;
    color: var(--navy);
    margin: 0;
}
h1 {
    font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
}
h1 em {
    color: var(--indigo);
}
a {
    color: var(--indigo);
}
ol,
ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}
.skip {
    position: absolute;
    left: -9999px;
}
.skip:focus {
    left: 8px;
    top: 8px;
    z-index: 60;
    background: var(--gold);
    padding: 0.5rem 1rem;
}

/* ---------- Buttons and inputs ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.65rem 1.4rem;
    border: 1px solid transparent;
    border-radius: 0;
    font: 600 0.74rem/1.2 var(--body);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.btn:disabled {
    opacity: 0.45;
    cursor: default;
}
.btn-gold {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--brass);
}
.btn-gold:hover:not(:disabled) {
    background: var(--navy);
    color: var(--gold);
}
.btn-outline {
    background: transparent;
    color: var(--navy);
    border-color: var(--navy);
}
.btn-outline:hover:not(:disabled) {
    background: var(--navy);
    color: #fff;
}
.btn-ghost {
    background: transparent;
    color: #fff;
    border-color: rgba(232, 224, 133, 0.5);
}
.btn-ghost:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.btn-danger {
    background: var(--red);
    color: #fff;
}
.link {
    border: 0;
    background: none;
    padding: 0.3rem 0;
    min-height: 32px;
    font: inherit;
    font-size: 0.85rem;
    color: var(--indigo);
    text-decoration: underline;
    cursor: pointer;
}
input:not([type='checkbox'], [type='hidden'], [type='file']),
textarea,
select {
    width: 100%;
    min-height: 46px;
    padding: 0.6rem 0.75rem;
    font: inherit;
    font-size: 1rem; /* 16px stops phones zooming in on focus */
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--hair);
    border-radius: 0;
}
textarea {
    resize: vertical;
    overflow-wrap: break-word;
}
input:focus,
textarea:focus,
select:focus {
    border-color: var(--indigo);
}
input[type='file'] {
    width: 100%;
    min-height: 46px;
    font: inherit;
    font-size: 0.85rem;
}
input[type='file']::file-selector-button {
    min-height: 44px;
    margin-right: 0.75rem;
    padding: 0 1rem;
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--navy);
    font: inherit;
    cursor: pointer;
}
.label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--steel);
}
.field {
    display: block;
    margin-bottom: 1rem;
}
.help {
    margin: 0.3rem 0 0.6rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

/* ---------- Sign-in page ---------- */
.is-gate {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: radial-gradient(ellipse at 50% 20%, var(--indigo), var(--navy) 55%, var(--navy-2));
}
.is-gate .page {
    width: min(100%, 420px);
}
.gate {
    text-align: center;
    color: #fff;
    border: 1px solid rgba(232, 224, 133, 0.34);
    background: rgba(2, 1, 74, 0.6);
    padding: clamp(1.5rem, 6vw, 2.75rem);
}
.gate h1 {
    color: #fff;
    margin-bottom: 1.5rem;
}
.gate h1 em {
    color: var(--gold);
}
.gate-kicker {
    margin: 1rem 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: var(--gold);
}
.gate form {
    text-align: left;
}
.gate .label {
    color: var(--gold);
}
.gate .btn {
    width: 100%;
    margin-top: 0.5rem;
}
.gate .btn-gold:hover {
    background: #fff;
    color: var(--navy);
}
.gate-note {
    margin: 1.25rem 0 0;
    font-size: 0.8rem;
    color: #b9bde8;
}

/* ---------- Application frame ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--top);
    padding: 0.5rem max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
    background: var(--navy);
    color: #fff;
    border-bottom: 1px solid rgba(232, 224, 133, 0.34);
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.3em;
    line-height: 1.3;
}
.brand small {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--gold);
}
.topbar-site {
    margin-left: auto;
    color: var(--gold);
    font-size: 0.8rem;
    white-space: nowrap;
}
.burger {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    cursor: pointer;
}
.sidebar {
    position: fixed;
    z-index: 25;
    top: var(--top);
    bottom: 0;
    left: 0;
    width: min(var(--side), 84vw);
    display: flex;
    flex-direction: column;
    background: var(--navy-2);
    color: #fff;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.3s, visibility 0.3s;
}
.menu-open .sidebar {
    transform: none;
    visibility: visible;
}
.shade {
    position: fixed;
    inset: var(--top) 0 0;
    z-index: 20;
    background: rgba(1, 2, 54, 0.55);
}
.sidebar nav {
    flex: 1;
    padding: 1rem 0;
}
.sidebar nav a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: #d6d8f5;
    text-decoration: none;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover {
    color: var(--gold);
}
.sidebar nav a[aria-current] {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(255, 255, 255, 0.06);
}
.sidebar nav p {
    margin: 1.2rem 1.25rem 0.4rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #8f93d0;
}
.signout {
    display: grid;
    gap: 0.6rem;
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.82rem;
}
.is-app .page {
    padding: 1.5rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
    max-width: 980px;
}
.page-head {
    margin-bottom: 1.5rem;
}
.page-head p {
    margin: 0.5rem 0 0;
    color: var(--ink-soft);
}
.notice {
    margin: 0 0 1.25rem;
    padding: 0.8rem 1rem;
    background: #fff;
    border-left: 4px solid var(--brass);
    color: var(--ink);
    text-align: left;
}
.notice-error {
    border-left-color: var(--red);
    color: var(--red);
}

/* ---------- Overview ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 1rem;
}
.card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    height: 100%;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--hair);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.25s, transform 0.25s;
}
.card:hover {
    border-color: var(--brass);
    transform: translateY(-2px);
}
.card h2 {
    font-size: 1.45rem;
}
.card p {
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
    color: var(--ink-soft);
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid var(--hair);
    color: var(--ink-soft);
}
.badge-changed {
    background: var(--gold);
    border-color: var(--brass);
    color: var(--navy);
}
.danger {
    margin-top: 2.5rem;
    padding: 1.25rem;
    border: 1px solid #e3b4b4;
    background: #fff;
}
.danger h2 {
    font-size: 1.5rem;
    color: var(--red);
}
.check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}
.check input {
    width: 20px;
    height: 20px;
    margin: 0.15rem 0 0;
    flex: none;
}

/* ---------- Editor ---------- */
.block {
    min-width: 0;
    margin: 0 0 1.25rem;
    padding: 1.1rem;
    background: #fff;
    border: 1px solid var(--hair);
}
.block legend {
    float: left;
    width: 100%;
    margin-bottom: 0.7rem;
    padding: 0;
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--navy);
}
.block legend + * {
    clear: both;
}
.block.is-changed {
    border-left: 4px solid var(--brass);
}
.block.is-invalid,
.field.is-invalid input,
.field.is-invalid textarea {
    border-color: var(--red);
}
.block-state {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.6rem;
}
.repeat ol {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.line input {
    flex: 1 1 200px;
    min-width: 0;
}
.item {
    padding: 1rem 1rem 0;
    background: var(--ivory);
    border: 1px solid var(--hair);
}
.row-tools {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}
.item > .row-tools {
    justify-content: flex-end;
    margin-bottom: 0.6rem;
}
.row-tools button {
    width: 44px;
    min-height: 44px;
    background: #fff;
    border: 1px solid var(--hair);
    color: var(--navy);
    font-size: 1.1rem;
    cursor: pointer;
}
.row-tools button:hover {
    border-color: var(--navy);
}
.row-tools [data-remove] {
    color: var(--red);
}
.image-field {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}
.image-field > div {
    flex: 1 1 220px;
    min-width: 0;
}
.preview {
    width: 160px;
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    background: var(--navy);
    border: 1px solid var(--hair);
}
.savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom));
    background: var(--ivory);
    border-top: 1px solid var(--hair);
}
.savebar .btn {
    flex: 1 1 180px;
}
.narrow {
    max-width: 460px;
}

/* ---------- Wider screens ---------- */
@media (min-width: 900px) {
    .burger {
        display: none;
    }
    .sidebar {
        width: var(--side);
        transform: none;
        visibility: visible;
    }
    .shade {
        display: none;
    }
    .is-app .page {
        margin-left: var(--side);
        padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem) 3rem;
        max-width: calc(980px + var(--side));
    }
    .savebar .btn {
        flex: 0 0 auto;
    }
}

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