/* RocketPeeps — mobile-first, no framework, no build step. */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-alt: #f0f2f8;
    --border: #dde1ec;
    --text: #1b2033;
    --text-muted: #5d6478;
    --accent: #e8590c;
    --accent-dark: #c14708;
    --going: #1f8a4c;
    --going-bg: #e6f5ec;
    --interested: #b8791a;
    --interested-bg: #fdf3e2;
    --maybe: #5d6478;
    --maybe-bg: #eceef4;
    --warn: #a8390b;
    --warn-bg: #fdece4;
    --warn-border: #f3c3a8;
    --danger: #b02a1f;
    --focus: #2563eb;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(21, 26, 44, .06), 0 4px 14px rgba(21, 26, 44, .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12141c;
        --surface: #1b1e29;
        --surface-alt: #232735;
        --border: #313649;
        --text: #eef0f7;
        --text-muted: #a2a9bd;
        --accent: #ff7a35;
        --accent-dark: #ff9257;
        --going: #5ed48f;
        --going-bg: #14331f;
        --interested: #f0b25a;
        --interested-bg: #35280f;
        --maybe: #a2a9bd;
        --maybe-bg: #262a38;
        --warn: #ffb08a;
        --warn-bg: #3a1e10;
        --warn-border: #6b3418;
        --danger: #ff8073;
        --focus: #7aa2ff;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- header ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    margin-right: auto;
}

.brand strong {
    font-size: 1.25rem;
    letter-spacing: -.02em;
}

.brand span {
    color: var(--text-muted);
    font-size: .8rem;
    display: none;
}

@media (min-width: 560px) {
    .brand span {
        display: inline;
    }
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .92rem;
}

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--accent);
}

.site-nav form {
    display: inline;
}

.linkish {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--text-muted);
    cursor: pointer;
}

.linkish:hover {
    color: var(--accent);
}

/* ---------- layout ---------- */

main {
    padding: 20px 0 64px;
}

h1 {
    font-size: 1.5rem;
    letter-spacing: -.02em;
    margin: 0 0 4px;
}

h2 {
    font-size: 1.05rem;
    margin: 28px 0 10px;
}

h3 {
    font-size: .95rem;
    margin: 20px 0 8px;
}

.lede {
    color: var(--text-muted);
    margin: 0 0 20px;
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: .85rem;
}

.empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ---------- filters ---------- */

.filters {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
}

.filters a {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
}

.filters a[aria-current="page"] {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
    font-weight: 600;
}

/* ---------- event cards ---------- */

.card-list {
    display: grid;
    gap: 12px;
}

.event-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    text-decoration: none;
    color: inherit;
}

.event-card:hover {
    border-color: var(--accent);
}

.event-card h2 {
    margin: 0 0 2px;
    font-size: 1.15rem;
    color: var(--text);
}

.event-card .where {
    color: var(--text-muted);
    font-size: .92rem;
}

.event-card .when {
    font-weight: 600;
    margin-top: 6px;
}

.event-card .go {
    margin-top: 12px;
    color: var(--accent);
    font-weight: 600;
    font-size: .92rem;
}

/* ---------- date status ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    margin-top: 8px;
}

.chip-warn {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid var(--warn-border);
}

.chip-ok {
    background: var(--going-bg);
    color: var(--going);
    border: 1px solid transparent;
}

.date-caveat {
    margin: 10px 0 0;
    font-size: .85rem;
    color: var(--text-muted);
}

/* ---------- counts ---------- */

.counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    font-size: .88rem;
}

