/*
 * The FOI request builder.
 *
 * Structure from the foi-energy prototype — statutory ticker, four steps,
 * the letter live beside them on paper. Identity from the campaign: the
 * same deep navy ground, emerald and gold as the data pages, rather than
 * the prototype's lime on black. Whether this should instead be its own
 * sub-brand is CAC-20 and is still open.
 *
 * The paper panel is the one place a light surface is deliberate. A letter
 * is a letter; rendering it on dark glass would make it look like a
 * terminal, and the whole point is that the reader recognises the thing
 * they are about to print.
 *
 * Type floors as elsewhere in the campaign: 0.7rem for uppercase tracked
 * labels, 0.75rem for anything in sentence case.
 */

:root {
    --foi-ground: #0A0E27;
    --foi-raised: rgba(255, 255, 255, 0.045);
    --foi-line: rgba(255, 255, 255, 0.12);
    --foi-line-soft: rgba(255, 255, 255, 0.07);
    --foi-heading: #F1F5F9;
    --foi-text: #CBD5E1;
    --foi-muted: #94A3B8;
    --foi-accent: #34D399;
    --foi-gold: #F59E0B;
    --foi-paper: #F7F4EC;
    --foi-ink: #14110B;
}

/* ---------- ticker ---------- */

.foi-ticker {
    overflow: hidden;
    white-space: nowrap;
    background: var(--foi-accent);
    color: #04210F;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    padding: 0.45rem 0;
}

.foi-ticker-track {
    display: inline-block;
    animation: foi-ticker 48s linear infinite;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.foi-ticker-track span { padding: 0 1.1rem; }
.foi-dot { opacity: 0.45; }

@keyframes foi-ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/*
 * One motion on this page, and it is decorative. Off entirely rather than
 * slowed: a strip of text sliding past is the exact thing the preference
 * exists to stop.
 */
@media (prefers-reduced-motion: reduce) {
    .foi-ticker-track {
        animation: none;
        /* Without the animation the duplicated run would overflow, so it
           scrolls by hand instead. */
        white-space: normal;
        display: block;
        padding: 0 1rem;
    }
    .foi-ticker { white-space: normal; }
}

/* ---------- hero ---------- */

.foi-hero {
    background: var(--foi-ground);
    padding: 3.25rem 0 2rem;
    border-bottom: 1px solid var(--foi-line-soft);
}

.foi-eyebrow {
    margin: 0 0 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--foi-accent);
}

.foi-title {
    margin: 0 0 1.4rem;
    font-size: clamp(2.1rem, 6vw, 4rem);
    line-height: 1.04;
    letter-spacing: -0.015em;
    color: var(--foi-heading);
}

.foi-hero-grid {
    display: grid;
    gap: 1.75rem;
    align-items: start;
}

@media (min-width: 860px) {
    .foi-hero-grid { grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr); gap: 3rem; }
}

.foi-lede {
    max-width: var(--measure);
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-md);
    line-height: 1.68;
    color: var(--foi-text);
}

.foi-facts { margin: 0; }

.foi-facts div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--foi-line-soft);
}

.foi-facts div:last-child { border-bottom: 1px solid var(--foi-line-soft); }

.foi-facts dt {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    letter-spacing: 0.04em;
    color: var(--foi-muted);
}

.foi-facts dd {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-md);
    font-weight: 600;
    color: var(--foi-heading);
    font-variant-numeric: tabular-nums;
}

.foi-facts dd.is-strong { color: var(--foi-accent); }

/* ---------- body ---------- */

.foi-body {
    background: var(--foi-ground);
    padding: 2.25rem 0 4rem;
    color: var(--foi-text);
}

.foi-disclosure {
    max-width: var(--measure);
    margin: 0 0 2.25rem;
    padding: 1rem 1.15rem;
    border-left: 2px solid var(--foi-gold);
    background: rgba(245, 158, 11, 0.07);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    line-height: 1.65;
    color: var(--foi-text);
}

.foi-disclosure strong { color: var(--foi-heading); display: block; margin-bottom: 0.25rem; }

.foi-shell { display: grid; gap: 2rem; }

@media (min-width: 1040px) {
    .foi-shell { grid-template-columns: minmax(0, 1fr) minmax(22rem, 25rem); gap: 2.5rem; align-items: start; }
}

