/* ==========================================================================
   NTB — Track an NTB complaint (public)
   Tokens: navy #00171F · gold #C9A84C · teal #0D9488 · red #E53E3E
   Type:   Sora (UI) · Lora italic (accent) · JetBrains Mono (codes)
   ========================================================================== */

:root {
    --ntb-navy: #00171F;
    --ntb-navy-2: #0B2B36;
    --ntb-gold: #C9A84C;
    --ntb-gold-soft: #F7F0DC;
    --ntb-teal: #0D9488;
    --ntb-teal-deep: #0A7068;
    --ntb-teal-soft: #E6F5F3;
    --ntb-red: #E53E3E;

    --ink: #0F2229;
    --muted: #5A6B71;
    --line: #E3E8E8;
    --line-strong: #C8D2D4;
    --surface: #FFFFFF;
    --page: #F6F7F5;

    --radius: 1rem;
    --radius-sm: .7rem;
    --shadow: 0 1px 2px rgb(0 23 31 / 5%), 0 12px 32px -8px rgb(0 23 31 / 12%);

    --font-ui: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-accent: 'Lora', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
h1, h2, p { margin: 0; }

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font: 400 .975rem/1.6 var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

/* Icon system ------------------------------------------------------------ */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
    width: 1.1em;
    height: 1.1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -.18em;
}

/* Backdrop: faint gold grid that fades out — echoes the login / 404 panels */
.backdrop {
    position: fixed;
    inset: 0 0 auto;
    height: 34rem;
    z-index: -1;
    background-image:
        linear-gradient(rgb(201 168 76 / 14%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(201 168 76 / 14%) 1px, transparent 1px);
    background-size: 42px 42px;
    background-position: center top;
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 30%, transparent 75%);
            mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 30%, transparent 75%);
}

/* Layout ----------------------------------------------------------------- */
.wrap { width: min(calc(100% - 2rem), 44rem); margin-inline: auto; }

.tracker {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-block: clamp(3.5rem, 14vh, 8.5rem) 2rem;
}

.tracker-with-result { padding-top: clamp(2rem, 6vh, 3.5rem); }

/* Intro ------------------------------------------------------------------ */
.intro { text-align: center; }

.tracking-icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.5rem;
    border-radius: 1.1rem;
    background: linear-gradient(155deg, var(--ntb-navy-2), var(--ntb-navy));
    color: var(--ntb-gold);
    box-shadow: 0 10px 24px -8px rgb(0 23 31 / 45%), inset 0 0 0 1px rgb(201 168 76 / 25%);
}

.tracking-icon .icon { width: 1.75rem; height: 1.75rem; stroke-width: 2; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #8A6D22;
    margin-bottom: .7rem;
}

h1 {
    font-size: clamp(2rem, 5.2vw, 2.9rem);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.1;
    color: var(--ntb-navy);
}

h1 em {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 500;
    letter-spacing: -.01em;
    color: var(--ntb-teal-deep);
}

.tracker-with-result h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }

.lede {
    max-width: 30rem;
    margin: .9rem auto 0;
    color: var(--muted);
    font-size: 1.02rem;
}

/* Cards ------------------------------------------------------------------ */
.card {
    margin-top: 1rem;
    padding: clamp(1.15rem, 4vw, 1.75rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.search-card { margin-top: 2rem; box-shadow: var(--shadow); }
.tracker-with-result .search-card { margin-top: 1.5rem; box-shadow: none; }

label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ntb-navy);
}

label .icon { color: var(--ntb-teal); }

.hint { color: var(--muted); }
.lookup-hint { margin-top: .3rem; font-size: .86rem; }

/* Search row ------------------------------------------------------------- */
.search-row { display: flex; gap: .65rem; margin-top: .8rem; }

.field { position: relative; flex: 1; min-width: 0; }

.field-icon {
    position: absolute;
    left: .95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8A9BA0;
    pointer-events: none;
    transition: color .15s ease;
}

.field:focus-within .field-icon { color: var(--ntb-teal); }

input, button { font: inherit; border-radius: var(--radius-sm); min-height: 3.25rem; }

