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

html {
    scroll-behavior: smooth;
}

body {
    background: #FAFAF7;
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    justify-content: center;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: #444444;
}

input:focus {
    outline: none;
}

/* Hero's animated typewriter placeholder is a green design accent */
.slug-input::placeholder {
    color: #1F8A5B;
    opacity: 1;
}

/* Form fields: demo values live as muted-grey placeholders so they read as
   fill-in-the-blank prompts, not committed values */
.field-input::placeholder {
    color: #A8A69C;
    opacity: 1;
}

.page {
    width: 100%;
    max-width: 1180px;
    background: #FAFAF7;
    color: #111111;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Nav */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 22px clamp(20px, 4vw, 48px);
    border-bottom: 1px solid #E4E2DA;
}

.wordmark {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 17px;
    font-weight: 600;
}

/* The favicon tile itself, as the nav mark — one source of truth. Kept
   inline (not a flex wordmark): flex would split the text runs into items
   and put the gap inside "whenparty.com". */
.wordmark-balloon {
    height: 24px;
    width: 24px;
    display: inline-block;
    vertical-align: -7px;
    margin-right: 8px;
}

.wordmark-party {
    color: #1F8A5B;
}

.wordmark-tld {
    color: #9B988E;
}

/* Hero */
.hero {
    padding: clamp(48px, 9vw, 96px) clamp(20px, 4vw, 48px) clamp(40px, 7vw, 72px) clamp(20px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 28px);
}

.kicker {
    font-size: clamp(16px, 2vw, 20px);
    font-family: 'IBM Plex Mono', monospace;
    color: #1F8A5B;
}

.headline {
    font-size: clamp(36px, 5.5vw, 64px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    max-width: 900px;
    text-wrap: balance;
}

.url-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(19px, 3vw, 34px);
    margin-top: 20px;
}

.url-prefix {
    color: #111111;
    white-space: nowrap;
}

.slug-input {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(19px, 3vw, 34px);
    border: none;
    border-bottom: 3px solid #111111;
    background: transparent;
    /* Typed slug is green to match the placeholder and the "party" accent —
       the slug is the star of the hero. */
    color: #1F8A5B;
    /* Small flex-basis so the input never wraps below the prefix — wrap
       decisions use basis, not shrunk size. It grows into whatever width
       remains on the line (~175px at 375px, plenty for a placeholder). */
    flex: 1 1 120px;
    min-width: 0;
    max-width: 420px;
    padding: 2px 4px;
}

/* How it works */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
    border-top: 1px solid #E4E2DA;
    border-bottom: 1px solid #E4E2DA;
    overflow: hidden;
}

.step {
    background: #FAFAF7;
    outline: 1px solid #E4E2DA;
    padding: 32px clamp(20px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-number {
    font-family: 'IBM Plex Mono', monospace;
    color: #1F8A5B;
    font-size: 14px;
}

.step-title {
    font-size: 21px;
    font-weight: 600;
}

.step-body {
    font-size: 15px;
    color: #6B6A63;
    line-height: 1.5;
}

/* Tablet and up only: on a phone the three cards stack into most of a
   screen of scroll between the hero and the form, and the try-then-buy
   preview already teaches the flow by doing. (Must follow the base .steps
   rule — the media query adds no specificity.) */
@media (max-width: 700px) {
    .steps {
        display: none;
    }
}

/* Setup form + preview */
.setup {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: 48px;
    padding: clamp(40px, 6vw, 64px) clamp(20px, 4vw, 48px);
    align-items: start;
}

.form-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Colorscheme + pay sit directly below the preview on every viewport —
   picking a scheme restyles the thing right above it. On two-column
   widths the form spans both rows on the left; preview + finish stack
   on the right, which also balances the columns (the form ran long). */
.finish-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

@media (min-width: 701px) {
    .setup {
        grid-template-columns: 1fr 1fr;
        /* Tighter row gap: the swatches belong to the preview above them. */
        gap: 24px 48px;
    }

    .form-col {
        grid-row: 1 / 3;
        /* Override the section's align-items: start so the form column
           fills both rows; the slack flows down into the textarea below. */
        align-self: stretch;
    }

    .preview-col,
    .finish-col {
        grid-column: 2;
    }

    /* Grow chain: form → last field (party info) → editor → textarea, so
       the textarea's bottom edge aligns with the right column's bottom. */
    #purchase-form {
        flex: 1;
    }

    #purchase-form .field:last-child {
        flex: 1;
    }

    #purchase-form .field:last-child .md-editor {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    #purchase-form .field:last-child .md-textarea {
        flex: 1;
    }
}

#purchase-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-title {
    font-size: 26px;
    font-weight: 700;
}

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

