/* Portals: shared styles
   Palette: paper #F2F3F7, ink #181A2F, muted #636780, line #D8DAE6, gold #C8962E, green #2F6F5E */

:root {
  --paper: #F2F3F7;
  --ink: #181A2F;
  --ink-soft: #2B2E4E;
  --muted: #636780;
  --line: #D8DAE6;
  --wash: #E5E7F0;
  --gold: #C8962E;
  --green: #2F6F5E;
  --err: #B3392F;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Hanken Grotesk', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.5rem; }
.page { min-height: 100svh; display: flex; flex-direction: column; }
.page > main { flex: 1; }

.mark { font: 600 1rem var(--display); text-decoration: none; letter-spacing: 0.01em; }

h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-weight: 500; font-size: clamp(2.6rem, 7vw, 4.75rem); line-height: 1.02; letter-spacing: -0.03em; }
h2 { font-weight: 500; font-size: 2rem; line-height: 1.1; letter-spacing: -0.02em; }

.lede { color: var(--muted); max-width: 36ch; margin: 0.9rem 0 0; }

/* ---------- Landing ---------- */

.site-head { padding: 2rem 0; }
.site-main { display: flex; flex-direction: column; justify-content: center; padding: 2rem 0 4rem; }
.site-main .lede { margin-bottom: 4rem; }

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

.portal {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 2.5rem;
  align-items: center;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.portal-letter {
  font: 600 clamp(5rem, 14vw, 9rem)/0.8 var(--display);
  letter-spacing: -0.06em;
  transition: color 0.25s ease;
}

.portal-name { font: 500 1.4rem var(--display); letter-spacing: -0.01em; margin: 0 0 0.2rem; }
.portal-text { margin: 0; color: var(--muted); }

.portal-open {
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--gold);
  transition: padding-bottom 0.2s ease;
}

.portal:hover .portal-letter { color: var(--gold); }
.portal:hover .portal-open { padding-bottom: 6px; }

@media (max-width: 640px) {
  .portal { grid-template-columns: auto 1fr; }
  .portal-open { grid-column: 2; justify-self: start; margin-top: 0.5rem; }
}

/* ---------- Fields and buttons ---------- */

.field { margin: 0 0 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }

.field input,
.field select,
.field textarea {
  width: 100%;
  font: 400 1rem var(--body);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
}

.field textarea { min-height: 5.5rem; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(24, 26, 47, 0.12); }

.btn {
  font: 600 0.95rem var(--body);
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--ink-soft); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--wash); }
.btn.small { padding: 0.45rem 0.85rem; font-size: 0.88rem; }

.link {
  font: 500 0.88rem var(--body);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0.15rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link:hover { color: var(--ink); }

.error { color: var(--err); min-height: 1.5em; margin: 0.9rem 0 0; font-size: 0.95rem; }

/* ---------- Portal D: sign in ---------- */

.auth-head { padding: 2rem 0; }
.back { color: var(--muted); font-size: 0.95rem; }
.back:hover { color: var(--ink); }

.auth { display: flex; flex-direction: column; justify-content: center; padding-bottom: 6rem; max-width: 24rem; }
.auth h1 { font-size: clamp(3rem, 9vw, 5.5rem); }
.auth form { margin-top: 2.5rem; }

/* ---------- Portal D: planner ---------- */

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: 0.95rem; }

.layout { display: grid; grid-template-columns: 12rem 1fr; gap: 3rem; padding: 2.5rem 0 5rem; }

