/* Family Rides. Design: doc/designs/SCREEN-REDESIGN.md, mockups in doc/designs/mockups/. */

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-700.woff2') format('woff2');
}

:root {
  --page: #f2f4f8;
  --card: #ffffff;
  --line: #d5dbe6;
  --ink: #131c2e;
  --muted: #46526a;
  --control: #6b7892;
  --brand: #1d3a8a;
  --brand-dark: #122660;
  --brand-soft: #e6ecfa;
  --warn-bg: #ffedd1;
  --warn-line: #e9b56a;
  --warn-ink: #7a3a00;
  --warn-strong: #5c2b00;
  --grey-bg: #e8ebf0;
  --grey-ink: #2f3a50;
  --focus: #c97a12;
  --danger: #a1261b;
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 106.25%; /* 17px */
  line-height: 1.4;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.15; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
[hidden] { display: none !important; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- page frame ---------- */

.shell { min-height: 100vh; }
main { padding: 20px 16px calc(110px + env(safe-area-inset-bottom)); max-width: 1180px; }
.panel, .auth { display: flex; flex-direction: column; gap: 16px; }

.menu {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding: 4px 2px calc(8px + env(safe-area-inset-bottom));
}
.menu button {
  flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 0; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.menu button[aria-current='page'] { color: var(--brand); }
.menu button:hover { color: var(--brand-dark); background: var(--brand-soft); }
.menu .long, .menu-title, .menu-who { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.sub { margin-top: 4px; color: var(--muted); }

/* ---------- message ---------- */

#message:not(:empty) {
  padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--warn-line); border-radius: 14px;
  background: var(--warn-bg); color: var(--warn-strong); font-weight: 700;
}

/* ---------- building blocks ---------- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stack-tight { display: flex; flex-direction: column; gap: 4px; }
.columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.columns > * { flex: 1 1 340px; min-width: 0; }
.columns > .wide-col { flex: 3 1 400px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.warn-box { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-strong); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.note-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; color: var(--muted); }
.confirmed { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 700; }

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

label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; min-width: 0; }
label small { font-weight: 400; color: var(--muted); font-size: 0.94rem; }
.check { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; font-weight: 400; }
.check input { flex: none; width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--brand); }
fieldset { margin: 0; min-width: 0; }
fieldset.plain { border: 0; padding: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 700; }
fieldset.card legend { float: left; width: 100%; margin-bottom: 0; font-size: 1.12rem; }
fieldset.card legend + * { clear: both; }

input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%; min-width: 0; max-width: 100%; min-height: 52px; padding: 0 14px;
  border: 2px solid var(--control); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { padding: 12px 14px; min-height: 6rem; resize: vertical; }
.short-input { max-width: 220px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.narrow-form { max-width: 640px; }
.form-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.form-end p { flex: 1 1 260px; }
.form-end button { flex: 1 1 100%; }

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

button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%;
  min-height: 48px; padding: 0 18px; border: 2px solid var(--brand); border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 700; text-align: center; text-decoration: none;
  overflow-wrap: anywhere; cursor: pointer;
}
button:hover, a.button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
button:disabled { opacity: 0.6; cursor: wait; }
button.secondary, a.button.secondary { background: #fff; color: var(--brand); }
button.secondary:hover, a.button.secondary:hover { background: var(--brand-soft); color: var(--brand-dark); }
button.quiet { background: #fff; color: var(--ink); border-color: var(--control); }
button.quiet:hover { background: var(--page); color: var(--ink); }
button.big, a.button.big { min-height: 56px; font-size: 1.12rem; }
button.start { align-self: flex-start; }
.with-icon svg { width: 26px; height: 26px; stroke-width: 2.5; }
.danger { color: var(--danger) !important; border-color: var(--danger) !important; }
.link-button, .back-link {
  min-height: 44px; padding: 0; border: 0; background: none; color: var(--brand); font-weight: 700;
  text-decoration: underline; justify-content: flex-start; align-self: flex-start;
}
.link-button:hover, .back-link:hover { background: none; color: var(--brand-dark); border: 0; }
.back-link { text-decoration: none; gap: 4px; }
.back-link svg { stroke-width: 2.5; width: 22px; height: 22px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button-row > * { flex: 1 1 auto; }
.stacked-buttons { display: flex; flex-direction: column; gap: 8px; }

.chip { min-height: 44px; border-radius: 999px; padding: 0 16px; background: #fff; color: var(--ink); border-color: var(--control); }
.chip:hover { background: var(--page); color: var(--ink); border-color: var(--control); }
.chip[aria-pressed='true'], .chip[aria-pressed='true']:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { min-height: 52px; background: #fff; color: var(--ink); border-color: var(--control); }
.choice:hover { background: var(--page); color: var(--ink); border-color: var(--control); }
.choice[aria-pressed='true'], .choice[aria-pressed='true']:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

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

/* ---------- labels on lifts ---------- */

.pill { display: inline-block; justify-self: start; align-self: flex-start; padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; }
.pill-open { background: var(--warn-bg); color: var(--warn-ink); }
.pill-me { background: var(--brand-soft); color: var(--brand); }
.pill-other { background: var(--grey-bg); color: var(--grey-ink); }

/* ---------- sign in ---------- */

.auth { padding-top: 32px; max-width: 460px; margin: 0 auto; }
.auth-card { display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark { flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 32px; height: 32px; }
.brand h1 { font-size: 1.6rem; }
#signin .brand h1 { font-size: 2rem; }

/* ---------- lifts (drivers) ---------- */

.lifts-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.lifts-list { flex: 3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ride-aside { display: none; }
.week-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.week-buttons button { min-height: 44px; background: #fff; color: var(--ink); border-color: var(--control); }
.week-buttons button:hover { background: var(--page); color: var(--ink); border-color: var(--control); }

.summary { display: flex; flex-wrap: wrap; gap: 12px; }
.summary-next { flex: 1 1 260px; background: var(--brand); color: #fff; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.summary-next .label { font-size: 0.9rem; font-weight: 700; }
.summary-next .when { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.summary-soon { flex: 1 1 260px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-strong); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; font-weight: 700; }
.summary-soon svg { width: 28px; height: 28px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
#days { display: flex; flex-direction: column; gap: 14px; }
.day-head { font-size: 1.12rem; margin-top: 4px; }
.day-head span { font-weight: 400; color: var(--muted); }
.day-trips { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }

.trip {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  grid-template-areas: 'time details' 'what what' 'pill pill' 'actions actions';
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow-wrap: anywhere;
}
.trip.changed { border: 2px solid var(--brand); }
.trip-time { grid-area: time; font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.trip-what { grid-area: what; display: flex; flex-direction: column; gap: 4px; }
.trip-title { font-size: 1.06rem; }
.trip-note { font-size: 0.9rem; color: var(--muted); }
.trip .pill { grid-area: pill; }
.trip-details { grid-area: details; align-self: center; min-height: 44px; }
.trip-actions { grid-area: actions; display: flex; flex-direction: column; gap: 8px; }
.trip-actions:empty { display: none; }
.trip-actions button { min-height: 52px; font-size: 1.06rem; }

/* ---------- one lift ---------- */

.ride { display: flex; flex-direction: column; gap: 14px; }
.ride-head { display: flex; flex-direction: column; gap: 4px; }
.ride-head h2 { font-size: 1.6rem; line-height: 1.15; }
.leg { display: flex; flex-direction: column; gap: 10px; }
.leg-label { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.leg-time { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.leg-time span { font-size: 1rem; font-weight: 400; }
.ride-links { display: flex; flex-direction: column; padding: 4px 16px; }
.ride-links button { min-height: 52px; border-bottom: 1px solid var(--line); border-radius: 0; text-decoration: none; justify-content: space-between; align-self: stretch; }
.ride-links button:last-child { border-bottom: 0; }
.ride-links button::after { content: '›'; font-size: 1.4rem; line-height: 1; }
.history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.history li { display: flex; flex-direction: column; }
.history .when { font-size: 0.9rem; color: var(--muted); }

/* ---------- lifts (people who only ask) ---------- */

#mylifts { font-size: 1.06rem; }
#mylifts-ask { flex: 1 1 100%; min-height: 60px; font-size: 1.2rem; }
@media (min-width: 900px) { #mylifts-ask { flex: 0 1 auto; padding: 0 28px; } }
.mylifts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.mylifts > section { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.mylifts > section.first { flex: 3 1 420px; }
.ask-ride { display: flex; flex-direction: column; gap: 12px; }
.ask-ride .big-when { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.ask-ride .where { font-size: 1.15rem; }
.ask-ride hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.ask-ride .leg-home { font-size: 1.15rem; font-weight: 700; }

/* ---------- lists: times, people ---------- */

.list-card { margin: 0; padding: 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.list-card > li { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; overflow-wrap: anywhere; }
.list-card > li:last-child { border-bottom: 0; }
.list-card > li.empty { color: var(--muted); }
.list-card > li.open { background: var(--page); }
.row-main { flex: 1 1 200px; min-width: 0; }
.row-main .name { font-size: 1.06rem; font-weight: 700; }
.row-main .paused { color: var(--warn-ink); font-weight: 700; }
.row-tools { flex: 1 1 100%; display: flex; flex-direction: column; gap: 12px; }
.row-tools .roles { display: flex; flex-wrap: wrap; gap: 0 28px; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; }
.contact a.button { flex: 1 1 140px; }

/* ---------- edit form ---------- */

#edit-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- computers and large tablets ---------- */

@media (min-width: 900px) {
  .shell { display: flex; align-items: stretch; }
  .menu {
    position: sticky; top: 0; bottom: auto; align-self: flex-start; flex: none; width: 236px; height: 100vh;
    flex-direction: column; gap: 4px; padding: 24px 12px; border-top: 0; border-right: 1px solid var(--line);
  }
  .menu-title { display: block; margin: 0 12px 16px; font-size: 1.3rem; font-weight: 700; }
  .menu-who { display: block; margin: 24px 12px 0; color: var(--muted); overflow-wrap: anywhere; }
  .menu button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 12px; font-size: 1rem; color: var(--grey-ink); text-align: left; }
  .menu button[aria-current='page'] { background: var(--brand-soft); color: var(--brand); }
  .menu .long { display: inline; }
  .menu .short { display: none; }
  main { flex: 1 1 auto; min-width: 0; padding: 32px 40px 48px; }
  h1 { font-size: 2.1rem; }
  .card { padding: 24px; }
  .auth { padding-top: 64px; }
  .auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 40px; }
  .auth-card .note-box { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 20px 0 0; }

  /* Lifts as rows, grouped by day in one box. */
  .day-trips { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
  .trip {
    grid-template-columns: 112px minmax(0, 1fr) auto auto; align-items: center; column-gap: 16px; row-gap: 10px;
    grid-template-areas: 'time what pill details' 'actions actions actions actions';
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 16px;
  }
  .day-trips > li:last-child .trip { border-bottom: 0; }
  .day-trips > li:first-child .trip { border-radius: 14px 14px 0 0; }
  .day-trips > li:last-child .trip { border-radius: 0 0 14px 14px; }
  .day-trips > li:only-child .trip { border-radius: 14px; }
  .trip.changed { border: 2px solid var(--brand); }
  .trip.selected { background: var(--brand-soft); }
  .trip .pill { justify-self: end; align-self: center; }
  .trip-actions { flex-direction: row; flex-wrap: wrap; }
  .trip-actions button { min-height: 44px; font-size: 1rem; }
  .ride-links { flex-direction: row; flex-wrap: wrap; gap: 0 20px; padding: 4px 24px; }
  .ride-links button { border: 0; text-decoration: underline; align-self: auto; }
  .ride-links button::after { content: none; }
  .contact a.button { flex: 0 1 auto; }
  .form-end button { flex: 0 1 auto; padding: 0 36px; }
}

@media (min-width: 1100px) {
  .ride-aside {
    display: block; flex: 2 1 340px; min-width: 0; position: sticky; top: 24px;
    max-height: calc(100vh - 48px); overflow: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  }
  .ride-aside .ride .card { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 0; }
  .ride-aside .ride-links { padding: 16px 0 0; }
}