.field-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #6B6A63;
}

.field-input {
    border: 1.5px solid #D8D5CB;
    border-radius: 8px;
    padding: 13px 14px;
    font-size: 16px;
    background: #FFFFFF;
    font-family: inherit;
    color: #111111;
    width: 100%;
}

.field-input:focus {
    border-color: #26221B;
}

/* iOS Safari renders datetime-local as a button-like control: centered
   value, intrinsic width, and (once appearance is stripped) zero content
   height when empty. Normalize it to match the sibling text fields. The
   min-height mirrors the text inputs' computed height (16px line + 13px
   vertical padding + 1.5px borders); desktop browsers are unaffected. */
input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    min-height: 48px;
    text-align: left;
}

input[type="datetime-local"]::-webkit-date-and-time-value {
    text-align: left;
}

.field-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2px;
}

.swatch {
    width: 78px;
    height: 52px;
    border-radius: 8px;
    border: 2.5px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
}

.swatch.selected {
    border-color: #26221B;
}

.swatch-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.swatch-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    opacity: 0.8;
}

.field-optional {
    color: #A8A69C;
    font-size: 11px;
}

/* Markdown editor: a plain textarea with a lightweight formatting toolbar and
   a Write/Preview toggle. No editor library — mobile-first and dependency-free.
   Buttons wrap the current selection in markdown for people who don't know it;
   the textarea alone still works if scripting fails. */
.md-editor {
    border: 1.5px solid #D8D5CB;
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
}

.md-editor:focus-within {
    border-color: #26221B;
}

.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-bottom: 1.5px solid #ECEAE2;
    background: #FBFAF6;
}

.md-btn,
.md-toggle {
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    color: #26221B;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 8px 10px;
    min-width: 38px;
    min-height: 38px;
    cursor: pointer;
}

.md-btn:hover,
.md-toggle:hover {
    background: #EFEDE4;
}

.md-btn:active {
    background: #E4E1D6;
}

.md-toggle {
    margin-left: auto;
    font-size: 13px;
    color: #6B6A63;
    border-color: #D8D5CB;
}

.md-toggle[aria-pressed="true"] {
    background: #26221B;
    color: #FFFFFF;
    border-color: #26221B;
}

/* The textarea reuses field-input type styling but drops its own border and
   radius — the .md-editor wrapper owns those now. */
.md-textarea {
    border: none;
    border-radius: 0;
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.md-preview {
    padding: 13px 14px;
    min-height: 96px;
    font-size: 15px;
    line-height: 1.55;
    color: #26221B;
    overflow-wrap: break-word;
}

.md-preview.is-empty {
    color: #A8A69C;
}

.md-preview > :first-child { margin-top: 0; }
.md-preview > :last-child { margin-bottom: 0; }
.md-preview p,
.md-preview ul,
.md-preview blockquote { margin: 0.5rem 0; }
.md-preview h1,
.md-preview h2,
.md-preview h3 { font-size: 15px; margin: 0.7rem 0 0.3rem; }
.md-preview ul { padding-left: 1.3rem; }
.md-preview a { color: #1F8A5B; text-decoration: underline; }
.md-preview blockquote {
    padding-left: 0.8rem;
    border-left: 3px solid #D8D5CB;
    color: #6B6A63;
}
.md-preview code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9em;
    background: #ECEAE2;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.pay-button {
    align-self: flex-start;
    background: #1F8A5B;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    text-align: center;
    margin-top: 6px;
    cursor: pointer;
}

.pay-note {
    font-size: 13px;
    color: #6B7280;
    margin-top: 8px;
}

/* Live preview */
.preview-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    --s-bg: #002A86;
    --s-fg: #FFFFFF;
    --s-accent: #FFEA0F;
    --s-card-bg: rgba(255, 255, 255, 0.1);
    --s-row-border: rgba(255, 255, 255, 0.2);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #6B6A63;
    overflow-wrap: anywhere;
}

