/* ==========================================================================
   Diploma verification - stylesheet.
   Business Science Institute. BSI UI v1.1.

   This is the subset of the BSI design system that this single-page app
   actually uses, plus the page rules that used to sit inline in index.php.
   The full design system is kept alongside as _design-system.css, which is
   a reference copy and is not deployed.
   ========================================================================== */

:root {
    /* Accent (burgundy). Used for primary actions, links, focus. */
    --red:          #9B0C23;
    --red-dark:     #7a0a1c;
    --red-light:    #fef2f2;
    --red-border:   #fecaca;

    /* Text.
       --text-muted was #787878, which reads at 4.42:1 on white and 4.23:1 on
       the #fafafa panel: both under the 4.5:1 that WCAG AA asks for at this
       size. #6b6b6b clears it on either background (5.33:1 and 5.11:1). */
    --text:         #454545;
    --text-muted:   #6b6b6b;

    /* Surfaces and lines */
    --surface:      #ffffff;
    --bg:           #fafafa;
    --border:       #e0e0e0;
    --border-soft:  #e8e8e8;
    --border-input: #d0d0d0;
    --divider:      #f0f0f0;

    /* Status */
    --success-bg:   #f0fdf4;
    --success-text: #166534;
    --success-bdr:  #bbf7d0;

    /* Radii */
    --radius:       4px;
    --radius-lg:    8px;
    --radius-pill:  20px;

    --shadow:       0 2px 10px rgba(0, 0, 0, .08);

    /*
       The design system named 'PT Serif' first, but the font was never
       loaded anywhere, so every screen has always rendered in Arial. The
       stack now says what actually happens. To bring PT Serif back, drop the
       woff2 files into assets/fonts/, uncomment the @font-face block below
       and put 'PT Serif' back at the head of this list.
    */
    --font:         Arial, Helvetica, 'Nimbus Sans L', sans-serif;

    --control-h:    42px;
}

/*
@font-face {
    font-family: 'PT Serif';
    src: url('assets/fonts/pt-serif-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    color: var(--red-dark);
    text-decoration: underline;
}

/* Headings are light (font-weight: normal) - the BSI signature. Meaning is
   carried by size and the burgundy accent, never by bold weight. */
h1, h2 {
    color: var(--text);
    font-weight: normal;
    line-height: 1.3;
}

h1 { font-size: 24px; letter-spacing: -0.5px; }
h2 { font-size: 22px; }

/* ─── Buttons ────────────────────────────────────────────────────────────*/

.btn {
    height: var(--control-h);
    padding: 0 24px;
    background: var(--red);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: normal;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    background: var(--red-dark);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
}

.btn-secondary:hover {
    background: var(--red);
    color: #ffffff;
}

.btn-full {
    width: 100%;
}

/* ─── Form fields ────────────────────────────────────────────────────────*/

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: normal;
}

input[type="text"] {
    width: 100%;
    height: var(--control-h);
    padding: 0 15px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.3s, background 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--red);
    background: var(--surface);
}

.form-group {
    margin-bottom: 25px;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────*/

.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-border);
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 14px;
    border-radius: var(--radius);
    line-height: 1.5;
}

/* Hold message: left-aligned, it is a paragraph rather than a one-liner. */
.alert-hold {
    text-align: left;
}

.alert-hold strong {
    display: block;
    margin-bottom: 4px;
}

/* ─── Verification page ──────────────────────────────────────────────────*/

body.verify-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
}

.verify-container {
    width: 100%;
    max-width: 420px;
}

.verify-container.is-entry {
    max-width: 1120px;
}

.verify-container.is-result {
    max-width: 760px;
}

.verify-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 50px 45px;
}

.verify-logo {
    display: block;
    height: 72px;
    width: auto;
    margin: 0 auto 34px;
}

/* Two-column entry card: explanation on the left, fields on the right. */
.split-card {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.split-info {
    flex: 1.15;
    background: var(--bg);
    border-right: 1px solid var(--border-soft);
    padding: 56px 52px;
}

.split-info .verify-logo {
    height: 62px;
    margin: 0 0 30px;
}

.split-info h1 {
    text-align: left;
    margin-bottom: 22px;
}

.split-info p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.75;
    margin-bottom: 16px;
}

.split-info p:last-child {
    margin-bottom: 0;
}

.split-form {
    flex: 1;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Push the form title down by the logo block height (62 + 30) so it lines up
   with the left title, and match its size. */
.split-form h2 {
    font-size: 24px;
    letter-spacing: -0.5px;
    margin: 92px 0 28px;
}

.verified-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-bdr);
    border-radius: var(--radius-pill);
    padding: 5px 16px;
    font-size: 13px;
}

.verify-actions {
    margin-top: 30px;
    text-align: center;
}

/* ─── Record card (v1.1) ─────────────────────────────────────────────────
   Read top to bottom: who and what (header), the key facts at a glance
   (tiles), then the thesis, with a long abstract folded behind a fade.    */

.record {
    padding: 44px 48px 40px;
}

.record-head {
    text-align: center;
    padding-bottom: 28px;
}

.record-head .verify-logo {
    height: 58px;
    margin-bottom: 22px;
}

