/* SchoolFoto: one stylesheet, mobile first. */

:root {
    --bg: #ffffff;
    --surface: #f5f5f3;
    --ink: #1c1c1e;
    --muted: #6b6b70;
    --line: #e4e4e0;
    --accent: #1f6f5c;
    --on-accent: #ffffff;
    --alert: #b3261e;
    --radius: 14px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --surface: #1e1e20;
        --ink: #f2f2f2;
        --muted: #a1a1a6;
        --line: #2e2e30;
        --accent: #5cc4a6;
        --on-accent: #0d211b;
        --alert: #ff8a80;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page {
    max-width: 34rem;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 3rem;
}

/* Type */

.brand {
    display: inline-block;
    margin-bottom: 2.5rem;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.brand span { color: var(--accent); }

h1 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2 {
    margin: 2rem 0 0.5rem;
    font-size: 1.1rem;
}

p, ul { margin: 0 0 1rem; }
ul { padding-left: 1.25rem; }

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

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

/* Lists of choices */

.list {
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line);
}

.list > li { border-bottom: 1px solid var(--line); }

.list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
    padding: 0.75rem 0;
    color: inherit;
    text-decoration: none;
}
.list a::after { content: "›"; color: var(--muted); font-size: 1.5rem; }
.list small { display: block; color: var(--muted); font-size: 0.9rem; }
.list .empty { padding: 1rem 0; color: var(--muted); }

/* Forms */

.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; }

input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input:disabled { color: var(--muted); background: var(--bg); border-style: dashed; cursor: not-allowed; }
input.code { text-align: center; letter-spacing: 0.15em; font-size: 1.25rem; }

.button {
    display: block;
    width: 100%;
    margin: 1.5rem 0 1rem;
    padding: 1rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.button:active { opacity: 0.85; }

/* Picking a time: a field of blocks, a screenful at a time */

.times { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.times[hidden] { display: none; }
.time { position: relative; }
.time input { position: absolute; opacity: 0; pointer-events: none; }
.time > span {
    display: block;
    padding: 0.75rem 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    cursor: pointer;
}
.time input:checked + span { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.time input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.time.taken > span { border-color: transparent; background: var(--surface); color: var(--muted); text-decoration: line-through; cursor: default; }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.pager .quiet { padding: 0.5rem 0; color: var(--accent); font-size: 1rem; }
.pager .quiet:disabled { color: var(--line); cursor: default; }
.pager span { font-variant-numeric: tabular-nums; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.button.secondary { border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

/* Feedback */

.notice {
    margin-bottom: 1.5rem;
    padding: 0.9rem 1rem;
    border-left: 3px solid var(--alert);
    border-radius: var(--radius);
    background: var(--surface);
}
.notice p:last-child { margin: 0; }
.notice.lost ul { columns: 14rem; margin-bottom: 1rem; }
.notice.lost .actions { margin-top: 1rem; }

/* Key/value summary */

.summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.25rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: var(--radius);
    background: var(--surface);
}
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Form details */

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }

.field .error { display: block; margin-top: 0.35rem; color: var(--alert); font-size: 0.9rem; }
.field .help { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.field .help:empty { display: none; }
#slot-count { color: var(--accent); font-weight: 500; }

textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    font: inherit;
    resize: vertical;
}

.code { letter-spacing: 0.15em; }

/* Header */

.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2.5rem; }
.top .brand { margin-bottom: 0; }

.quiet {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
}
.quiet.danger:hover { color: var(--alert); }
.notice.success, .notice.info { border-left-color: var(--accent); }

select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    font: inherit;
}

/* A list row with its own actions */
.list .member { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.75rem 0; }
.list .member form { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }


/* ------------------------------------------------------------------ */
/* Staff: a desktop workspace with a sidebar                           */
/* ------------------------------------------------------------------ */

body.staff {
    display: grid;
    grid-template-columns: 15rem 1fr;
    min-height: 100vh;
    font-size: 15px;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--line);
    background: var(--surface);
}
.sidebar .brand { margin: 0 0.75rem 2rem; }
.sidebar nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}
.sidebar nav a:hover { background: var(--line); }
.sidebar nav a[aria-current] { background: var(--bg); color: var(--accent); font-weight: 600; }
.nav-label {
    display: block;
    margin: 1.75rem 0.75rem 0.35rem;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; margin: auto 0.75rem 0; color: var(--muted); font-size: 0.9rem; }

.workspace { width: 100%; max-width: 72rem; padding: 2.5rem 3rem 4rem; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0.35rem 0 0; }
.crumb { font-size: 0.9rem; color: var(--muted); }
.crumb a { color: var(--muted); }

.staff h2 { margin: 2.5rem 0 0.75rem; }