.foi-h2 {
    margin: 0 0 0.4rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-lg);
    font-weight: 700;
    color: var(--foi-heading);
}

.foi-h3 {
    margin: 0 0 0.9rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--foi-accent);
}

.foi-note {
    max-width: var(--measure);
    margin: 0 0 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    line-height: 1.6;
    color: var(--foi-muted);
}

/* ---------- templates ---------- */

.foi-templates { margin-bottom: 2.5rem; }

.foi-template-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 680px) {
    .foi-template-list { grid-template-columns: 1fr 1fr; }
}

.foi-template {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--foi-line);
    border-radius: 12px;
    background: var(--foi-raised);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.foi-template:hover { border-color: rgba(52, 211, 153, 0.5); transform: translateY(-2px); }

@media (prefers-reduced-motion: reduce) {
    .foi-template { transition: border-color 0.18s ease; }
    .foi-template:hover { transform: none; }
}

.foi-template-title {
    margin: 0 0 0.4rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-md);
    font-weight: 650;
    color: var(--foi-heading);
}

.foi-template-summary {
    margin: 0 0 0.7rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    line-height: 1.55;
    color: var(--foi-text);
}

.foi-template-meta {
    margin: 0 0 0.7rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    letter-spacing: 0.03em;
    color: var(--foi-muted);
}

.foi-template-items { margin-bottom: 0.9rem; }

.foi-template-items summary {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    color: var(--foi-accent);
    padding: 0.35rem 0;
}

.foi-template-items ol {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    line-height: 1.55;
    color: var(--foi-text);
}

.foi-template-items li { margin-bottom: 0.4rem; }

.foi-template-use {
    margin-top: auto;
    align-self: flex-start;
    min-height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid var(--foi-accent);
    border-radius: 8px;
    background: transparent;
    color: var(--foi-accent);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.foi-template-use:hover { background: var(--foi-accent); color: #04210F; }

/* ---------- steps ---------- */

.foi-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
}

.foi-step {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    min-height: 3.4rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--foi-line);
    border-radius: 10px 10px 0 0;
    background: var(--foi-raised);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.foi-step:hover { border-color: rgba(255, 255, 255, 0.28); }

.foi-step.is-active {
    background: var(--foi-accent);
    border-color: var(--foi-accent);
}

.foi-step.is-done:not(.is-active) { border-color: rgba(52, 211, 153, 0.55); }

.foi-step-num {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-lg);
    font-weight: 700;
    line-height: 1;
    color: var(--foi-heading);
    font-variant-numeric: tabular-nums;
}

.foi-step.is-active .foi-step-num { color: #04210F; }
.foi-step.is-done:not(.is-active) .foi-step-num { color: var(--foi-accent); }

.foi-step-label {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--foi-muted);
}

.foi-step.is-active .foi-step-label { color: #04210F; opacity: 0.8; }

/* ---------- form ---------- */

.foi-form {
    border: 1px solid var(--foi-line);
    border-radius: 0 12px 12px 12px;
    background: var(--foi-raised);
}

.foi-pane { display: none; border: 0; margin: 0; padding: 1.5rem 1.35rem; }
.foi-pane.is-active { display: block; }

/*
 * With no script every pane is shown, one after another, so the form is a
 * long page rather than a broken one. The script then takes over and hides
 * all but the active pane.
 */
.foi-form:not(.is-live) .foi-pane { display: block; border-bottom: 1px solid var(--foi-line-soft); }
.foi-form:not(.is-live) .foi-pane-actions { display: none; }

@media (min-width: 680px) { .foi-pane { padding: 2rem 1.9rem; } }

.foi-pane-head { display: block; padding: 0; margin-bottom: 0.35rem; }

.foi-pane-index {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--foi-accent);
    margin-bottom: 0.3rem;
}

.foi-pane-title {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    font-weight: 700;
    color: var(--foi-heading);
}

.foi-pane-desc {
    margin: 0 0 1.5rem;
    max-width: var(--measure-narrow);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    line-height: 1.65;
    color: var(--foi-muted);
}

.foi-field { display: block; margin-bottom: 1.15rem; }