input {
    width: 100%;
    padding: .6rem .95rem .6rem 2.75rem;
    border: 1.5px solid var(--line-strong);
    background: #FBFCFC;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:hover { border-color: #A9B7BA; }

input:focus {
    outline: none;
    border-color: var(--ntb-teal);
    background: #fff;
    box-shadow: 0 0 0 4px rgb(13 148 136 / 14%);
}

input::placeholder { color: #8A9BA0; opacity: 1; }

.code-input {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.code-input::placeholder {
    font-family: var(--font-ui);
    letter-spacing: 0;
    text-transform: none;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .6rem 1.3rem;
    border: 0;
    background: var(--ntb-navy);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

button .icon { color: var(--ntb-gold); transition: transform .15s ease; }
button:hover { background: var(--ntb-navy-2); }
button:hover .icon { transform: translateX(3px); }
button:active { transform: translateY(1px); }

:focus-visible { outline: 3px solid var(--ntb-gold); outline-offset: 3px; }
input:focus-visible { outline: none; }

/* Notice ----------------------------------------------------------------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem .9rem;
    margin-bottom: 1.1rem;
    background: #FDF6E6;
    border: 1px solid #F0DFB3;
    border-radius: var(--radius-sm);
    color: #6B4F12;
    font-size: .9rem;
}

.notice .icon { margin-top: .2em; color: #B7861C; }

/* Code help -------------------------------------------------------------- */
.code-help {
    width: fit-content;
    max-width: 100%;
    margin: 1.25rem auto 0;
    font-size: .88rem;
}

.code-help summary {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .9rem;
    border-radius: 2rem;
    color: var(--ntb-teal-deep);
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    transition: background .15s ease;
}

.code-help summary::-webkit-details-marker { display: none; }
.code-help summary:hover { background: var(--ntb-teal-soft); }
.code-help .chevron { width: .95em; height: .95em; transition: transform .2s ease; }
.code-help[open] .chevron { transform: rotate(90deg); }

.code-help p {
    margin-top: .5rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-align: center;
}

/* Result ----------------------------------------------------------------- */
.result-card { position: relative; overflow: hidden; }

.result-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--ntb-gold), var(--ntb-teal));
}

.reference {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .7rem;
    padding: .25rem .65rem;
    border-radius: .45rem;
    background: var(--ntb-gold-soft);
    color: #6E561A;
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .03em;
    overflow-wrap: anywhere;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.3;
    color: var(--ntb-navy);
    overflow-wrap: anywhere;
}

.details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--line-strong);
}

dt {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

dt .icon { width: 1rem; height: 1rem; color: #8A9BA0; }
dd { margin: .35rem 0 0; font-weight: 600; }

/* Status pill: neutral by default, coloured for known states */
.status {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .2rem .7rem .2rem .6rem;
    border-radius: 2rem;
    background: #EEF1F2;
    color: #3C4D53;
    font-size: .85rem;
}

.status::before {
    content: "";
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: currentColor;
}

.status-open, .status-new, .status-active { background: var(--ntb-teal-soft); color: var(--ntb-teal-deep); }
.status-in-progress, .status-pending, .status-on-hold, .status-awaiting-reply { background: #FDF3DD; color: #8A6512; }
.status-escalated { background: #FDECEC; color: #B42828; }
.status-closed, .status-resolved, .status-solved { background: #E8F3EA; color: #23733A; }

/* Conversation ----------------------------------------------------------- */
.section-title { display: flex; align-items: center; gap: .55rem; font-size: 1.1rem; }
.section-title .icon { color: var(--ntb-teal); }

.thread {
    position: relative;
    display: grid;
    gap: 1rem;
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
}

/* Timeline spine */
.thread::before {
    content: "";
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    left: 1.0625rem;
    width: 1px;
    background: var(--line);
}

.message { position: relative; display: flex; gap: .85rem; }

.avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 2.125rem;
    height: 2.125rem;
    flex: none;
    border-radius: 50%;
    background: #EEF1F2;
    color: #5A6B71;
    box-shadow: 0 0 0 4px var(--surface);
}

.avatar .icon { width: 1rem; height: 1rem; }

.message-support .avatar { background: var(--ntb-navy); color: var(--ntb-gold); }

.bubble {
    flex: 1;
    min-width: 0;
    padding: .8rem 1rem;
    border: 1px solid var(--line);
    border-radius: .3rem var(--radius-sm) var(--radius-sm) var(--radius-sm);
    background: #FAFBFB;
}

.message-support .bubble { background: var(--ntb-teal-soft); border-color: #CBE8E4; }

.message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .15rem .75rem;
}

.message-meta strong { font-size: .88rem; font-weight: 600; color: var(--ntb-navy); }
.message-meta span { color: var(--muted); font-family: var(--font-mono); font-size: .74rem; }
.message-body { margin-top: .35rem; font-size: .94rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.empty {
    display: grid;
    justify-items: center;
    gap: .5rem;
    padding: 1.75rem 1rem 1rem;
    text-align: center;
}

.empty .icon { width: 2rem; height: 2rem; color: #A9B7BA; stroke-width: 1.5; }

/* Footer ----------------------------------------------------------------- */
.page-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .5rem 1.25rem;
    margin-top: auto;
    padding-top: 3rem;
    color: var(--muted);
    font-size: .8rem;
    text-align: center;
}

.help-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--ntb-teal-deep);
    font-weight: 600;
    text-decoration: none;
}

.help-link:hover { text-decoration: underline; text-underline-offset: .2em; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 34rem) {
    .search-row { flex-direction: column; }
    button { width: 100%; }
    .tracker { padding-top: 3rem; }
    .tracker-with-result { padding-top: 1.75rem; }
}

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