@font-face {
    font-family: "vazirmatn";
    src: url("vazirmatn.woff2") format("woff2"),
         url("../assets/fonts/vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand: #92278f;
    --brand-dark: #6f1f70;
    --ink: #1c1b22;
    --muted: #686575;
    --line: #ddd8e4;
    --surface: #ffffff;
    --page: #f7f5f9;
    --success: #0f7a54;
    --danger: #b3261e;
    --focus: #1d74d8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "vazirmatn", Tahoma, Arial, sans-serif;
    color: var(--ink);
    background: var(--page);
    line-height: 1.8;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 58px;
    height: 40px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.35;
}

h1 {
    font-size: clamp(1.45rem, 4vw, 2.35rem);
    font-weight: 850;
}

h2 {
    font-size: 1.45rem;
}

h3 {
    font-size: 1.05rem;
    color: var(--brand-dark);
}

.year-pill {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    white-space: nowrap;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid;
    background: var(--surface);
}

.alert-success {
    color: var(--success);
    border-color: rgba(15, 122, 84, 0.28);
}

.alert-error,
.field-error {
    color: var(--danger);
}

.alert-error {
    border-color: rgba(179, 38, 30, 0.28);
}

.entry-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.entry-card {
    min-height: 118px;
    padding: 18px;
    text-align: right;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.entry-card:hover,
.entry-card.is-active {
    border-color: var(--brand);
    box-shadow: 0 10px 24px rgba(40, 32, 48, 0.08);
    transform: translateY(-1px);
}

.entry-card span {
    display: block;
    color: var(--brand-dark);
    font-size: 1.3rem;
    font-weight: 850;
}

.entry-card small {
    color: var(--muted);
}

.registration-form {
    display: grid;
    gap: 16px;
}

.registration-form.is-hidden,
.is-hidden {
    display: none !important;
}

.form-heading,
.form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.form-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
}

.section-kicker {
    color: var(--brand);
    font-weight: 750;
}

.generated-id {
    min-width: 260px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f4eef6;
}

.generated-id label,
.generated-id output {
    display: block;
}

.generated-id label {
    color: var(--muted);
    font-size: 0.9rem;
}

.generated-id output {
    color: var(--brand-dark);
    font-weight: 850;
}

.form-section {
    padding: 18px;
}

.form-section h3 {
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

label,
.radio-field {
    display: grid;
    gap: 7px;
    align-content: start;
}

label > span,
.radio-field > span {
    color: var(--muted);
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

input:focus,
select:focus,
button:focus-visible {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(29, 116, 216, 0.16);
}

input[readonly] {
    background: #f2f0f4;
    color: var(--muted);
}

input[type="file"] {
    padding: 8px;
}

.radio-field {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
}

.radio-field label {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.radio-field input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--brand);
}

.field-error {
    min-height: 24px;
    font-size: 0.9rem;
}

.file-note {
    color: var(--muted);
    font-size: 0.86rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 16px;
    align-items: center;
}

.photo-preview {
    display: grid;
    place-items: center;
    width: 190px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: 1px dashed var(--brand);
    border-radius: 8px;
    background: #faf7fb;
    color: var(--muted);
    text-align: center;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-tools,
.camera-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.camera-box {
    margin-top: 16px;
    display: grid;
    gap: 12px;
    justify-items: start;
}

.camera-box video {
    width: min(100%, 420px);
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    background: #141019;
}

.conditional-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.solid-button,
.outline-button {
    min-height: 44px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--brand);
    font-weight: 800;
}

.solid-button {
    background: var(--brand);
    color: #fff;
}

.solid-button:hover {
    background: var(--brand-dark);
}

.solid-button:disabled {
    cursor: not-allowed;
    border-color: #c9c3cf;
    background: #c9c3cf;
}

.outline-button {
    background: #fff;
    color: var(--brand-dark);
}

.outline-button:hover {
    background: #f7edf8;
}

.form-actions {
    justify-content: flex-start;
    padding: 6px 0;
}

@media (max-width: 900px) {
    .topbar,
    .form-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .entry-selector,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .generated-id {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 16px;
    }

    .entry-selector,
    .form-grid,
    .photo-grid,
    .conditional-fields {
        grid-template-columns: 1fr;
    }

    .year-pill {
        white-space: normal;
    }

    .photo-preview {
        width: min(100%, 220px);
    }

    .form-section,
    .form-heading {
        padding: 14px;
    }
}
