:root {
    --bg: #fbfaf6;
    --bg-light: #ffffff;
    --bg-dark: #0e2a47;
    --ink: #1a1a1a;
    --ink-soft: #4a5568;
    --accent: #1d4ed8;
    --accent-soft: #e0e7ff;
    --gold: #b8924a;
    --line: #e6e2d6;
    --shadow: 0 6px 30px rgba(20, 30, 60, 0.08);
    --radius: 14px;
    --max: 1140px;
    --serif: "Frank Ruhl Libre", Georgia, "Times New Roman", serif;
    --sans: "Heebo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.7;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5em;
    color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 900; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.2rem; font-weight: 700; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(251, 250, 246, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.nav-container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand-name {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--ink);
}
.brand-sub {
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-top: 2px;
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-links a {
    color: var(--ink);
    font-weight: 500;
    font-size: 0.98rem;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 8px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--ink);
    margin: 5px 0;
    transition: transform 0.2s, opacity 0.2s;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: clamp(80px, 14vw, 160px) 24px clamp(70px, 12vw, 120px);
    background:
        radial-gradient(1100px 480px at 70% -10%, rgba(29, 78, 216, 0.10), transparent 60%),
        radial-gradient(700px 400px at 0% 100%, rgba(184, 146, 74, 0.10), transparent 60%),
        var(--bg);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to left, rgba(20, 30, 60, 0.04) 1px, transparent 1px);
    background-size: 60px 100%;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-family: var(--serif);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.hero-lead {
    font-size: clamp(1.05rem, 1.5vw, 1.2rem);
    max-width: 640px;
    margin: 0 auto 36px;
    color: var(--ink-soft);
}

.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s, color 0.2s;
    font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.25);
}
.btn-primary:hover { background: #1e40af; box-shadow: 0 10px 28px rgba(29, 78, 216, 0.35); }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg-light); }

/* ---------- Sections ---------- */
.section {
    padding: clamp(60px, 9vw, 110px) 0;
}
.section-light { background: var(--bg-light); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-dark {
    background: linear-gradient(140deg, #0e2a47 0%, #1d4ed8 130%);
    color: #f5f7fb;
}
.section-dark h2, .section-dark p { color: #f5f7fb; }

.section-head {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 60px;
}
.kicker {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 14px;
}
.section-sub { font-size: 1.1rem; }

/* ---------- Cards ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}
.card {
    background: var(--bg-light);
    padding: 28px 26px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
}
.section-light .card { background: var(--bg); }
.card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 28px;
    width: 36px;
    height: 3px;
    background: var(--gold);
    border-radius: 0 0 4px 4px;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: transparent;
}
.card h3 { color: var(--ink); margin-bottom: 8px; }
.card p { margin: 0; font-size: 0.98rem; }

/* ---------- Goals list ---------- */
.goals-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 820px;
    margin: 0 auto;
    display: grid;
    gap: 16px;
}
.goals-list li {
    background: var(--bg-light);
    padding: 22px 26px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    border-right: 4px solid var(--gold);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.goals-list strong {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
}
.goals-list span { color: var(--ink-soft); }

/* ---------- Join form ---------- */
.join-container { max-width: 920px; margin: 0 auto; }
.join-head { text-align: center; margin-bottom: 48px; }
.join-lead { font-size: 1.1rem; opacity: 0.92; max-width: 580px; margin: 0 auto; }
.kicker-light { color: var(--gold); }

.join-cta {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.join-note { margin: 0; font-size: 0.88rem; opacity: 0.7; color: #f5f7fb; }

.join-form {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: clamp(24px, 4vw, 44px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: formSlideIn 0.45s ease both;
    margin-top: 12px;
}
.join-form[hidden] { display: none; }

@keyframes formSlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-grid { display: flex; flex-direction: column; gap: 32px; }

.form-group {
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0; /* Reset fieldset's min-content default that breaks grids */
    inline-size: 100%;
}
.form-group legend {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 18px;
    padding: 0 12px 0 0;
    border-right: 3px solid var(--gold);
}

.form-row { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-row-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 640px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.field + .field { margin-top: 16px; }
.form-row-2 > .field + .field,
.form-row > .field + .field { margin-top: 0; }
.field-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e6ebf5;
    line-height: 1.4;
    min-height: 1.4em;
}
.field-label em {
    color: var(--gold);
    font-style: normal;
    margin-inline-start: 2px;
}

.join-form input[type="text"],
.join-form input[type="email"],
.join-form input[type="tel"],
.join-form input[type="date"],
.join-form textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    font-family: inherit;
    font-size: 1rem;
    line-height: normal;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    direction: rtl;
    -webkit-appearance: none;
    appearance: none;
}
.join-form input[type="date"]::-webkit-date-and-time-value {
    text-align: right;
}
.join-form input[type="date"] {
    font-family: var(--sans);
    height: 48px; /* Force consistent height to fix iOS date input bugs */
    width: 100% !important;
    min-width: 0 !important; /* iOS Safari adds -webkit-min-logical-width that overflows; reset it */
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}
/* Some iOS versions still expand the date input via the picker indicator — clamp it */
.join-form input[type="date"]::-webkit-calendar-picker-indicator {
    margin: 0;
    padding: 0;
}
.join-form textarea { resize: vertical; min-height: 100px; }
.join-form input:focus,
.join-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 146, 74, 0.35);
    background: white;
}
.join-form input:invalid:not(:placeholder-shown) {
    border-color: rgba(245, 96, 96, 0.7);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 4px;
}
.checkbox-group-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.95rem;
    color: #f0f4fb;
    user-select: none;
}
.check:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.28); }
.check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.check input[type="checkbox"]:checked {
    background: var(--gold);
    border-color: var(--gold);
}
.check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #0a1d33;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.check:has(input:checked) {
    background: rgba(184, 146, 74, 0.18);
    border-color: rgba(184, 146, 74, 0.6);
}

