/* ---------- 1. FONTS ---------- */
/* Filenames must match the layout preload byte for byte, so a changed font file is renamed, never versioned. latin-ext carries ș ț. */
@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url(../fonts/ibm-plex-sans-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url(../fonts/ibm-plex-sans-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- 2. DESIGN TOKENS ---------- */
:root {
    --brand:         #0f6e73;
    --brand-strong:  #0a5257;
    --brand-deep:    #073d42;
    --brand-tint:    #e4f2f1;
    --brand-tint-2:  #cfe7e5;
    --warm:          #ffd9b0;

    --ink:         #132022;
    --text:        #4a5758;
    --text-strong: #283536;
    --muted:       #76888a;

    --white:     #fcfcfb;
    --surface:   #f2f6f5;
    --border:    #dbe4e3;

    --positive:      #15803d;
    --positive-tint: #e1f3e7;
    --warning:       #b45309;
    --warning-tint:  #fbeedc;
    --danger:        #dc2626;
    --danger-tint:   #fce5e5;

    --grad-brand: linear-gradient(135deg, #11747a 0%, #0a5257 100%);
    --grad-text:  linear-gradient(120deg, #0f6e73 0%, #2a9d98 100%);
    --glow:        0 12px 32px -12px rgb(15 110 115 / 45%);
    --shadow-card: 0 24px 60px -32px rgb(15 110 115 / 35%);
    --icon-check:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E");

    --r:       10px;
    --r-tile:  16px;
    --r-panel: 24px;
    --r-pill:  999px;

    --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 40px;
    --space-5: 64px;
    --space-6: 96px;

    --maxw:   1120px;
    --gutter: 24px;

    --shadow-modal: 0 10px 40px rgb(23 32 27 / 18%);
    --z-modal:      100;
}

@media (max-width: 480px) {
    :root { --gutter: 16px; }
}

/* ---------- 3. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

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

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
}

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--white);
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }

h1 { font-size: clamp(2.125rem, 5vw, 3.25rem); font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.125rem); }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }

img, svg, video { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

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

/* ---------- 4. LAYOUT PRIMITIVES ---------- */
.page { display: flex; flex-direction: column; min-height: 100vh; }

.page > main { flex: 1; }

.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container-narrow { max-width: 680px; }

.stack > * + * { margin-top: var(--space-2); }

.section { padding-block: var(--space-5); }

.section > .container > h2 { margin-bottom: var(--space-3); }

@media (min-width: 880px) {
    .section { padding-block: var(--space-6); }
}

/* ---------- 5. COMPONENTS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 24px;
    border: 0;
    border-radius: var(--r-pill);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, filter 0.15s ease;
}

/* #fff on purpose: the warm --white looks dirty on the teal gradient. */
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), var(--glow); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px) scale(0.99); box-shadow: 0 4px 12px -6px rgb(15 110 115 / 45%); filter: none; }

.btn-secondary { background: var(--brand-tint); color: var(--brand-strong); }
.btn-secondary:hover { background: var(--brand-tint-2); }
.btn-secondary:active { transform: translateY(1px); }

.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-sm { min-height: 36px; padding: 7px 16px; font-size: 14px; }
.btn-lg { min-height: 54px; padding: 15px 30px; font-size: 17px; }

.wordmark {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
}

.form-error {
    margin-bottom: var(--space-2);
    padding: 12px 16px;
    border-left: 3px solid var(--danger);
    border-radius: 12px;
    background: var(--danger-tint);
    color: var(--text-strong);
    font-size: 15px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.modal {
    width: min(520px, calc(100vw - 2 * var(--gutter)));
    max-height: min(85vh, 720px);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--white);
    color: var(--ink);
    box-shadow: var(--shadow-modal);
    overflow-y: auto;
    z-index: var(--z-modal);
}

.modal::backdrop { background: rgb(23 32 27 / 45%); }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.modal-title { font-size: 1.25rem; line-height: 1.3; }

.modal-x {
    flex: none;
    width: 44px;
    height: 44px;
    margin: -10px -10px 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--r);
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.modal-x:hover { background: var(--surface); color: var(--ink); }

.modal-form { display: grid; gap: var(--space-2); }

.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-1); margin-top: var(--space-1); }

@media (max-width: 480px) {
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
}

/* Without JS the modals stay open (see x-ui.modal): lay them out as page sections instead of overlays. */
.no-js .modal {
    display: block;
    position: static;
    width: auto;
    max-width: none;
    max-height: none;
    margin: var(--space-3) 0 0;
    box-shadow: none;
}

.no-js .modal-x { display: none; }

/* ---------- 6. HEADER + FOOTER ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    min-height: 68px;
    border-bottom: 1px solid rgb(19 32 34 / 6%);
    background: rgb(252 252 251 / 78%);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
}

.site-header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; }

.site-nav { display: flex; align-items: center; gap: var(--space-3); }

.site-nav > a:not(.btn) { font-weight: 500; color: var(--text-strong); text-decoration: none; }
.site-nav > a:not(.btn):hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 560px) {
    .site-nav > a:not(.btn) { display: none; }
}

.site-footer {
    padding-block: var(--space-4) var(--space-3);
    border-top: 3px solid;
    border-image: var(--grad-brand) 1;
    background: var(--surface);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.6;
}

.footer-grid { display: grid; gap: var(--space-3); }

.footer-grid p + p { margin-top: 12px; }

.footer-grid .wordmark { display: block; margin-bottom: var(--space-1); }

.site-footer a { color: var(--text-strong); text-underline-offset: 3px; }
.site-footer a:hover { color: var(--brand-strong); }

.footer-bottom {
    margin-top: var(--space-4);
    padding-top: var(--space-2);
    border-top: 1px solid rgb(19 32 34 / 8%);
    color: var(--muted);
    font-size: 13px;
}

@media (min-width: 720px) {
    .footer-grid { grid-template-columns: 1.2fr 1fr; gap: var(--space-5); }
}