.record-type {
    margin-top: 18px;
    color: var(--red);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.record-name {
    margin-top: 8px;
    font-size: 30px;
    letter-spacing: -0.5px;
    overflow-wrap: anywhere;
}

.record-born {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Key facts: small tiles, two or three to a row depending on the width. */
/* Each tile draws its own right and bottom rule; the container clips the
   ones that fall on its edge, so an incomplete last row leaves no grey gap. */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.fact {
    padding: 14px 18px;
    min-width: 0;
    box-shadow: 1px 0 0 var(--border-soft), 0 1px 0 var(--border-soft);
}

.fact dt {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.fact dd {
    color: var(--text);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.fact-note {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 1px;
}

.section-title {
    margin: 0 0 12px;
    color: var(--red);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.thesis {
    margin-top: 34px;
}

.thesis-title {
    color: var(--text);
    font-size: 18px;
    line-height: 1.45;
}

.thesis-title-en {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.thesis-title-en span {
    display: inline-block;
    margin-right: 6px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 11px;
    letter-spacing: 0.5px;
    vertical-align: 1px;
}

.rows {
    margin-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 4px 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
}

.row dt {
    color: var(--text-muted);
}

.row dd {
    color: var(--text);
}

.abstract {
    margin-top: 22px;
}

.abstract-label {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: normal;
}

.abstract-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
}

.abstract-text p + p {
    margin-top: 10px;
}

/* Folded abstract. The checkbox is the state, the label is the control:
   no script, so the strict CSP stays as it is. */
.more-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.abstract-text.is-clamped {
    position: relative;
    max-height: 10.2em;          /* six lines at line-height 1.7 */
    overflow: hidden;
}

.abstract-text.is-clamped::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5.1em;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--surface) 92%);
    pointer-events: none;
}

.more-toggle:checked + .abstract-text.is-clamped {
    max-height: none;
}

.more-toggle:checked + .abstract-text.is-clamped::after {
    display: none;
}

.more-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 0;
    color: var(--red);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.more-label::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s;
}

.more-label:hover {
    color: var(--red-dark);
    text-decoration: underline;
}

.more-toggle:focus-visible ~ .more-label {
    outline: 2px solid var(--red);
    outline-offset: 3px;
    border-radius: 2px;
}

.more-close,
.more-toggle:checked ~ .more-label .more-open {
    display: none;
}

.more-toggle:checked ~ .more-label .more-close {
    display: inline;
}

.more-toggle:checked ~ .more-label::after {
    transform: translateY(2px) rotate(-135deg);
}

/* Official mentions printed on the document. */
.mentions {
    margin-top: 34px;
}

.mentions-intro {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: -4px;
}

.mentions .rows {
    margin-top: 10px;
}

/* Date of the check, for printouts and screenshots. */
.checked-on {
    margin-top: 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.checked-on + .verify-actions {
    margin-top: 18px;
}

/* Guidance for readers and holders, side by side on wide screens. */
.help-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 36px;
    padding: 24px 26px;
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.65;
}

.help-col {
    min-width: 0;
}

.help-box h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 15px;
}

.help-box p + p,
.help-box input + p {
    margin-top: 8px;
}

.help-small {
    font-size: 12px;
}

input.record-link {
    margin-top: 10px;
    height: 36px;
    padding: 0 10px;
    background: var(--surface);
    font-size: 12px;
    color: var(--text);
}

.sr-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Running text is justified, as in the Institute's printed documents.
   Hyphenation (the page is lang="en") keeps the word spacing even, which
   matters most in the narrow column of a phone. Headings, titles, the
   key-facts tiles and one-line labels keep their natural alignment. */
.abstract-text,
.split-info p,
.help-box p,
.help-box li,
.form-note {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* ─── Entry page additions (v1.1) ────────────────────────────────────────*/

.split-info strong.lead {
    color: var(--text);
    font-weight: normal;
}

input::placeholder {
    color: #9a9a9a;
}

.form-note {
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

/* A sketch of the bottom-right corner of the document, so that people know
   what to look for. Pure markup: no image to keep in sync. */
.where-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px dashed var(--border-input);
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.7;
}

.where-qr {
    flex: none;
    width: 46px;
    height: 46px;
    background:
        linear-gradient(90deg, var(--text) 0 30%, transparent 30% 70%, var(--text) 70%) top / 100% 30% no-repeat,
        linear-gradient(90deg, var(--text) 0 30%, transparent 30%) bottom / 100% 30% no-repeat,
        repeating-linear-gradient(45deg, #bdbdbd 0 3px, transparent 3px 6px);
    border-radius: 2px;
    opacity: .75;
}

.where-lines {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 12px;
    min-width: 0;
    color: var(--text-muted);
}

.where-lines span {
    overflow-wrap: anywhere;
}

.where-lines .hl {
    color: var(--red);
    font-weight: bold;
    letter-spacing: 0.5px;
}

.split-info p.where-caption {
    margin-top: 10px;
    font-size: 13px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────*/

@media (max-width: 760px) {
    .split-card {
        flex-direction: column;
    }

    .split-info {
        border-right: none;
        border-bottom: 1px solid var(--border-soft);
    }

    .split-form h2 {
        margin-top: 0;
    }
}

@media (max-width: 620px) {
    .row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .help-box {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .facts {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 380px) {
    .facts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body.verify-page {
        padding: 28px 14px;
    }

    .verify-card {
        padding: 34px 24px;
    }

    .split-info,
    .split-form {
        padding: 34px 26px;
    }

    .verify-logo {
        height: 60px;
        margin-bottom: 26px;
    }

    .help-box {
        padding: 20px 18px;
    }

    .record {
        padding: 32px 20px 30px;
    }

    .record-name {
        font-size: 24px;
    }
}

/* ─── Print ──────────────────────────────────────────────────────────────
   A printed record goes into a file: everything unfolded, no controls,
   and the date of the check kept. */
@media print {
    body.verify-page {
        padding: 0;
    }

    .verify-card {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .abstract-text.is-clamped {
        max-height: none;
    }

    .abstract-text.is-clamped::after,
    .more-label,
    .verify-actions,
    .help-box .help-col:last-child {
        display: none;
    }

    .help-box {
        display: block;
    }
}

