/* styles.css — visual design for do.not.omit.me.
   Monochrome ink-on-paper throughout; the only colour lives in the grid cells. */

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

:root {
    color-scheme: light;
    --max-width: 44rem;

    /* Monochrome palette — the UI is intentionally colourless. */
    --paper: #ffffff;
    --ink: #17191c;
    --muted: #6b7178;
    --line: color-mix(in srgb, var(--ink) 14%, transparent);
    --line-strong: color-mix(in srgb, var(--ink) 32%, transparent);
}

body {
    font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-weight: 400;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    margin: 0 auto;
    max-width: var(--max-width);
    padding: 2.5rem 1.25rem 4rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.95rem;
    margin: 0 0 0.35rem;
}

h2 {
    font-size: 1.15rem;
    margin: 2rem 0 0.75rem;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

a:hover {
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Buttons: solid ink by default. */
button {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    color: var(--paper);
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 0.45rem;
    padding: 0.5rem 1.1rem;
}

button:hover {
    background: #000;
    border-color: #000;
}

/* Inputs and selects. */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: 0.4rem;
    padding: 0.5rem 0.6rem;
}

/* Ghost variant for small, secondary inline actions. */
.topbar .logout button,
.poll .inline button {
    color: var(--ink);
    background: transparent;
    border-color: var(--line-strong);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
}

.topbar .logout button:hover,
.poll .inline button:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

/* Top bar: brand on the left, signed-in name + logout on the right. */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.topbar .brand {
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.topbar .user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar .user .name {
    font-weight: 600;
}

/* Auth form. */
form.auth {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 22rem;
}

form.auth label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-weight: 600;
}

form.auth input {
    padding: 0.5rem;
    font-size: 1rem;
}

.warning {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* Errors stay monochrome — emphasis via weight and a rule, not colour. */
.error {
    color: var(--ink);
    font-weight: 700;
    border-left: 3px solid var(--ink);
    padding-left: 0.6rem;
}

/* Dashboard. */
.poll-section {
    margin-top: 1.5rem;
}

.poll-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.poll {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.poll-title {
    font-weight: 600;
    text-decoration: none;
}

.poll-title:hover {
    text-decoration: underline;
}

.poll .role {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.4rem;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 0.75rem;
}

.poll .dates {
    font-size: 0.85rem;
    opacity: 0.7;
}

.poll .inline {
    display: inline;
    margin-left: auto;
}

.muted {
    opacity: 0.6;
}

/* Admin poll table. */
.table-scroll {
    overflow-x: auto;
}

.admin-table {
    border-collapse: collapse;
    width: 100%;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.4rem 0.75rem 0.4rem 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    white-space: nowrap;
}

.welcome .warning {
    max-width: 40rem;
}

/* Poll creation/edit form. */
form.poll-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 32rem;
}

form.poll-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-weight: 600;
}

form.poll-form input,
form.poll-form textarea,
form.poll-form select {
    padding: 0.4rem;
    font-size: 1rem;
}

.field-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.field-row label {
    flex: 1 1 10rem;
}

.share-link {
    font-size: 1.1rem;
    word-break: break-all;
}

/* ── Grids ─────────────────────────────────────────────────────────────────
   Both the editable submission grid and the read-only results/heat map render
   as one contiguous matrix of day columns. An offered cell shows its own AM/PM
   time; editable cells fill with the accent when picked, results cells shade by
   how many people are free. Non-offered cells are blank (no border). */

:root {
    --grid-accent: #2f6fed;
    --grid-line: color-mix(in srgb, var(--ink) 12%, transparent);
}

.heatgrid {
    display: inline-flex;
    overflow-x: auto;
    max-width: 100%;
}

.heat-col {
    display: flex;
    flex-direction: column;
    width: 6rem;
}

.heat-col-head {
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
    border: 1px solid var(--grid-line);
}

.heatcell {
    box-sizing: border-box;
    height: 1.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--grid-line);
    cursor: default;
}

/* Non-offered cells leave a blank gap: no shading and no grid lines. */
.heatcell-off {
    background: transparent;
    border-color: transparent;
}

.heatcell:focus-visible,
.heatcell.pinned {
    outline: 2px solid var(--grid-accent);
    outline-offset: -2px;
}

/* Editable matrix: each offered cell is a clickable time that fills with the
   accent when selected. The checkbox is visually hidden; no JS required. */
.heatcell.pick {
    padding: 0;
    cursor: pointer;
    position: relative;
}

.heatcell.pick input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.pick-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.heatcell.pick:hover .pick-label {
    background: color-mix(in srgb, var(--grid-accent) 14%, transparent);
}

.heatcell.pick input:checked + .pick-label {
    background: var(--grid-accent);
    color: #fff;
}

.heatcell.pick input:focus-visible + .pick-label {
    outline: 2px solid var(--grid-accent);
    outline-offset: -2px;
}

/* Read-only marked cell (e.g. the creator's own pre-marked grid). */
.heatcell.marked {
    background: var(--grid-accent);
    color: #fff;
}

.heat-0 {
    background: color-mix(in srgb, currentColor 4%, transparent);
}
.heat-1 {
    background: color-mix(in srgb, var(--grid-accent) 25%, transparent);
}
.heat-2 {
    background: color-mix(in srgb, var(--grid-accent) 50%, transparent);
}
.heat-3 {
    background: color-mix(in srgb, var(--grid-accent) 75%, transparent);
    color: #fff;
}
.heat-4 {
    background: var(--grid-accent);
    color: #fff;
}

/* Results layout: the grid, with the roster of names listed below it. */
.results-layout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.roster {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.roster li {
    line-height: 1.4;
}

/* When a slot is active, dim everyone, then re-emphasize the available. */
.roster-active li {
    color: color-mix(in srgb, currentColor 35%, transparent);
}

.roster-active li.available {
    color: inherit;
    font-weight: 700;
}

/* Stack the grid and its submit button vertically (button below the grid). */
.grid-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.grid-submit {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.tz-form {
    margin: 0.5rem 0 1rem;
    font-size: 0.9rem;
}

.responding {
    font-size: 1rem;
}

.responding .warning {
    font-weight: 600;
}

/* Mobile: two days per row, wrapping downward, never overflowing sideways. */
/* Mobile: the matrix wraps two day-columns per row (stacking downward) instead
   of scrolling sideways. */
@media (max-width: 640px) {
    .heatgrid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        overflow-x: visible;
    }

    .heat-col {
        flex: 0 0 50%;
        width: auto;
    }
}
