:root {
    --color-bg: #000000;
    --color-surface: #1a1a17;
    --color-warm: #8F8B7E;
    --color-sage: #D1DCBD;
    --color-green: #B0C290;
    --color-cream: #f5f0e8;
    --color-white: #ffffff;
    --color-text: #f5f0e8;
    --color-text-muted: #b0aba3;
    --color-border: rgba(245, 240, 232, 0.14);
    --color-border-strong: rgba(245, 240, 232, 0.28);
    --color-field-bg: rgba(255, 255, 255, 0.04);
    --color-field-bg-focus: rgba(255, 255, 255, 0.07);
    --color-danger: #e8a599;

    --font-body: 'Heebo', 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 100px;
}

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

html, body {
    height: 100%;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(209, 220, 189, 0.08), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 110%, rgba(209, 220, 189, 0.04), transparent 60%);
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 24px 32px;
}

.header {
    display: flex;
    justify-content: center;
    margin-bottom: 48px;
}

.logo {
    height: 36px;
    width: auto;
    display: block;
}

/* ---------- Form section ---------- */

.form-section {
    flex: 1;
}

.form-intro {
    text-align: center;
    margin-bottom: 40px;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-sage);
    margin-bottom: 16px;
}

.title {
    font-family: var(--font-body);
    font-size: clamp(2.2rem, 5vw, 2.8rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--color-cream);
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-weight: 300;
    max-width: 480px;
    margin: 0 auto;
}

/* ---------- Form ---------- */

.declaration-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

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

/* ---------- Section grouping ---------- */

.form-block {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: 8px;
}

.block-title {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-sage);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 520px) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.required {
    color: var(--color-sage);
    font-size: 0.8rem;
    line-height: 1;
}

/* ---------- Inputs ---------- */

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-cream);
    background: var(--color-field-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="date"] {
    color-scheme: dark;
}

textarea {
    resize: vertical;
    min-height: 90px;
    font-family: var(--font-body);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--color-border-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-sage);
    background: var(--color-field-bg-focus);
    box-shadow: 0 0 0 3px rgba(209, 220, 189, 0.12);
}

/* ---------- Select ---------- */

.select-wrap {
    position: relative;
}

select {
    padding-inline-end: 42px;
    cursor: pointer;
}

select option {
    background: var(--color-surface);
    color: var(--color-cream);
}

.select-arrow {
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 8px;
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.select-wrap:hover .select-arrow {
    color: var(--color-sage);
}

/* ---------- Yes / No question groups ---------- */

.question {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-field-bg);
}

.question-text {
    font-size: 0.98rem;
    font-weight: 400;
    color: var(--color-cream);
    line-height: 1.5;
}

.choices {
    display: flex;
    gap: 10px;
}

.choice {
    flex: 1;
    position: relative;
}

.choice input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.choice span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.choice input:checked + span {
    color: var(--color-bg);
    background: var(--color-sage);
    border-color: var(--color-sage);
}

.choice input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(209, 220, 189, 0.18);
}

.choice:hover span {
    border-color: var(--color-border-strong);
}

/* Conditional detail field revealed when a question is answered "yes" */
.detail {
    margin-top: 4px;
}

.detail[hidden] {
    display: none;
}

/* ---------- Declaration text ---------- */

.declaration-text {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-field-bg);
    max-height: 320px;
    overflow-y: auto;
}

.declaration-text p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text-muted);
}

/* ---------- Consent checkbox ---------- */

.consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-field-bg);
    cursor: pointer;
}