.preview-toggle {
    display: flex;
    border: 1.5px solid #D8D5CB;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.toggle-segment {
    padding: 6px 12px;
    cursor: pointer;
    background: transparent;
    color: #6B6A63;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

/* Thin divider between segments (not before the first) */
.toggle-segment + .toggle-segment {
    border-left: 1px solid #D8D5CB;
}

.toggle-segment.active {
    background: #111111;
    color: #FAFAF7;
}

/* WEB preview state */
.preview-web {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #D8D5CB;
    background: var(--s-bg);
    color: var(--s-fg);
    padding: clamp(26px, 4vw, 40px) clamp(14px, 3vw, 32px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.pv-countdown {
    display: flex;
    gap: clamp(5px, 1.2vw, 12px);
    align-items: center;
}

.pv-time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pv-time-value {
    font-size: clamp(26px, 4.2vw, 44px);
    font-weight: 700;
    line-height: 1;
}

.pv-time-label {
    font-size: 11px;
    letter-spacing: 0.2em;
    margin-top: 6px;
    color: var(--s-accent);
}

.pv-separator {
    font-size: clamp(20px, 3.4vw, 36px);
    font-weight: 300;
    padding-bottom: 18px;
    color: var(--s-accent);
}

.pv-event-card {
    background: var(--s-card-bg);
    border-radius: 14px;
    padding: 22px 26px;
    width: min(320px, 100%);
    display: flex;
    flex-direction: column;
}

.pv-event-title {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
    color: var(--s-accent);
    padding-bottom: 14px;
}

.pv-event-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}

.pv-event-row:first-of-type {
    border-bottom: 1px solid var(--s-row-border);
}

.pv-event-label {
    font-weight: 500;
    color: var(--s-accent);
}

.pv-event-description {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--s-row-border);
    font-size: 13px;
    line-height: 1.5;
    color: var(--s-fg);
    overflow-wrap: break-word;
}

.pv-event-description:empty {
    display: none;
}

.pv-event-description > :first-child { margin-top: 0; }
.pv-event-description > :last-child { margin-bottom: 0; }
.pv-event-description p,
.pv-event-description ul,
.pv-event-description blockquote { margin: 0.4rem 0; }
.pv-event-description h1,
.pv-event-description h2,
.pv-event-description h3 {
    font-size: 13px;
    color: var(--s-accent);
    margin: 0.5rem 0 0.25rem;
}
.pv-event-description ul { padding-left: 1.2rem; }
.pv-event-description a { color: var(--s-accent); text-decoration: underline; }
.pv-event-description blockquote {
    padding-left: 0.7rem;
    border-left: 2px solid var(--s-row-border);
    opacity: 0.85;
}

.pv-share-button {
    background: var(--s-accent);
    color: var(--s-bg);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 10px 30px;
    border-radius: 2rem;
}

/* TEXT preview state */
.preview-text {
    border-radius: 14px;
    border: 1px solid #D8D5CB;
    background: #FFFFFF;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.chat-bubble {
    background: #1B84FF;
    color: #FFFFFF;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
    font-size: 15px;
    max-width: 85%;
    overflow-wrap: anywhere;
}

.unfurl {
    width: min(300px, 100%);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.unfurl-image {
    background: var(--s-bg);
    color: var(--s-fg);
    padding: 26px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.unfurl-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--s-accent);
    text-align: center;
}

.unfurl-days {
    font-size: 28px;
    font-weight: 700;
}

.unfurl-meta {
    font-size: 12px;
    opacity: 0.85;
}

/* iMessage auto-tints this chrome strip from the image's dominant color and
   darkens it; emulate that with the scheme bg under a dark overlay + scheme fg. */
.unfurl-strip {
    background-color: var(--s-bg);
    background-image: linear-gradient(rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.24));
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.unfurl-strip-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--s-fg);
}

.unfurl-strip-domain {
    font-size: 12px;
    color: var(--s-fg);
    opacity: 0.6;
}

.delivered {
    font-size: 12px;
    color: #9B988E;
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 22px clamp(20px, 4vw, 48px);
    border-top: 1px solid #E4E2DA;
    font-size: 14px;
    color: #6B6A63;
}

.footer-brand {
    font-family: 'IBM Plex Mono', monospace;
}

.footer-wordmark {
    color: #111111;
}

.purchase-error {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #FF5470;
}

.slug-status {
    margin-top: 0.35rem;
    font-size: 0.85rem;
}

.slug-status.taken {
    color: #FF5470;
}

.slug-status.available {
    color: #1F8A5B;
}

.field-input.field-invalid {
    border-color: #FF5470;
}

/* CHAT preview: Slack-inspired unfurl — flat chrome, title above the card */
.preview-chat {
    border-radius: 14px;
    border: 1px solid #D8D5CB;
    background: #FFFFFF;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-link-line {
    font-size: 14px;
    color: #1D1C1D;
    overflow-wrap: anywhere;
}

.chat-link-url {
    color: #1264A3;
}

.chat-unfurl {
    border-left: 4px solid #E0E0E0;
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-unfurl-domain {
    font-size: 12px;
    font-weight: 700;
    color: #111111;
}

.chat-unfurl-title {
    font-size: 15px;
    font-weight: 700;
    color: #1264A3;
}

.chat-unfurl-meta {
    font-size: 13px;
    color: #454245;
}

.chat-unfurl-card {
    margin-top: 6px;
    width: min(300px, 100%);
    border-radius: 12px;
    overflow: hidden;
}
