/* CalendarJack design system
   One idea: a workshop ledger. Warm paper, navy ink, jack orange.
   One layout primitive: the ledger panel (bordered, hairline top rule),
   repeated everywhere instead of a new card treatment per page. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage-grotesque-normal.woff2") format("woff2");
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #f4efe6;
  --paper-deep: #e9e2d4;
  --panel: #fffdf9;
  --ink: #14213d;
  --ink-soft: #3b4661;
  --muted: #5b6472;
  --rule: #d8d0c0;
  --rule-strong: #14213d;
  /* Orange in two grades: the bright one is for marks and dots only; the
     ink grade carries text and button fills so contrast clears WCAG AA. */
  --jack: #e4572e;
  --jack-ink: #b03d16;
  --jack-deep: #8f300f;
  --jack-tint: #fbe8df;
  --ok: #1f6f4a;
  --ok-tint: #e2f1e8;
  --warn: #8a5a00;
  --warn-tint: #fff1cc;
  --danger: #a3232b;
  --danger-tint: #fbe4e5;
  --display: "Bricolage Grotesque", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --body: "Figtree", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --measure: 62ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }
html {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select { font: inherit; }
img, svg { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--jack); outline-offset: 3px; }
::selection { background: var(--jack-tint); }

/* Typography */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 5.2vw, 4.4rem); font-stretch: 92%; }
/* Group names come from GroupMe and can be one long unbroken token. */
h1, h2, h3, .account, .group-option .name, .next-events span { overflow-wrap: anywhere; min-width: 0; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.1rem; }
p { margin: 0; }
p + p { margin-top: 0.85em; }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-soft); max-width: var(--measure); line-height: 1.5; }
.small { font-size: 0.92rem; color: var(--muted); line-height: 1.5; }
.kicker { font-family: var(--display); font-weight: 600; color: var(--jack-ink); font-size: 1rem; margin-bottom: 0.6rem; }
strong { font-weight: 700; }