.consent input {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.consent input:checked {
    background: var(--color-sage);
    border-color: var(--color-sage);
}

.consent input:checked::after {
    content: '';
    position: absolute;
    inset-inline-start: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid var(--color-bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.consent input:focus-visible {
    box-shadow: 0 0 0 3px rgba(209, 220, 189, 0.18);
}

.consent-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ---------- Signature ---------- */

.signature-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.signature-pad {
    width: 100%;
    height: 180px;
    background: var(--color-field-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    touch-action: none;
    cursor: crosshair;
}

.signature-pad:hover {
    border-color: var(--color-border-strong);
}

.signature-clear {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signature-clear:hover {
    border-color: var(--color-sage);
    color: var(--color-sage);
}

/* ---------- Field errors ---------- */

.field-error {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--color-danger);
    margin-top: -2px;
    animation: fadeUp 0.2s var(--ease-out) both;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea,
.question.invalid,
.consent.invalid {
    border-color: rgba(232, 165, 153, 0.55);
}

.field.invalid input:focus,
.field.invalid select:focus {
    box-shadow: 0 0 0 3px rgba(232, 165, 153, 0.15);
}

/* ---------- intl-tel-input dark theme overrides ---------- */

/* Page is RTL. The phone input sits in a dir="ltr" wrapper and we pin the
   country selector to the LEFT explicitly (direction-based positioning kept
   resolving to the right under RTL). Flag / dial code on the left, like the
   Hot Form. The Hebrew label above stays right-aligned. */
.phone-ltr {
    direction: ltr;
}

.iti {
    width: 100%;
    display: block;
    position: relative;
}

/* Force the country selector to the left edge regardless of page RTL. */
.iti__country-container {
    left: 0 !important;
    right: auto !important;
}

#phone {
    text-align: left;
    /* Fallback room for the flag/dial code on the left; JS refines to the
       exact selector width after intl-tel-input initialises. */
    padding-left: 76px;
    padding-right: 16px;
}

.iti__tel-input {
    width: 100%;
}

.iti--separate-dial-code .iti__selected-dial-code {
    color: var(--color-cream);
    font-family: var(--font-body);
}

.iti__dropdown-content {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border-strong) !important;
    border-radius: var(--radius-md) !important;
    color: var(--color-cream) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden;
}

.iti__search-input {
    background: var(--color-field-bg) !important;
    color: var(--color-cream) !important;
    border-bottom: 1px solid var(--color-border) !important;
    font-family: var(--font-body) !important;
    padding: 12px 16px !important;
}

.iti__country-list {
    background: var(--color-surface) !important;
    color: var(--color-cream) !important;
}

.iti__country:hover,
.iti__country.iti__highlight {
    background: rgba(209, 220, 189, 0.12) !important;
}

.iti__country-name {
    color: var(--color-cream) !important;
}

.iti__dial-code {
    color: var(--color-text-muted) !important;
}

/* ---------- Submit button ---------- */

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-bg);
    background: var(--color-sage);
    border: none;
    border-radius: var(--radius-pill);
    padding: 18px 32px;
    cursor: pointer;
    transition:
        background 0.3s var(--ease-out),
        transform 0.3s var(--ease-out),
        box-shadow 0.3s var(--ease-out);
    margin-top: 12px;
    align-self: stretch;
}

.submit-btn:hover {
    background: var(--color-green);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(209, 220, 189, 0.18);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.form-footnote {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 4px;
}

/* ---------- Success panel ---------- */

.success-panel {
    text-align: center;
    padding: 56px 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(209, 220, 189, 0.04);
    animation: fadeUp 0.5s var(--ease-out) both;
}

.success-panel[hidden] {
    display: none;
}

.form-section.submitted .form-intro,
.form-section.submitted .declaration-form {
    display: none !important;
}

.form-section.submitted {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-section.submitted .success-panel {
    border: none;
    background: transparent;
    padding: 24px;
    width: 100%;
}

.success-icon {
    width: 56px;
    height: 56px;
    color: var(--color-sage);
    margin-bottom: 20px;
}

.success-title {
    font-family: var(--font-body);
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--color-cream);
    margin-bottom: 12px;
}

.success-text {
    font-size: 0.98rem;
    color: var(--color-text-muted);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Footer ---------- */

.footer {
    margin-top: 48px;
    padding-top: 24px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

/* ---------- Reduced motion ---------- */

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