.nav { display: flex; flex-direction: column; gap: 0.2rem; position: sticky; top: 2rem; align-self: start; }
.nav button {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  font: 500 1rem var(--body);
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}
.nav button:hover { color: var(--ink); }
.nav button[aria-current="page"] { color: var(--ink); background: var(--wash); }
.nav .n { font-variant-numeric: tabular-nums; color: var(--muted); }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }

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

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.item h3 { font-weight: 600; font-size: 1.1rem; letter-spacing: -0.005em; }
.item .meta { display: flex; flex-wrap: wrap; gap: 0.1rem 1.1rem; color: var(--muted); font-size: 0.92rem; margin-top: 0.15rem; }
.item .notes { color: var(--muted); font-size: 0.92rem; white-space: pre-wrap; margin: 0.35rem 0 0; max-width: 60ch; }
.item .side { display: flex; align-items: flex-start; gap: 0.9rem; }

.status { display: inline-flex; align-items: center; gap: 0.4rem; }
.status::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--gold); flex: none; }
.status[data-tone="done"]::before { background: var(--green); }
.status[data-tone="quiet"]::before { background: var(--line); box-shadow: inset 0 0 0 1px var(--muted); }
.status select {
  font: 500 0.9rem var(--body);
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0.1rem 0.2rem;
  cursor: pointer;
}

.empty { padding: 2rem 0; color: var(--muted); max-width: 44ch; }

.countdown { font: 500 1.35rem/1.35 var(--display); letter-spacing: -0.01em; margin: 0.9rem 0 2.25rem; max-width: 30ch; }

.trip-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; max-width: 34rem; margin-bottom: 2.5rem; }
.trip-form .full { grid-column: 1 / -1; }
.trip-form .btn { justify-self: start; }

.summary { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.summary button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  text-align: left;
  font: 400 1rem var(--body);
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.95rem 0;
  cursor: pointer;
}
.summary button:hover .what { text-decoration: underline; text-underline-offset: 4px; }
.summary .what { font-weight: 600; }
.summary .count { color: var(--muted); text-align: right; }

/* ---------- Trips and people ---------- */

.layout.solo { grid-template-columns: 1fr; max-width: 44rem; }

.nav .all { margin-bottom: 0.75rem; color: var(--muted); }
.nav .n.alert { color: var(--ink); background: var(--gold); border-radius: 999px; padding: 0 0.5rem; font-size: 0.8rem; font-weight: 600; }

.items.spaced { margin-bottom: 0.5rem; }
.item h3 a { text-decoration: none; }
.item h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }

.pill { font-size: 0.85rem; font-weight: 600; text-decoration: none; background: var(--gold); color: var(--ink); border-radius: 999px; padding: 0.1rem 0.7rem; }
.pill:hover { filter: brightness(0.95); }

.sub { font: 500 1.25rem var(--display); letter-spacing: -0.01em; margin: 2.5rem 0 1rem; }
.gap { height: 1.5rem; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; margin-top: 2rem; }
.pair .sub { margin-top: 1.5rem; }
.inline-form { display: flex; gap: 0.6rem; }
.inline-form input {
  flex: 1;
  min-width: 0;
  font: 400 1rem var(--body);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
}
.inline-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(24, 26, 47, 0.12); }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.6rem 0 0; max-width: 40ch; }
.with { color: var(--muted); margin: -1.5rem 0 2.25rem; }
.code { font: 600 1.9rem var(--display); letter-spacing: 0.12em; margin: 0 0 0.9rem; user-select: all; }
.row-actions { display: flex; align-items: center; gap: 1rem; }
.footer-actions { margin-top: 3rem; }
.link.danger:hover { color: var(--err); }
.who a { color: var(--muted); font-size: 0.95rem; }
.who a:hover { color: var(--ink); }

/* ---------- Editor dialog ---------- */

dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100svh - 2rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.75rem;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: rgba(24, 26, 47, 0.4); }
dialog h2 { font-size: 1.6rem; margin-bottom: 1.5rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid .full { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.75rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  max-width: calc(100vw - 2rem);
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.5rem; }
  .nav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 0.25rem; }
  .nav button { white-space: nowrap; }
  .item { grid-template-columns: 1fr; }
  .grid, .trip-form, .pair { grid-template-columns: 1fr; }
  .who span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