/* Shell */
.shell { width: min(1120px, calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.narrow { width: min(640px, calc(100% - 2 * var(--gutter))); margin-inline: auto; }

/* Header and footer */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header .shell { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand img, .brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 1.4rem; align-items: center; font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); text-decoration: underline; }
footer { border-top: 1px solid var(--rule); margin-top: 4rem; }
footer .shell { padding: 1.4rem 0 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--muted); }
/* GroupMe's asset ships on a white ground; frame it as a badge on purpose. */
footer .powered { display: inline-block; padding: 0.4rem 0.7rem; background: #fff; border: 1px solid var(--rule); border-radius: 6px; }
footer .powered img { width: 150px; height: auto; }

/* The ledger panel: the one primitive */
.ledger {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.ledger-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ledger-head h2 { font-size: 1.25rem; }

/* Buttons */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.7rem 1.25rem;
  border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: #fff;
  font-family: var(--display); font-weight: 600; font-size: 1rem; letter-spacing: 0;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #0d1730; }
.btn-jack, button.btn-jack { background: var(--jack-ink); border-color: var(--jack-ink); }
.btn-jack:hover, button.btn-jack:hover { background: var(--jack-deep); border-color: var(--jack-deep); }
.btn-quiet, button.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-quiet:hover, button.btn-quiet:hover { background: var(--paper-deep); }
.btn-danger, button.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover, button.btn-danger:hover { background: var(--danger-tint); }
.btn-wide { width: 100%; }
.link-button { display: inline; padding: 0; border: 0; background: none; color: var(--ink-soft); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:hover { color: var(--ink); }
.link-button.danger { color: var(--danger); }

/* Forms */
label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.95rem; }
input, select {
  width: 100%; min-height: 48px; padding: 0.65rem 0.85rem;
  border: 1px solid #8f8676; border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
input:hover, select:hover { border-color: var(--ink-soft); }
.field-row { display: flex; gap: 0.6rem; }
.field-row input { min-width: 0; }
.mono { font-family: var(--mono); font-size: 0.88rem; }
.form-error { margin-top: 0.6rem; color: var(--danger); font-weight: 600; }
.help { margin-top: 0.6rem; }

/* Notices: content colored, no edge stripes */
.notice { padding: 0.8rem 1rem; border-radius: var(--radius); font-size: 0.95rem; }
.notice-ok { background: var(--ok-tint); color: var(--ok); }
.notice-warn { background: var(--warn-tint); color: var(--warn); }
.notice-danger { background: var(--danger-tint); color: var(--danger); }

/* Step rail for organizer pages */
.rail { display: flex; gap: 0; margin: 1.6rem 0 1.4rem; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.rail li { list-style: none; flex: 1; padding: 0.6rem 0.9rem; font-size: 0.9rem; color: var(--muted); border-right: 1px solid var(--rule); display: flex; gap: 0.5rem; align-items: center; }
.rail li:last-child { border-right: 0; }
.rail li b { font-family: var(--display); font-weight: 700; color: var(--ink); }
.rail li[aria-current="step"] { background: var(--ink); color: #fff; }
.rail li[aria-current="step"] b { color: #fff; }
.rail li.done { color: var(--ok); }
.rail li.done b { color: var(--ok); }
.rail { padding: 0; }

/* Landing */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.hero h1 { max-width: 12ch; }
.hero .lede { margin-top: 1.1rem; }
.hero-proof { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; color: var(--ink-soft); font-size: 0.95rem; }
.hero-proof span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--jack); margin-right: 0.5rem; vertical-align: 1px; }
.connect { position: sticky; top: 1rem; }
.connect h2 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.connect .small { margin-bottom: 1rem; }
.connect .field-row { flex-direction: column; }
.connect .btn { width: 100%; }

.how, .after, .faq { margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.how-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; align-items: start; }
.how .ledger h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.how .ledger ol { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.how .ledger li { margin: 0.35rem 0; }
.how .ledger li::marker { font-family: var(--display); font-weight: 700; color: var(--jack-ink); }

.after-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; align-items: start; }
.after-grid .ledger p { color: var(--ink-soft); }

.faq h2 { margin-bottom: 1.25rem; }
.faq details { border-top: 1px solid var(--rule); padding: 0.9rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--jack-ink); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: 0.6rem; color: var(--ink-soft); max-width: var(--measure); }

/* Centered pages: hand-off, confirm, share, errors */
.center { padding: clamp(2rem, 8vh, 5rem) 0; }
.center .ledger { padding: clamp(1.5rem, 4vw, 2.5rem); }
.center h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin-bottom: 0.6rem; }
.center .actions { display: grid; gap: 0.7rem; margin: 1.5rem 0 1rem; }
.account { font-family: var(--display); font-weight: 700; font-size: 1.35rem; margin: 0.8rem 0 0.2rem; }

/* Share page */
.share-steps { margin-top: 1.25rem; border-top: 1px solid var(--rule); }
.share-steps details { border-bottom: 1px solid var(--rule); padding: 0.8rem 0; }
.share-steps summary { cursor: pointer; font-weight: 600; }
.share-steps ol { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--ink-soft); }
.copy-row { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
.copy-row input { min-width: 0; }
.copy-status { min-height: 1.3rem; margin-top: 0.4rem; font-size: 0.9rem; color: var(--ok); }
.private-note { margin-top: 1.25rem; padding: 0.9rem 1rem; background: var(--paper-deep); border-radius: var(--radius); font-size: 0.95rem; }

/* Dashboard */
.page-head { padding: clamp(1.5rem, 4vw, 2.5rem) 0 1rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.dash { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; padding-bottom: 2rem; }
.group-list { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.group-option { display: flex; align-items: center; gap: 0.9rem; padding: 0.75rem 0.85rem; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; cursor: pointer; }
.group-option:hover { border-color: var(--ink-soft); }
.group-option input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--jack); flex: none; }
.group-option .name { font-weight: 600; }
.group-option .count { color: var(--muted); font-size: 0.9rem; }
.group-option:has(input:checked) { border-color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--ink); }
.group-option.published .count { color: var(--ok); }
.feed { display: grid; gap: 0.8rem; }
.feed-top { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.feed-top h2 { min-width: 0; }
.feed h2 { font-size: 1.35rem; }
.status { font-size: 0.9rem; font-weight: 600; color: var(--ok); }
.status.warn { color: var(--warn); }
.feed-actions { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.more summary { cursor: pointer; color: var(--ink-soft); font-size: 0.95rem; }
.more-actions { display: flex; gap: 1rem; padding-top: 0.6rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--rule); border-radius: var(--radius); }
.danger-zone { padding: 1rem 0 3rem; }

/* Success page: after a calendar is created */
.next-events { margin: 1rem 0; border-top: 1px solid var(--rule); }
.next-events li { list-style: none; display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.next-events time { font-family: var(--display); font-weight: 600; color: var(--ink-soft); }
.next-events span { font-weight: 600; }

/* Policy and help pages */
.prose { max-width: var(--measure); }
.prose h1 { margin-bottom: 1rem; }
.prose h2 { margin: 1.8rem 0 0.5rem; font-size: 1.3rem; }
.prose p, .prose li { color: var(--ink-soft); }
.prose .kicker { color: var(--jack-ink); }
.group-option:has(input:disabled) { cursor: default; background: var(--paper); }
.prose ol, .prose ul { padding-left: 1.25rem; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--jack-ink); font-weight: 700; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .connect { position: static; }
  .how-grid, .after-grid, .dash { grid-template-columns: 1fr; }
  .rail { flex-direction: column; }
  .rail li { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail li:last-child { border-bottom: 0; }
  .next-events li { grid-template-columns: 1fr; gap: 0.2rem; }
  .field-row { flex-direction: column; }
  .site-header .shell { flex-wrap: wrap; row-gap: 0.25rem; padding: 0.6rem 0; min-height: 0; }
  .nav { font-size: 0.9rem; gap: 1rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .group-option, .faq summary::after { transition: background-color 150ms cubic-bezier(0.22, 1, 0.36, 1), border-color 150ms cubic-bezier(0.22, 1, 0.36, 1); }
}

/* Spacing utilities (CSP forbids inline styles) */
.mt-1 { margin-top: 1rem; }
.mt-125 { margin-top: 1.25rem; }
.sub-h2 { margin-top: 1.5rem; font-size: 1.1rem; }
@media (max-width: 480px) {
  /* Keep the rail one row: numbers carry the step, labels are the noise. */
  .rail { flex-direction: row; }
  .rail li { border-bottom: 0; border-right: 1px solid var(--rule); padding: 0.55rem 0.5rem; font-size: 0.8rem; justify-content: center; }
  .rail li:last-child { border-right: 0; }
}
