/* ============================================
   View Street Block Party
   Bitumen, chalk, footpath, bunting.
   ============================================ */

:root {
    --bitumen: #2B2D31;
    --bitumen-deep: #222428;
    --chalk: #F7F3EA;
    --chalk-dim: #B9B4A8;
    --footpath: #E6E1D6;
    --footpath-ink: #2B2D31;
    --yellow: #FFD84D;
    --pink: #FF8FB1;
    --sky: #5CC8E8;
    --poinciana: #E8442E;
    --lime: #9BE15D;
    --sign-blue: #1F5FA8;

    --font-chalk: 'Cabin Sketch', 'Comic Sans MS', cursive;
    --font-body: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;

    --radius: 18px;
    --wrap: 1080px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bitumen);
    color: var(--chalk);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Bitumen grain: fine speckle so the dark reads as road, not a void */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.22;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

header, main, footer { position: relative; z-index: 1; }

a { color: inherit; }

:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
    border-radius: 6px;
}

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

.wrap-narrow { max-width: 720px; }

.hidden,
[hidden] { display: none !important; }

/* ---------- Chalk lettering ---------- */
.chalk {
    font-family: var(--font-chalk);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: 0.01em;
}
.chalk-white { color: var(--chalk); }
.chalk-yellow { color: var(--yellow); }

/* ---------- Bunting ---------- */
.bunting {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    z-index: 3;
    pointer-events: none;
}
.bunting-string {
    fill: none;
    stroke: var(--chalk-dim);
    stroke-width: 1.5;
}
.bunting .flag {
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: flutter 3.2s ease-in-out infinite alternate;
}
@keyframes flutter {
    from { transform: rotate(-5deg); }
    to   { transform: rotate(5deg); }
}

/* ---------- Hero ---------- */
#hero {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 110px 20px 80px;
    overflow: hidden;
}

/* Dashed centre line running down the road */
.road-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 10px;
    transform: translateX(-50%);
    background: repeating-linear-gradient(to bottom, rgba(247, 243, 234, 0.13) 0 60px, transparent 60px 110px);
}

.hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 860px;
}

