:root {
    --ivory: #f7f2e7;
    --surface: #fcfaf5;
    --navy: #071b33;
    --ink: #18202a;
    --gold: #b58a32;
    --gold-light: #d8c18a;
    --gold-bright: #d8a33d;
    --muted: #6f675b;
    --error: #9d4741;
    --display: "Cormorant Garamond", "Iowan Old Style", Baskerville, "Palatino Linotype", Georgia, serif;
    --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--ivory);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--ivory);
    font-family: var(--ui);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.site-header {
    position: relative;
    color: #fffdf8;
    background: var(--navy);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 32px, 1180px);
    min-height: 112px;
    margin: 0 auto;
}

.agency-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: inherit;
    text-decoration: none;
}

.agency-brand img {
    width: 66px;
    height: 78px;
    object-fit: contain;
}

.agency-brand__copy {
    display: grid;
    gap: 5px;
}

.agency-brand__copy strong {
    font: 600 22px / .95 var(--display);
    letter-spacing: .06em;
}

.agency-brand__copy small {
    color: #f3e6c7;
    font: 500 11px / 1.2 var(--display);
    letter-spacing: .01em;
}

.menu-button {
    display: grid;
    gap: 6px;
    width: 42px;
    min-height: 42px;
    padding: 10px 7px;
    color: #fffdf8;
    cursor: pointer;
    background: transparent;
    border: 0;
}

.menu-button span {
    display: block;
    height: 2px;
    background: currentColor;
}

.site-menu {
    position: absolute;
    z-index: 2;
    top: 100%;
    right: 16px;
    width: 170px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--gold-light);
    box-shadow: 0 10px 24px rgba(7, 27, 51, .18);
}