.count {
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.count-going {
    background: var(--going-bg);
    color: var(--going);
}

.count-interested {
    background: var(--interested-bg);
    color: var(--interested);
}

.count-maybe {
    background: var(--maybe-bg);
    color: var(--maybe);
}

.count-none {
    color: var(--text-muted);
    font-weight: 400;
}

/* ---------- panels ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 14px;
}

.panel h2:first-child,
.panel h3:first-child {
    margin-top: 0;
}

dl.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    margin: 0;
    font-size: .94rem;
}

dl.facts dt {
    color: var(--text-muted);
}

dl.facts dd {
    margin: 0;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn-block {
    width: 100%;
}

.btn-small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: .88rem;
    font-weight: 600;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--border);
}

.btn-danger:hover {
    border-color: var(--danger);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- RSVP ---------- */

.rsvp {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin: 18px 0 14px;
}

.rsvp h2 {
    margin: 0 0 10px;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.rsvp-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.rsvp-buttons button {
    flex-direction: column;
    gap: 2px;
    min-height: 54px;
    line-height: 1.2;
}

.rsvp-buttons button[aria-pressed="true"].going {
    background: var(--going-bg);
    border-color: var(--going);
    color: var(--going);
}

.rsvp-buttons button[aria-pressed="true"].interested {
    background: var(--interested-bg);
    border-color: var(--interested);
    color: var(--interested);
}

.rsvp-buttons button[aria-pressed="true"].maybe {
    background: var(--maybe-bg);
    border-color: var(--maybe);
    color: var(--maybe);
}

.rsvp-current {
    margin: 10px 0 0;
    font-size: .88rem;
    color: var(--text-muted);
}

.rsvp-remove {
    margin-top: 8px;
}

/* ---------- participants ---------- */

.people {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.person {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--surface-alt);
}

.person .name {
    font-weight: 600;
}

.person .meta {
    font-size: .85rem;
    color: var(--text-muted);
}

.person .ride {
    display: inline-block;
    margin-top: 4px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--going);
    background: var(--going-bg);
    border-radius: 999px;
    padding: 1px 9px;
}

.person .ride.need {
    color: var(--interested);
    background: var(--interested-bg);
}

.person .tags {
    margin-top: 4px;
    font-size: .8rem;
    color: var(--text-muted);
}

.person .trip-note {
    margin: 6px 0 0;
    font-size: .9rem;
    white-space: pre-wrap;
}

.group-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 18px 0 8px;
}

.group-heading h3 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .78rem;
    color: var(--text-muted);
}

.locked {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: .94rem;
}

/* ---------- forms ---------- */

.field {
    margin-bottom: 14px;
}

.field label,
fieldset legend {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 5px;
}

.field .hint {
    display: block;
    font-weight: 400;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    font-size: .94rem;
}

.check label {
    margin: 0;
    font-weight: 400;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin: 0 0 14px;
}

.grid-2 {
    display: grid;
    gap: 0 12px;
}

@media (min-width: 520px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.otp-input {
    font-size: 1.6rem;
    letter-spacing: .4em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.error-text {
    color: var(--danger);
    font-size: .85rem;
    margin-top: 4px;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

/* ---------- flash ---------- */

.flash {
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: .94rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--going-bg);
    color: var(--going);
    border-color: var(--going);
}

.flash-error {
    background: var(--warn-bg);
    color: var(--danger);
    border-color: var(--warn-border);
}

.flash-info {
    background: var(--surface-alt);
    color: var(--text);
    border-color: var(--border);
}

/* ---------- details / trip form ---------- */

details.trip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 14px;
}

details.trip > summary {
    cursor: pointer;
    font-weight: 600;
    list-style: revert;
}

details.trip[open] > summary {
    margin-bottom: 12px;
}

.privacy-note {
    font-size: .82rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    border-radius: 8px;
    padding: 7px 10px;
    margin: 0 0 8px;
}

/* ---------- tables (admin) ---------- */

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th,
td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--text-muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    background: var(--surface-alt);
    color: var(--text-muted);
}

.badge-admin {
    background: var(--warn-bg);
    color: var(--warn);
}

.badge-planner {
    background: var(--interested-bg);
    color: var(--interested);
}

.badge-disabled {
    background: var(--maybe-bg);
    color: var(--maybe);
}

.badge-active {
    background: var(--going-bg);
    color: var(--going);
}

/* ---------- share ---------- */

.share-url {
    width: 100%;
    font-size: .85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin-top: 8px;
}

/* ---------- footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 18px 0 30px;
    color: var(--text-muted);
    font-size: .85rem;
}

.site-footer .wrap {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 16px;
    top: 10px;
    z-index: 10;
    background: var(--surface);
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
}

/* ---------- utility classes ----------
   These exist because the Content-Security-Policy is style-src 'self', which
   blocks inline style="..." attributes. Anything that would have been an
   inline style belongs here instead. */

.tight {
    margin-bottom: 6px;
}