.foi-field-row { display: grid; gap: 1.15rem; }
@media (min-width: 560px) { .foi-field-row { grid-template-columns: 1fr 1fr; } }

.foi-label {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--foi-muted);
}

.foi-label em {
    font-style: normal;
    font-size: var(--t-xs);
    letter-spacing: 0.08em;
    color: var(--foi-accent);
}

.foi-label em.is-optional { color: rgba(148, 163, 184, 0.75); }

.foi-input {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--foi-line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.26);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    line-height: 1.5;
    color: var(--foi-heading);
    resize: vertical;
}

.foi-input:focus-visible {
    outline: 2px solid var(--foi-accent);
    outline-offset: 1px;
    border-color: var(--foi-accent);
}

select.foi-input { cursor: pointer; }

.foi-hint {
    display: block;
    margin-top: 0.45rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    line-height: 1.55;
    color: var(--foi-muted);
}

/* ---------- numbered documents ---------- */

.foi-item { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.5rem; }

.foi-item-num {
    flex: 0 0 1.9rem;
    padding-top: 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-md);
    font-weight: 700;
    text-align: center;
    color: var(--foi-accent);
    font-variant-numeric: tabular-nums;
}

.foi-item-remove {
    flex: 0 0 auto;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border: 1px solid var(--foi-line);
    border-radius: 8px;
    background: transparent;
    color: var(--foi-muted);
    font-size: var(--t-lg);
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.foi-item-remove:hover { color: #FCA5A5; border-color: rgba(252, 165, 165, 0.6); }

.foi-add {
    min-height: 2.5rem;
    margin-top: 0.4rem;
    padding: 0 0.9rem;
    border: 1px dashed var(--foi-line);
    border-radius: 8px;
    background: transparent;
    color: var(--foi-accent);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    cursor: pointer;
}

.foi-add:hover { border-style: solid; border-color: var(--foi-accent); }

/* ---------- format and checkboxes ---------- */

.foi-format { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }

.foi-format button {
    min-height: 2.75rem;
    padding: 0 0.6rem;
    border: 1px solid var(--foi-line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.26);
    color: var(--foi-text);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    cursor: pointer;
}

.foi-format button.is-active {
    background: var(--foi-accent);
    border-color: var(--foi-accent);
    color: #04210F;
    font-weight: 600;
}

.foi-check {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--foi-line);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.foi-check input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; accent-color: var(--foi-accent); flex: 0 0 auto; }

.foi-check-title {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    font-weight: 600;
    color: var(--foi-heading);
}

.foi-check-sub {
    display: block;
    margin-top: 0.2rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    color: var(--foi-muted);
}

.foi-indent { margin-left: 1.1rem; padding-left: 1rem; border-left: 2px solid rgba(52, 211, 153, 0.4); }

/* ---------- pane actions ---------- */

.foi-pane-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--foi-line-soft);
}

.foi-pane-actions.is-end { justify-content: flex-end; }

.foi-next {
    min-height: 2.75rem;
    padding: 0 1.2rem;
    border: 1px solid var(--foi-accent);
    border-radius: 8px;
    background: var(--foi-accent);
    color: #04210F;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    font-weight: 650;
    cursor: pointer;
}

.foi-next:hover { background: transparent; color: var(--foi-accent); }

.foi-back {
    min-height: 2.75rem;
    padding: 0 0.9rem;
    border: 1px solid var(--foi-line);
    border-radius: 8px;
    background: transparent;
    color: var(--foi-muted);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    cursor: pointer;
}

.foi-back:hover { color: var(--foi-heading); border-color: var(--foi-muted); }

.foi-done { margin: 0; font-family: 'Inter', sans-serif; font-size: var(--t-sm); font-weight: 600; color: var(--foi-accent); }

/* ---------- statute panel ---------- */

.foi-statute {
    margin-top: 2rem;
    padding: 1.3rem 1.35rem;
    border: 1px solid var(--foi-line-soft);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
}

.foi-statute dl { margin: 0; }

.foi-statute div {
    display: grid;
    gap: 0.15rem 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--foi-line-soft);
}

@media (min-width: 560px) { .foi-statute div { grid-template-columns: 7rem 1fr; } }

.foi-statute div:first-child { border-top: 0; padding-top: 0; }