.form-actions {
    text-align: center;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-join {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 44px;
    border: 0;
    border-radius: 999px;
    background: var(--gold);
    color: #0a1d33;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(184, 146, 74, 0.35);
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    font-family: inherit;
}
.btn-join:hover:not(:disabled) {
    background: #d2a85a;
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(184, 146, 74, 0.5);
    text-decoration: none;
}
.btn-join:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.btn-join .btn-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 1.2em;
}
.btn-join:hover:not(:disabled) .btn-arrow { transform: translateX(-4px); }

.form-status {
    margin: 16px 0 0;
    min-height: 1.4em;
    font-size: 0.95rem;
    color: #f0f4fb;
}
.form-status.is-success { color: #8ce0a8; font-weight: 600; }
.form-status.is-error { color: #ff8a8a; }

/* ---------- Dedicated Join page ---------- */
.join-page main { min-height: calc(100vh - 200px); }
.join-section { padding-top: clamp(60px, 9vw, 110px); }
.join-page .site-footer { background: #0a1d33; }

/* Thank-you view */
.thanks-view {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    padding: clamp(40px, 8vw, 80px) 24px;
    color: #f5f7fb;
    animation: thanksFade 0.6s ease both;
}
@keyframes thanksFade {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.thanks-icon {
    color: var(--gold);
    margin-bottom: 20px;
    animation: thanksPop 0.6s 0.1s ease both;
}
@keyframes thanksPop {
    0%   { transform: scale(0.4); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
.thanks-icon svg path { stroke-dasharray: 50; stroke-dashoffset: 50; animation: thanksDraw 0.5s 0.5s ease forwards; }
@keyframes thanksDraw { to { stroke-dashoffset: 0; } }

.thanks-title {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 900;
    margin: 0 0 18px;
    color: white;
    letter-spacing: -0.01em;
}
.thanks-lead {
    font-size: 1.15rem;
    color: #e6ebf5;
    margin: 0 0 14px;
    line-height: 1.7;
}
.thanks-lead #thanksName { color: var(--gold); font-weight: 600; }
.thanks-sub {
    font-size: 0.98rem;
    color: #b6c2d7;
    margin: 0 0 32px;
}
.thanks-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-ghost-light {
    background: transparent;
    color: #f5f7fb;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.btn-ghost-light:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #0a1d33;
    color: #cfd6e3;
    padding: 50px 0 30px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
}
.site-footer .brand-name { color: white; font-size: 1.3rem; }
.site-footer .brand-sub { color: #aab4c4; }
.footer-links { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: #cfd6e3; }
.footer-links a:hover { color: white; text-decoration: none; }
.footer-meta { text-align: left; font-size: 0.9rem; color: #8a93a3; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .nav-links {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--bg-light);
        flex-direction: column;
        gap: 0;
        padding: 12px 24px;
        border-bottom: 1px solid var(--line);
        transform: translateY(-10px);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.2s, opacity 0.2s;
    }
    .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .nav-links li { border-bottom: 1px solid var(--line); }
    .nav-links li:last-child { border-bottom: 0; }
    .nav-links a { display: block; padding: 14px 0; }

    .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .footer-meta { text-align: center; }
}

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