.event-when {
    font-weight: 600;
    margin: 0 0 6px;
}

.counts-lead {
    margin-top: 12px;
}

.prose {
    white-space: pre-wrap;
}

.prose-spaced {
    white-space: pre-wrap;
    margin-top: 12px;
}

.mt-sm {
    margin-top: 8px;
}

.mt-lg {
    margin-top: 24px;
}

.fieldset-hint {
    margin-top: -2px;
    display: block;
}

.debug-trace {
    text-align: left;
    overflow: auto;
    font-size: .78rem;
}

/* ---------- admin screens ---------- */

/* 680px is right for reading one event on a phone. An admin table has seven
   columns and needs considerably more room. */
body.admin main .wrap {
    max-width: 1080px;
}

/* Form controls are width:100% by default, which is correct in a stacked form
   and wrong inside a table cell — it stretched the role dropdown across the
   whole column and pushed the Set button underneath the Status badge. */
table select,
table input[type="text"],
table input[type="email"],
table input[type="number"] {
    width: auto;
    min-height: 38px;
    padding: 6px 10px;
}

.role-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.role-form select {
    min-width: 104px;
}

/* Keep the action buttons on one line rather than wrapping mid-row. */
td .btn-row {
    flex-wrap: nowrap;
}

.people-table th,
.people-table td {
    vertical-align: middle;
}

/* The default button padding is generous for a full-width button; in a
   three-across row on a 390px phone it forced "I'm Going" onto two lines. */
.rsvp-buttons .btn {
    padding-left: 6px;
    padding-right: 6px;
    font-size: .95rem;
}

/* A quiet hint that the admin table scrolls sideways on a narrow screen. */
.table-scroll {
    scrollbar-width: thin;
}

/* ---------- compact launch list ----------
   One row per launch with the RSVP controls inline, so a phone shows several
   launches at once and responding never needs a page change. */

.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.list-head h1 {
    margin: 0;
}

.list-head .filters {
    margin: 0;
}

.list-hint {
    margin: 0 0 10px;
}

.launches {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.launch {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.launch:last-child {
    border-bottom: 0;
}

.launch-mine {
    background: var(--surface-alt);
}

.launch-body {
    flex: 1 1 15rem;
    min-width: 0;
}

.launch-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.launch-name {
    font-weight: 650;
    font-size: 1.02rem;
    color: var(--text);
    text-decoration: none;
}

.launch-name:hover {
    color: var(--accent);
    text-decoration: underline;
}

.flag {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--warn);
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: 999px;
    padding: 1px 7px;
    white-space: nowrap;
}

.launch-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .88rem;
    margin-top: 1px;
}

.launch-when {
    font-weight: 600;
}

.launch-where {
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.launch-counts {
    color: var(--text-muted);
}

/* Separate the meta items with a dot, so date, place and counts share one
   line instead of costing three. */
.launch-meta > span + span::before {
    content: "·";
    margin-right: 6px;
    color: var(--text-muted);
    opacity: .5;
}

/* The three quick-RSVP buttons. Deliberately small and quiet until chosen —
   they repeat on every row, so a row of bright buttons would be noise. */
.launch-rsvp {
    display: flex;
    gap: 5px;
    flex: 0 0 auto;
    margin-left: auto;
}

.quick {
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    min-height: 34px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.quick:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.quick[aria-pressed="true"].going {
    background: var(--going-bg);
    border-color: var(--going);
    color: var(--going);
}

.quick[aria-pressed="true"].interested {
    background: var(--interested-bg);
    border-color: var(--interested);
    color: var(--interested);
}

.quick[aria-pressed="true"].maybe {
    background: var(--maybe-bg);
    border-color: var(--maybe);
    color: var(--text);
}

.quick[disabled] {
    opacity: .55;
    cursor: progress;
}

.list-count {
    margin-top: 12px;
}

/* On a narrow phone the buttons drop below the name and stretch to fill the
   row, which keeps them comfortably tappable. */
@media (max-width: 30rem) {
    .launch {
        gap: 6px;
        padding: 8px 12px;
    }

    .launch-rsvp {
        width: 100%;
        margin-left: 0;
    }

    .quick {
        flex: 1 1 0;
        min-height: 38px;
    }
}