.site-menu a {
    display: block;
    padding: 12px 14px;
    color: var(--navy);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.site-menu a:hover {
    background: var(--ivory);
}

.content-shell {
    width: min(calc(100% - 32px), 520px);
    margin: 24px auto 48px;
}

.form-panel,
.generation-panel,
.status-panel,
.finished-panel {
    padding: clamp(28px, 5vw, 48px) clamp(20px, 5vw, 56px);
    background: var(--surface);
    border: 1px solid rgba(181, 138, 50, .22);
    box-shadow: 0 8px 24px rgba(7, 27, 51, .08);
}

.form-panel,
.generation-panel,
.status-panel {
    text-align: center;
}

.panel-crest {
    margin-bottom: 7px;
    color: var(--gold);
    font-size: 28px;
    line-height: 1;
}

.panel-kicker {
    margin: 0;
    color: var(--navy);
    font: 500 clamp(24px, 4vw, 30px) / 1 var(--display);
    text-align: center;
}

h1,
h2,
p {
    margin-top: 0;
}

.form-panel h1,
.generation-panel h1,
.status-panel h1,
.finished-panel h1 {
    margin: 2px 0 14px;
    color: var(--navy);
    font: 700 clamp(29px, 5.6vw, 46px) / .97 var(--display);
    letter-spacing: .025em;
}

.ceremonial-title {
    display: grid;
    justify-items: center;
    width: 100%;
    text-align: center;
}

.ceremonial-title span {
    display: block;
    max-width: 100%;
}

.gold-rule {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    margin: 0 auto 18px;
    color: var(--gold);
}

.gold-rule::before,
.gold-rule::after {
    flex: 1;
    height: 1px;
    content: "";
    background: var(--gold-light);
}

.gold-rule span {
    font-size: 10px;
}

.gold-rule--short {
    width: min(220px, 80%);
    margin-bottom: 24px;
}

.panel-intro {
    max-width: 520px;
    margin: 0 auto 28px;
    color: var(--ink);
    font: 400 16px / 1.55 var(--display);
}

.issue-form {
    display: grid;
    gap: 28px;
    margin-top: 8px;
    text-align: left;
}

.form-section {
    display: grid;
    gap: 16px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.form-section legend {
    float: left;
    width: 100%;
    margin-bottom: 0;
    padding: 0;
    color: var(--gold);
    font: 600 19px / 1.2 var(--display);
}

.optional-marker {
    display: inline-block;
    margin-left: 7px;
    padding: 3px 6px 2px;
    color: var(--muted);
    font: 700 9px / 1 var(--ui);
    letter-spacing: .08em;
    text-transform: uppercase;
    vertical-align: .2em;
    border: 1px solid var(--gold-light);
    border-radius: 2px;
}

.field {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.field input,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--ink);
    background: rgba(255, 255, 255, .32);
    border: 1px solid #d8d0bf;
    border-radius: 6px;
    outline: 0;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field textarea {
    min-height: 112px;
    resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #988f7f;
    opacity: 1;
}

.field input:focus,
.field textarea:focus {
    background: #fffefa;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(181, 138, 50, .14);
}

.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

.field-error {
    color: var(--error);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.field-error:empty {
    display: none;
}

.section-help {
    margin: -7px 0 0;
    color: var(--muted);
    font: 400 14px / 1.45 var(--display);
}

.form-section--final {
    padding-top: 2px;
}

.primary-button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 18px;
    color: var(--surface);
    font: 600 14px / 1.2 var(--ui);
    text-decoration: none;
    cursor: pointer;
    background: var(--navy);
    border: 1px solid var(--navy);
    border-radius: 6px;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-button:hover,
.button-primary:hover {
    background: #102e51;
    border-color: #102e51;
}

.primary-button:active,
.button:active,
.menu-button:active {
    transform: translateY(1px);
}

.button-arrow {
    margin-left: auto;
    padding-left: 16px;
    color: var(--gold-bright);
    font-size: 25px;
    font-weight: 400;
    line-height: .7;
}

.privacy-note,
.official-note {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin: 4px 0 0;
    color: var(--ink);
    font: 400 13px / 1.45 var(--display);
    text-align: left;
}

.privacy-note__mark {
    display: grid;
    flex: 0 0 21px;
    place-items: start center;
    width: 21px;
    color: var(--gold);
}

.privacy-note__mark svg {
    display: block;
    width: 18px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.official-note__mark {
    flex: 0 0 auto;
    color: var(--gold);
    font-size: 25px;
    line-height: .8;
}

.error-summary {
    padding: 14px 16px;
    color: #4c2521;
    background: #f8e9e5;
    border-left: 3px solid var(--error);
}

.error-summary ul {
    margin: 8px 0 0;
    padding-left: 19px;
}

.generation-panel {
    position: relative;
    isolation: isolate;
    min-height: 700px;
}

.generation-panel::before {
    position: absolute;
    z-index: -1;
    inset: 9px;
    content: "";
    pointer-events: none;
    border: 1px solid rgba(181, 138, 50, .72);
}

.generation-panel .panel-intro {
    margin-bottom: 30px;
}

.generation-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: min(250px, 65vw);
    aspect-ratio: 1;
    margin: 0 auto 24px;
    border: 1px solid rgba(181, 138, 50, .5);
    border-radius: 50%;
    box-shadow: 0 0 0 11px rgba(181, 138, 50, .08), 0 0 0 20px rgba(181, 138, 50, .04);
}

.generation-mark::after {
    position: absolute;
    inset: -10px;
    content: "";
    border: 4px solid transparent;
    border-top-color: var(--gold);
    border-radius: inherit;
    animation: turn 2.4s linear infinite;
}

.generation-mark img {
    width: 82%;
    height: 82%;
    object-fit: contain;
}

.generation-label {
    margin: 0 0 12px;
    color: var(--navy);
    font: 400 17px / 1.2 var(--display);
}

.official-note {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 13px;
    align-items: center;
    width: min(100%, 410px);
    margin: 0 auto;
    padding: 14px 16px;
    text-align: left;
    border: 1px solid rgba(181, 138, 50, .55);
    border-radius: 6px;
}

.official-note__mark {
    display: block;
    width: 30px;
    height: auto;
}

.back-link {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 16px 3px;
    color: var(--navy);
    font: 500 13px / 1.2 var(--ui);
    text-decoration: none;
}

.back-link:hover {
    color: var(--gold);
}

.status-panel {
    min-height: 420px;
    padding-top: clamp(50px, 10vw, 90px);
}

.status-panel h1 {
    max-width: 520px;
    margin-inline: auto;
}

.serial {
    display: inline-block;
    margin-top: 12px;
    padding: 13px 18px;
    color: var(--navy);
    font: 600 18px / 1.2 var(--display);
    border: 1px solid var(--gold-light);
}

.finished-panel {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.finished-panel h1 {
    margin-bottom: 22px;
    font-size: clamp(30px, 5vw, 42px);
    text-align: center;
}

.certificate-image {
    display: block;
    max-width: 580px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--gold);
    box-shadow: 0 8px 20px rgba(7, 27, 51, .15);
}

.certificate-image img {
    display: block;
    width: 100%;
    height: auto;
}

.certificate-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 580px;
    margin: 16px auto 36px;
}

.certificate-actions .button {
    min-width: 0;
    text-align: center;
}

.button-secondary {
    color: var(--navy);
    background: var(--surface);
    border-color: var(--gold);
}

.button-secondary:hover {
    background: var(--ivory);
    border-color: var(--gold);
}

.accessible-copy {
    max-width: 580px;
    margin: 0 auto;
    padding-top: 25px;
    border-top: 1px solid var(--gold-light);
}

.accessible-copy__eyebrow {
    margin-bottom: 8px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.accessible-copy h2 {
    margin-bottom: 4px;
    color: var(--navy);
    font: 700 30px / 1.05 var(--display);
}

.accessible-copy .recipient {
    margin-bottom: 18px;
    color: var(--navy);
    font: 700 24px / 1.15 var(--display);
}

.accessible-copy p {
    line-height: 1.6;
}

.accessible-copy dl {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 26px 0 0;
    padding-top: 18px;
    border-top: 1px solid rgba(181, 138, 50, .35);
}

.accessible-copy dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.accessible-copy dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
}

@keyframes turn {
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 760px) {
    .content-shell {
        width: min(calc(100% - 48px), 640px);
        margin-top: 32px;
    }

    .form-panel {
        padding-inline: clamp(52px, 7vw, 72px);
    }
}

@media (max-width: 560px) {
    .site-header__inner {
        width: min(100% - 24px, 1180px);
        min-height: 96px;
    }

    .agency-brand img {
        width: 53px;
        height: 66px;
    }

    .agency-brand__copy strong {
        font-size: 18px;
    }

    .agency-brand__copy small {
        max-width: 210px;
        font-size: 10px;
    }

    .content-shell {
        width: min(calc(100% - 16px), 520px);
        margin-top: 16px;
    }

    .form-panel,
    .generation-panel,
    .status-panel {
        padding-inline: 18px;
    }

    .form-panel h1,
    .generation-panel h1,
    .status-panel h1 {
        font-size: clamp(28px, 8vw, 38px);
    }

    .panel-intro {
        font-size: 15px;
    }

    .certificate-actions {
        grid-template-columns: 1fr;
    }

    .accessible-copy dl {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