.actions { display: flex; gap: 0.5rem; align-items: center; }

/* Buttons sized for a desktop, next to each other */
.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--alert); }
.btn:disabled { opacity: 0.45; cursor: default; }
form[aria-busy] { opacity: 0.6; pointer-events: none; }

.staff .button { display: inline-block; width: auto; padding: 0.7rem 1.5rem; }
.staff .narrow, .staff .summary, .staff textarea { max-width: 32rem; }

/* Event form with a sample of the confirmation mail beside it */

.event-form { display: grid; grid-template-columns: minmax(0, 32rem) minmax(0, 26rem); gap: 3rem; align-items: start; }
.mail-sample { position: sticky; top: 2rem; }
.mail-label { margin: 0 0 0.35rem; color: var(--muted); font-size: 0.9rem; }
.mail-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mail-head { margin: 0; padding: 0.9rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.mail-head strong { color: var(--ink); font-size: 1rem; }
.mail-body { padding: 1.25rem; overflow-wrap: anywhere; }
.mail-body p { margin: 0 0 1em; }
.mail-body > :last-child > p:last-child { margin-bottom: 0; }
.mail-body .mail-when { margin-left: 2em; }
@media (max-width: 1200px) {
    .event-form { display: block; }
    .event-form form { max-width: 32rem; }
    .mail-sample { position: static; max-width: 32rem; margin-top: 2.5rem; }
}

.tabs { display: flex; gap: 1.25rem; margin-top: 0.75rem; }
.tabs a { padding-bottom: 0.25rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a[aria-current] { color: var(--ink); border-color: var(--accent); }

/* Tables */

.data { width: 100%; border-collapse: collapse; }
.data th {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
}
.data td { padding: 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tbody tr:hover td { background: var(--surface); }
.data tr.blocked td { color: var(--muted); }
.data .end { text-align: right; }
.data .row-link { color: var(--ink); font-weight: 500; text-decoration: none; }
.data .row-link:hover { color: var(--accent); }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }

.meter { display: inline-block; width: 7rem; height: 6px; margin-right: 0.5rem; overflow: hidden; border-radius: 3px; background: var(--line); vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--accent); }

/* Event page */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
.stat b { display: block; font-size: 1.6rem; font-weight: 600; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.share { display: flex; gap: 0.5rem; max-width: 40rem; }
.share input { padding: 0.55rem 0.9rem; font-size: 0.9rem; }

.hours { border-top: 1px solid var(--line); }
.hour { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.hour > b { padding-top: 0.35rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.tiles { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tile {
    display: inline-block;
    min-width: 3.75rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
button.tile { cursor: pointer; }
button.tile:hover { border-color: var(--accent); }
.tile.booked { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.tile.blocked {
    color: var(--muted);
    background: repeating-linear-gradient(135deg, var(--surface) 0 5px, var(--line) 5px 10px);
}
.tile.booked:hover { border-color: var(--ink); }
.legend .tile { min-width: 0; margin-right: 0.25rem; }
.legend { font-size: 0.9rem; }

/* Buttons in one column, all as wide as the widest */
.action-list { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1.2rem 1rem; }
.action-list form { display: contents; }
.action-list .muted { font-size: 0.9rem; }

/* Photos */

.upload { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.album { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.album > b { font-weight: 500; font-variant-numeric: tabular-nums; }
.album small { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.thumbs img, .thumbs .pending { height: 6rem; border-radius: 7px; }
.thumbs .pending { display: grid; place-items: center; width: 4.5rem; background: var(--surface); color: var(--alert); font-weight: 600; }

/* Narrow screens: sidebar becomes a top bar */

@media (max-width: 800px) {
    body.staff { display: block; }
    .sidebar { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar .brand { margin: 0 1rem 0 0.75rem; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .nav-label { display: none; }
    .who { flex-direction: row; margin: 0 0 0 auto; }
    .workspace { padding: 1.5rem 1.25rem 3rem; }
    .page-head { flex-direction: column; align-items: flex-start; }
}

/* Printing the worklist */

@media print {
    body.staff { display: block; font-size: 12px; }
    .sidebar, .no-print, .notice { display: none; }
    .workspace { max-width: none; padding: 0; }
}

.page-head + h2 { margin-top: 0; }

/* A block of text to copy, with its button */
.invite {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    max-width: 44rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.invite p { margin: 0; line-height: 1.7; overflow-wrap: anywhere; }

/* A small dialog over the page, e.g. cancelling a booking */

.sheet {
    width: min(26rem, calc(100% - 2rem));
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.35); }
.staff .sheet h2 { margin: 0 0 0.75rem; }
.sheet .choices { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.25rem; }
