/* ThankLoop. Palette: cool paper, deep forest ink, leaf for done, marigold for "soon", clay for overdue. */
/* Fonts are self-hosted (SIL Open Font License) so no third party sees who uses the app. */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-opsz-normal.woff2) format("woff2-variations"); }
:root {
  --paper: #F3F5F2;
  --card: #FFFFFF;
  --ink: #1D3A33;
  --ink-2: #4F655E;
  --line: #D5DDD8;
  --leaf: #2F7D5B;
  --leaf-wash: #E3F1E9;
  --marigold: #E9A21F;
  --marigold-wash: #FCF1DA;
  --clay: #C4452F;
  --clay-wash: #F9E4DF;
  --focus: #1E6FD9;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --r-s: 6px;
  --r-m: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--f-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem;
  border: 1.5px solid transparent; border-radius: var(--r-s);
  background: none; cursor: pointer; text-decoration: none;
  font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2A5047; }
.btn-ghost { border-color: var(--line); background: var(--card); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-quiet { color: var(--ink-2); padding-inline: .6rem; }
.btn-quiet:hover { color: var(--ink); background: rgba(29,58,51,.06); }
.btn-send { background: var(--leaf); color: #fff; }
.btn-send:hover { background: #276A4D; }
.btn-send[aria-disabled="true"] { background: var(--line); color: var(--ink-2); pointer-events: none; }
.btn-done { background: var(--card); border-color: var(--leaf); color: var(--leaf); }
.btn-done:hover { background: var(--leaf-wash); }
.btn-danger { background: var(--clay); color: #fff; }
.danger { color: var(--clay) !important; }

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand { display: flex; align-items: center; gap: .65rem; margin-right: auto; }
.logo { width: 34px; height: 34px; color: var(--leaf); flex: none; }
.logo-dot { fill: var(--marigold); }
.wordmark { font: 800 1.25rem/1 var(--f-display); letter-spacing: -.01em; }
.orgname { font-size: .85rem; color: var(--ink-2); }
.views { display: flex; gap: .25rem; }
.tab {
  border: 0; background: none; cursor: pointer; padding: .5rem .75rem; min-height: 44px;
  color: var(--ink-2); font-weight: 700; border-bottom: 3px solid transparent;
}
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--marigold); }
.top-actions { display: flex; gap: .4rem; position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: .35rem; min-width: 240px; box-shadow: 0 10px 30px rgba(29,58,51,.14);
  display: flex; flex-direction: column;
}
.menu button { text-align: left; border: 0; background: none; padding: .65rem .75rem; border-radius: var(--r-s); cursor: pointer; }
.menu button:hover { background: var(--paper); }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 2rem; }

.summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem 2rem;
  padding-bottom: 1.25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line);
}
.summary-lead { font: 700 clamp(1.35rem, 3vw, 1.9rem)/1.2 var(--f-display); letter-spacing: -.015em; flex-basis: 100%; }
.summary-lead .num { color: var(--leaf); }
.summary-lead.bad .num { color: var(--clay); }
.summary-fact { color: var(--ink-2); }
.summary-fact b { color: var(--ink); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 2rem; align-items: start; }
.workspace.solo { grid-template-columns: minmax(0, 1fr); max-width: 720px; }

.h-queue { font: 700 1.15rem/1.3 var(--f-display); }
.hint { color: var(--ink-2); font-size: .92rem; margin-top: .2rem; }