.foi-statute dt {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    color: var(--foi-gold);
}

.foi-statute dd {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    line-height: 1.6;
    color: var(--foi-text);
}

/* ---------- the letter ---------- */

@media (min-width: 1040px) {
    .foi-preview { position: sticky; top: 1.5rem; }
}

.foi-preview-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.foi-preview-label {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--foi-accent);
}

.foi-preview-meta { margin: 0; font-family: 'Inter', sans-serif; font-size: var(--t-xs); color: var(--foi-muted); }

.foi-paper {
    /* Paper has soft corners. The one radius exception, written down. */
    border-radius: var(--r-paper);
    max-height: 36rem;
    overflow-y: auto;
    padding: 1.6rem 1.5rem;
    background: var(--foi-paper);
    color: var(--foi-ink);
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.75), 0 2px 0 rgba(255, 255, 255, 0.04);
}

.foi-paper-text {
    margin: 0;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: var(--t-sm);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--foi-ink);
}

.foi-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-top: 0.75rem; }

.foi-action {
    min-height: 2.75rem;
    border: 1px solid var(--foi-line);
    border-radius: 8px;
    background: var(--foi-raised);
    color: var(--foi-text);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    cursor: pointer;
}

.foi-action:hover { border-color: var(--foi-accent); color: var(--foi-accent); }

.foi-action.is-primary { background: var(--foi-accent); border-color: var(--foi-accent); color: #04210F; }
.foi-action.is-primary:hover { background: transparent; color: var(--foi-accent); }

.foi-mail {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    margin-top: 0.4rem;
    border: 1px dashed var(--foi-line);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    color: var(--foi-muted);
    text-decoration: none;
}

.foi-mail:hover { border-style: solid; border-color: var(--foi-accent); color: var(--foi-accent); }

.foi-tip {
    max-width: var(--measure);
    margin: 0.9rem 0 0;
    padding: 0.85rem 1rem;
    border-left: 2px solid var(--foi-gold);
    background: rgba(245, 158, 11, 0.06);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    line-height: 1.6;
    color: var(--foi-text);
}

.foi-tip strong { color: var(--foi-heading); }

/* ---------- touch ---------- */

@media (pointer: coarse) {
    .foi-input,
    .foi-next,
    .foi-back,
    .foi-add,
    .foi-action,
    .foi-mail,
    .foi-template-use,
    .foi-format button,
    .foi-item-remove { min-height: 44px; }

    .foi-step { min-height: 44px; }
    .foi-template-items summary { padding: 0.6rem 0; }
}

/* ---------- print ---------- */

@media print {
    .foi-ticker,
    .foi-hero,
    .foi-disclosure,
    .foi-templates,
    .foi-steps,
    .foi-form,
    .foi-statute,
    .foi-actions,
    .foi-mail,
    .foi-tip,
    .foi-preview-head,
    .navbar-custom,
    footer { display: none !important; }

    .foi-body { padding: 0; background: #fff; }
    .foi-shell { display: block; }
    .foi-paper { max-height: none; overflow: visible; box-shadow: none; padding: 0; background: #fff; }
    .foi-paper-text { font-size: 12pt; line-height: 1.65; color: #000; }
}


/* DESIGN-02 — the statute panel's definitions are prose. */
.foi-statute dd {
    max-width: var(--measure);
}

/* ===========================================================================
   The record pass — see docs/RECORD-DESIGN-PASS.md
   =========================================================================== */

/*
 * 3. Radius as a signal.
 *
 * A template card is content until you reach its button; the panel the
 * form sits in is content; the letter is paper. Controls keep their
 * corners because rounded means pressable, and that is the only thing
 * radius is allowed to mean on these pages now.
 */
.foi-template,
.foi-form,
.foi-statute,
.foi-check,
.foi-step { border-radius: var(--r-none); }

.foi-input,
.foi-next,
.foi-back,
.foi-add,
.foi-action,
.foi-mail,
.foi-template-use,
.foi-format button,
.foi-item-remove { border-radius: var(--r-control); }

/*
 * 5. One motion moment, and this page's is the ticker. A card that rises
 * when you point at it is promising an interaction it does not have.
 */
.foi-template:hover { transform: none; }