.street-sign {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
    background: var(--sign-blue);
    color: #fff;
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px var(--sign-blue), 0 14px 30px rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    padding: 8px 22px 6px;
    font-family: var(--font-body);
    font-weight: 800;
    letter-spacing: 0.12em;
    transform: rotate(-3deg);
    margin-bottom: 28px;
}
.sign-name { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.sign-type { font-size: clamp(0.95rem, 2.4vw, 1.25rem); }

.hero-title {
    margin: 0;
    font-size: clamp(4.6rem, 15vw, 9.5rem);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 0.25em;
}
.hero-title .chalk { display: inline-block; }
.hero-title .chalk-yellow { transform: rotate(2deg); }

.scribble {
    display: block;
    width: min(420px, 80%);
    margin: 4px auto 22px;
}
.scribble path {
    fill: none;
    stroke: var(--pink);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 460;
    stroke-dashoffset: 460;
    animation: draw 1s 0.5s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero-when {
    font-size: clamp(1.1rem, 2.6vw, 1.45rem);
    margin: 0 0 10px;
}
.hero-when strong { color: var(--yellow); font-weight: 800; }
.hero-when .dot { color: var(--pink); margin: 0 0.3em; }

.hero-pitch {
    color: var(--chalk-dim);
    max-width: 34em;
    margin: 0 auto 36px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

/* "Sleeps to go" — kid-speak countdown, chalked in a circle */
.sleeps {
    display: grid;
    place-items: center;
    width: 118px;
    height: 118px;
    border: 3px dashed var(--sky);
    border-radius: 50%;
    transform: rotate(-6deg);
    line-height: 1;
}
.sleeps-num {
    font-family: var(--font-chalk);
    font-weight: 700;
    font-size: 2.8rem;
    color: var(--sky);
}
.sleeps-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-top: -18px;
}

/* Doodles */
.doodle {
    position: absolute;
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
    z-index: 1;
}
.doodle-sun   { stroke: var(--yellow); width: 120px; top: 16%; left: 6%; }
.doodle-star  { stroke: var(--sky);    width: 80px;  bottom: 14%; left: 14%; transform: rotate(-12deg); }
.doodle-heart { stroke: var(--pink);   width: 90px;  top: 24%; right: 8%; transform: rotate(10deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
    border-radius: 999px;
    padding: 16px 30px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-yellow {
    background: var(--yellow);
    color: var(--bitumen);
    box-shadow: 0 6px 0 #C9A21C;
}
.btn-yellow:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #C9A21C; }
.btn-yellow:active { transform: translateY(4px); box-shadow: 0 2px 0 #C9A21C; }

.btn-ghost {
    background: transparent;
    color: var(--chalk);
    border-color: var(--chalk-dim);
    font-size: 1rem;
    padding: 12px 24px;
}
.btn-ghost:hover { border-color: var(--chalk); }

/* ---------- Kerb & gutter: section dividers ---------- */
.kerb {
    position: relative;
    z-index: 1;
    height: 34px;
    background:
        linear-gradient(to bottom, #C9C3B5 0 12px, #9E988B 12px 16px, #6B675F 16px 34px);
}
.kerb-flip { transform: scaleY(-1); }

/* ---------- Footpath (light) section ---------- */
.footpath {
    background: var(--footpath);
    color: var(--footpath-ink);
    padding: 80px 0 90px;
    /* expansion joints in the concrete */
    background-image: repeating-linear-gradient(to right, transparent 0 239px, rgba(43, 45, 49, 0.08) 239px 241px);
}

.section-title {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.02em;
    margin: 0 0 28px;
}
.section-title + .section-sub { margin-top: -14px; }
.section-title-chalk {
    font-family: var(--font-chalk);
    font-weight: 700;
    color: var(--yellow);
    font-size: clamp(2.8rem, 8vw, 4.4rem);
    letter-spacing: 0;
    margin-bottom: 14px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px 22px 26px;
    border-top: 10px solid var(--accent);
    box-shadow: 0 2px 0 rgba(43, 45, 49, 0.08);
}
.card:nth-child(odd)  { transform: rotate(-0.8deg); }
.card:nth-child(even) { transform: rotate(0.8deg); }
.card h3 {
    font-family: var(--font-chalk);
    font-weight: 700;
    font-size: 2rem;
    margin: 0 0 8px;
    color: var(--bitumen);
}
.card p { margin: 0; }
.card-yellow { --accent: var(--yellow); }
.card-blue   { --accent: var(--sky); }
.card-pink   { --accent: var(--pink); }
.card-green  { --accent: var(--lime); }


/* ---------- RSVP (bitumen) section ---------- */
.bitumen {
    padding: 80px 0 100px;
}
.section-sub {
    color: var(--chalk-dim);
    margin: 0 0 36px;
}

form { display: grid; gap: 22px; }

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
}
.field-row > .field { flex: 1 1 200px; }
.field-row > .field-house { flex: 0 1 130px; }

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}
.field label,
.field legend,
.field .label {
    font-weight: 600;
    font-size: 1rem;
    padding: 0;
}
.field legend { margin-bottom: 10px; }
.opt {
    font-weight: 400;
    color: var(--chalk-dim);
    font-size: 0.88rem;
    margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    font: inherit;
    color: var(--bitumen);
    background: var(--chalk);
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 13px 16px;
    transition: border-color 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #8E8A80; }
input:focus, textarea:focus {
    outline: none;
    border-color: var(--yellow);
}
textarea { resize: vertical; }

.field-error {
    color: var(--pink);
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 0;
}
.field-error:empty { display: none; }

/* Attendance tiles — chunky chalk-outlined squares */
.tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.tile {
    position: relative;
    cursor: pointer;
}
.tile input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}
.tile span {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 74px;
    padding: 10px;
    border: 3px dashed var(--chalk-dim);
    border-radius: 14px;
    font-family: var(--font-chalk);
    font-weight: 700;
    font-size: 1.45rem;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.tile:hover span { border-color: var(--chalk); }
.tile input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 3px; }
.tile-yes   input:checked + span { background: var(--lime);      border: 3px solid var(--lime);      color: var(--bitumen); transform: rotate(-2deg); }
.tile-maybe input:checked + span { background: var(--sky);       border: 3px solid var(--sky);       color: var(--bitumen); transform: rotate(1.5deg); }
.tile-no    input:checked + span { background: var(--chalk-dim); border: 3px solid var(--chalk-dim); color: var(--bitumen); }

/* Fields that only matter if you're coming */
.coming-fields {
    display: grid;
    gap: 22px;
}

/* Steppers */
.stepper {
    display: inline-flex;
    align-items: center;
    background: var(--bitumen-deep);
    border: 2px solid rgba(247, 243, 234, 0.18);
    border-radius: 999px;
    padding: 5px;
    width: fit-content;
}
.stepper input {
    width: 3.2ch;
    text-align: center;
    font-family: var(--font-chalk);
    font-weight: 700;
    font-size: 1.8rem;
    background: transparent;
    border: 0;
    color: var(--chalk);
    -moz-appearance: textfield;
    appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    background: var(--chalk);
    color: var(--bitumen);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.step:hover { background: var(--yellow); }

/* Bring-a-plate chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.chip { position: relative; cursor: pointer; }
.chip input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}
.chip span {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    border: 2px solid rgba(247, 243, 234, 0.35);
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover span { border-color: var(--chalk); }
.chip input:checked + span {
    background: var(--pink);
    border-color: var(--pink);
    color: var(--bitumen);
}
.chip input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 3px; }

.btn-submit {
    justify-self: start;
    margin-top: 6px;
    font-size: 1.2rem;
    padding: 18px 36px;
}
.btn-submit .btn-loading { display: none; }
.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .btn-loading { display: inline; }
.btn-submit:disabled { cursor: progress; opacity: 0.85; }

/* Success */
.rsvp-success {
    text-align: center;
    padding: 40px 20px;
    border: 3px dashed var(--yellow);
    border-radius: var(--radius);
}
.success-title {
    font-size: clamp(3rem, 10vw, 4.8rem);
    margin: 0 0 14px;
}
.success-message {
    font-size: 1.15rem;
    max-width: 32em;
    margin: 0 auto 28px;
}

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 40px 20px 56px;
    border-top: 2px dashed rgba(247, 243, 234, 0.2);
    font-weight: 600;
}
.site-footer p { margin: 0; }
.footer-small {
    margin-top: 6px !important;
    color: var(--chalk-dim);
    font-weight: 400;
    font-size: 0.95rem;
}

#confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    body { font-size: 1rem; }
    #hero { padding-top: 96px; }
    .cards { grid-template-columns: 1fr; }
    .card:nth-child(n) { transform: none; }
    .tiles { grid-template-columns: 1fr; }
    .tile span { min-height: 58px; }
    .doodle-sun { width: 70px; top: 9%; left: 2%; }
    .doodle-heart { width: 56px; top: 12%; right: 4%; }
    .doodle-star { width: 54px; bottom: 6%; }
    .btn-submit { justify-self: stretch; }
    .footpath { padding: 60px 0 70px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .bunting .flag { animation: none; }
    .scribble path { animation: none; stroke-dashoffset: 0; }
    .btn, .tile span, .chip span { transition: none; }
}