/* ---------- Queue rows: the time-left bar is the signature ---------- */
.list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.row {
  --pct: 100%; --band: var(--leaf); --wash: var(--leaf-wash);
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; align-items: center;
  width: 100%; text-align: left; cursor: pointer;
  padding: .8rem 1rem 1.05rem; border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: var(--card); overflow: hidden;
}
.row:hover { border-color: var(--ink-2); }
.row[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.row::after { /* the draining 48-hour bar */
  content: ""; position: absolute; left: 0; bottom: 0; height: 5px; width: var(--pct);
  background: var(--band); transition: width .6s ease;
}
.row::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--wash); }
.row.soon { --band: var(--marigold); --wash: var(--marigold-wash); }
.row.due, .row.overdue { --band: var(--clay); --wash: var(--clay-wash); }
.row.overdue::before { background: repeating-linear-gradient(-45deg, var(--clay-wash) 0 6px, #F2CFC6 6px 12px); }

.row-name { font: 700 1.08rem/1.25 var(--f-display); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tag { font: 700 .75rem/1 var(--f-body); padding: .28rem .5rem; border-radius: 999px; background: var(--marigold-wash); color: #7A5408; }
.tag.vol { background: var(--leaf-wash); color: var(--leaf); }
.row-gift { color: var(--ink-2); font-size: .92rem; grid-column: 1; }
.row-left { grid-row: 1 / span 2; grid-column: 2; text-align: right; font: 700 1rem/1.2 var(--f-display); font-variant-numeric: tabular-nums; }
.row.soon .row-left { color: #94650A; }
.row.due .row-left, .row.overdue .row-left { color: var(--clay); }
.row-left small { display: block; font: 400 .78rem/1.3 var(--f-body); color: var(--ink-2); }

.done { margin-top: 1.75rem; }
.done summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: .4rem 0; min-height: 44px; display: flex; align-items: center; }
.list-done .row { cursor: default; padding-bottom: .8rem; background: transparent; }
.list-done .row::before, .list-done .row::after { display: none; }
.list-done .row-left { color: var(--leaf); }
.undo { border: 0; background: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: .85rem; padding: .25rem 0; }

.empty { margin-top: 1rem; padding: 1.5rem; border: 1.5px dashed var(--line); border-radius: var(--r-m); color: var(--ink-2); }
.empty-title { font: 700 1.1rem/1.3 var(--f-display); color: var(--ink); margin-bottom: .3rem; }
.empty-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Composer ---------- */
.composer {
  position: sticky; top: 1rem;
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--r-m);
  padding: 1.25rem 1.25rem 1rem; display: flex; flex-direction: column; gap: .9rem;
}
.composer-close { align-self: flex-start; display: none; }
.h-who { font: 800 1.6rem/1.15 var(--f-display); letter-spacing: -.02em; }
.who-meta { color: var(--ink-2); margin-top: .25rem; }
.lang { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r-s); align-self: flex-start; overflow: hidden; }
.lang button { border: 0; background: none; padding: .45rem .85rem; cursor: pointer; min-height: 40px; font-weight: 700; color: var(--ink-2); }
.lang button[aria-checked="true"] { background: var(--ink); color: #fff; }
.field-label { font-size: .88rem; color: var(--ink-2); margin-bottom: -.5rem; }
#message {
  width: 100%; resize: vertical; padding: .9rem 1rem; line-height: 1.55;
  border: 1.5px solid var(--line); border-radius: var(--r-m); background: #FBFCFB;
}
#message:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(30,111,217,.25); }
.send { display: flex; flex-wrap: wrap; gap: .5rem; }
.send-note { font-size: .85rem; color: var(--ink-2); min-height: 1.2em; }
.mark { display: flex; gap: .5rem; align-items: center; padding-top: .75rem; border-top: 1px solid var(--line); }

/* ---------- Wall ---------- */
.wall-head { text-align: center; margin: 1rem 0 2rem; }
.h-wall { font: 800 clamp(2.6rem, 9vw, 5.5rem)/.95 var(--f-display); letter-spacing: -.035em; color: var(--leaf); }
.wall-sub { color: var(--ink-2); margin-top: .6rem; font-size: 1.05rem; }
.wall { list-style: none; padding: 0; margin: 0; columns: 3 220px; column-gap: 1rem; }
.wall li {
  break-inside: avoid; margin-bottom: 1rem; padding: 1rem 1.1rem;
  background: var(--card); border-left: 5px solid var(--marigold); border-radius: var(--r-s);
}
.wall li:nth-child(3n+2) { border-left-color: var(--leaf); }
.wall li:nth-child(3n) { border-left-color: var(--ink); }
.wall-name { font: 700 1.35rem/1.2 var(--f-display); }
.wall-what { color: var(--ink-2); }

/* ---------- Dialogs / forms ---------- */
dialog {
  border: 0; border-radius: var(--r-m); padding: 0; width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem); color: var(--ink); background: var(--card);
  box-shadow: 0 20px 60px rgba(29,58,51,.3);
}
dialog::backdrop { background: rgba(29,58,51,.45); }
.form { padding: 1.4rem; display: flex; flex-direction: column; gap: .85rem; }
.form h2 { font: 700 1.35rem/1.2 var(--f-display); }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .92rem; font-weight: 700; }
.form input:not([type=radio]):not([type=checkbox]), .form textarea {
  font-weight: 400; padding: .6rem .7rem; border: 1.5px solid var(--line); border-radius: var(--r-s); background: #FBFCFB; min-height: 44px; width: 100%;
}
.form input:focus, .form textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(30,111,217,.25); }
.form .check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 400; }
.form .check input { width: 20px; height: 20px; accent-color: var(--leaf); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: .92rem; font-weight: 700; margin-bottom: .35rem; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: .5rem; }
.seg legend { width: 100%; }
.seg label { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; border: 1.5px solid var(--line); border-radius: var(--r-s); padding: .5rem .85rem; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--paper); font-weight: 700; }
.seg input { accent-color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.impact-row { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.impact-row input { width: 7rem !important; }
.form-actions { display: flex; gap: .5rem; align-items: center; padding-top: .5rem; flex-wrap: wrap; }
.grow { flex: 1; }
.form-error { color: var(--clay); font-weight: 700; min-height: 1.2em; font-size: .9rem; white-space: pre-line; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .75rem 1.1rem; border-radius: var(--r-s);
  font-weight: 700; box-shadow: 0 10px 30px rgba(29,58,51,.3); z-index: 20; max-width: calc(100vw - 2rem);
}

.foot { padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.5rem; color: var(--ink-2); font-size: .85rem; text-align: center; }

/* ---------- Print card ---------- */
.print-card { display: none; }
@media print {
  @page { size: A5 landscape; margin: 14mm; }
  body > *:not(.print-card) { display: none !important; }
  body { background: #fff; display: block; }
  .print-card { display: block !important; position: relative; color: #1D3A33; font-family: var(--f-body); }
  .pc-ring { position: absolute; right: 0; top: 0; width: 26mm; height: 26mm; border: 4.5mm solid #2F7D5B; border-radius: 50%; border-right-color: transparent; }
  .pc-thanks { font: 800 34pt/1 var(--f-display); color: #2F7D5B; margin-bottom: 8mm; letter-spacing: -.02em; }
  .pc-body { font-size: 12pt; line-height: 1.6; white-space: pre-line; max-width: 150mm; }
}

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .composer {
    position: fixed; inset: 0; z-index: 8; border: 0; border-radius: 0; overflow-y: auto;
    padding: 1rem 1rem 1.5rem;
  }
  .composer-close { display: inline-flex; }
  .top { gap: .5rem; }
  .views { order: 3; width: 100%; }
  .views .tab { flex: 1; }
  .two { grid-template-columns: 1fr; }
  .send .btn { flex: 1 1 45%; }
  .btn-send { flex-basis: 100% !important; }
}

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