/* Post Queue
 *
 * Structure borrowed from the WWK9 scheduler: a dark collapsible rail on
 * desktop, a fixed bar and drawer on mobile, pill controls outlined with a
 * hairline ring, segmented switches, and a calendar grid as the main surface.
 *
 * Colour and type are The Mindful Concierge's: warm paper, near-black ink,
 * one gold. Fraunces for headings, Hanken Grotesk for reading, Archivo for
 * the small labels that have a job to do.
 *
 * Gold is the only loud thing, and it is spent in three places: the active
 * nav item, the primary button, and whatever is due right now. Everything
 * else is paper and hairlines.
 */

:root {
  --ink:      #0d0d0f;
  --surface:  #16161a;
  --hairline: #2a2a30;
  --gold:     #c9a44c;
  --gold-lt:  #e2c37a;
  --bone:     #f2ede4;
  --warm:     #cfc8bc;
  --paper:    #f6f3ec;
  --paper-2:  #ece7dc;
  --card:     #fffdf8;
  --line:     #ddd6c6;
  --muted:    #6d675b;
  --rail:     240px;
  --rail-sm:  64px;
  --bar:      56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper); color: var(--ink);
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 600; letter-spacing: -0.01em; line-height: 1.2;
}
h1 { font-size: 26px; }
h2 { font-size: 19px; }
p  { margin: 0 0 10px; }
a  { color: inherit; }
time, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.main {
  flex: 1 1 auto; min-width: 0;
  padding: calc(var(--bar) + 18px) 16px 40px;
}
@media (min-width: 860px) {
  .main { padding: 32px 32px 48px; }
}

/* ---------- mobile top bar ---------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--bar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--ink); color: var(--bone);
}
.topbar .brand {
  font-family: Fraunces, Georgia, serif; font-size: 17px; font-weight: 600;
}
.burger {
  width: 38px; height: 38px; margin-left: -6px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  border: 0; background: none; padding: 0 8px; cursor: pointer;
}
.burger span { display: block; height: 2px; background: var(--bone); border-radius: 2px; }
.topbar .primary { margin-left: auto; padding: 8px 16px; font-size: 11px; }
@media (min-width: 860px) { .topbar { display: none; } }

/* ---------- rail and drawer ---------- */

.rail {
  display: none; flex-direction: column; flex: 0 0 auto;
  width: var(--rail); padding: 24px 20px;
  background: var(--ink); color: var(--bone);
  transition: width .2s ease;
}
.rail.collapsed { width: var(--rail-sm); padding: 12px 10px; align-items: center; }
@media (min-width: 860px) { .rail { display: flex; } }

.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rail-head .brand { font-family: Fraunces, Georgia, serif; font-size: 19px; font-weight: 600; }
.rail-head .sub {
  margin-top: 3px;
  font-family: Archivo, sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--warm);
}
.rail-toggle {
  border: 0; background: none; color: var(--warm); cursor: pointer;
  padding: 4px 6px; font-size: 15px; line-height: 1; border-radius: 8px;
}
.rail-toggle:hover { color: var(--bone); }

.nav { margin-top: 26px; display: grid; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 15px; font-weight: 500; text-decoration: none;
  color: var(--warm);
}
.nav a:hover { color: var(--bone); background: rgba(242, 237, 228, 0.06); }
.nav a.active { background: rgba(201, 164, 76, 0.16); color: var(--gold); }
.nav a .ico { width: 18px; text-align: center; flex: 0 0 auto; font-size: 15px; }
.nav a .badge {
  margin-left: auto; min-width: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--gold); color: var(--ink);
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.rail.collapsed .nav a { justify-content: center; padding: 10px; }
.rail.collapsed .nav a span:not(.ico) { display: none; }

.rail .primary { margin-top: 24px; width: 100%; }
.rail.collapsed .primary { width: 40px; height: 40px; padding: 0; margin-top: 18px; }

.rail-foot { margin-top: auto; padding-top: 28px; font-size: 13px; color: var(--warm); }
.rail-foot .who { margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot button { border: 0; background: none; color: var(--warm); padding: 0; text-decoration: underline; font-size: 13px; cursor: pointer; }
.rail-foot button:hover { color: var(--bone); }
.rail.collapsed .rail-foot { display: none; }

.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); }
.drawer {
  width: 268px; height: 100%; padding: 24px 20px;
  background: var(--ink); color: var(--bone);
  display: flex; flex-direction: column;
}
.drawer .nav a { font-size: 16px; }

/* ---------- buttons and pills ---------- */

button {
  font-family: "Hanken Grotesk", sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  padding: 8px 16px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
button:hover { background: var(--paper-2); }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: default; }

.primary {
  background: var(--gold); border-color: var(--gold); color: var(--ink);
  font-family: Archivo, "Hanken Grotesk", sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 11px 22px;
}
.primary:hover { background: var(--gold-lt); border-color: var(--gold-lt); }
.big { padding: 14px 26px; font-size: 13px; }
.wide { width: 100%; }
.tiny { padding: 5px 12px; font-size: 12px; }
.danger { color: #9d3b2a; }
.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 auto; }
.spread { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }

.link {
  border: 0; background: none; border-radius: 0; padding: 3px 0;
  color: var(--muted); text-decoration: underline; font-size: 14px;
}
.link:hover { background: none; color: var(--ink); }

/* Segmented switch, as on the Month / Week control. */
.segment {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.segment button { border: 0; padding: 6px 15px; font-size: 13px; color: var(--muted); background: none; }
.segment button:hover { background: var(--paper-2); }
.segment button[aria-pressed="true"] { background: var(--gold); color: var(--ink); font-weight: 600; }

/* ---------- page head ---------- */

.page-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; }
@media (min-width: 860px) { .page-head h1 { font-size: 32px; } }
.page-head .cluster { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- calendar ---------- */

.cal { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); }
.cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--paper-2); border-bottom: 1px solid var(--line);
}
.cal-dow div {
  padding: 9px 6px; text-align: center;
  font-family: Archivo, sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 96px; padding: 7px 7px 9px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer; background: var(--card);
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--paper-2); }
.cal-cell.dim { background: var(--paper); color: var(--muted); }
.cal-cell.today .daynum {
  background: var(--gold); color: var(--ink);
  border-radius: 999px; width: 25px; height: 25px;
  display: inline-flex; align-items: center; justify-content: center;
}
.daynum { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.pip {
  border: 0; text-align: left; width: 100%;
  padding: 4px 8px; border-radius: 7px; font-size: 12px; line-height: 1.35;
  background: var(--paper-2); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pip:hover { background: var(--line); }
.pip .t { font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 5px; }
.pip.is-due { background: var(--ink); color: var(--bone); }
.pip.is-due .t { color: var(--gold); }
.pip.is-done { opacity: .55; }

@media (max-width: 640px) {
  .cal-cell { min-height: 74px; padding: 5px 4px 7px; }
  .pip { font-size: 11px; padding: 3px 5px; }
  .pip .t { display: none; }
}

.cal-week .cal-cell { min-height: 190px; }

/* ---------- cards, lists, forms ---------- */

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.panel.slim { padding: 14px 16px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 11px; }
.section-head span {
  font-family: Archivo, sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}

.list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.item { padding: 15px 18px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item[role="button"] { cursor: pointer; }
.item[role="button"]:hover { background: var(--paper-2); }
.item-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-when { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.excerpt { margin: 6px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

label {
  display: block; margin: 0 0 7px;
  font-family: Archivo, sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
input, textarea, select {
  font-family: "Hanken Grotesk", sans-serif; font-size: 16px; width: 100%;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.field { margin-bottom: 20px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 7px; line-height: 1.5; }
.form-grid { display: grid; gap: 0; }
@media (min-width: 860px) { .form-grid.two { grid-template-columns: 1fr 1fr; gap: 0 22px; } }

/* ---------- due card ---------- */

.due { background: var(--surface); color: var(--bone); border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
.due-top {
  padding: 13px 20px; border-bottom: 1px solid var(--hairline);
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  font-family: Archivo, sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold);
}
.due-top .who { color: var(--warm); font-weight: 500; letter-spacing: 0.03em; text-transform: none; font-size: 13px; }
.due-body { padding: 20px; }
.due-body .hint { color: var(--warm); }
.caption { margin: 0 0 18px; white-space: pre-wrap; font-family: Fraunces, Georgia, serif; font-size: 19px; line-height: 1.5; color: var(--bone); }
.due .row > span { color: var(--warm); font-size: 14px; }
.due button { border-color: var(--hairline); color: var(--bone); }
.due button:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.due .primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.due .primary:hover { background: var(--gold-lt); color: var(--ink); }

.media { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.media a {
  display: block; padding: 11px 14px; border: 1px solid var(--hairline);
  border-radius: 12px; font-size: 14px; word-break: break-all;
  text-decoration: none; color: var(--warm); background: rgba(201,164,76,.07);
}
.media a:hover { border-color: var(--gold); color: var(--gold-lt); }
.media a::after {
  content: attr(data-kind); float: right; margin-left: 12px;
  font-family: Archivo, sans-serif; font-size: 10px;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}

/* ---------- chips and tags ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px;
  font-size: 14px; font-weight: 500; background: var(--card); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }

.tag {
  display: inline-block; margin-right: 6px; padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  font-family: Archivo, sans-serif; font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.tag.done { color: #6a5a2c; border-color: var(--gold); background: rgba(201,164,76,.12); }
.due .tag.done { color: var(--gold); background: transparent; }

/* ---------- states ---------- */

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty strong { display: block; margin-bottom: 7px; font-family: Fraunces, Georgia, serif; font-size: 19px; font-weight: 600; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--bone); padding: 12px 22px;
  border-radius: 999px; font-size: 14px; z-index: 60; max-width: calc(100% - 36px);
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}

.error { background: #fbf0e8; color: #8f3320; border: 1px solid #e0b9a6; border-radius: 12px; padding: 12px 15px; font-size: 15px; margin-bottom: 16px; }

.centered { max-width: 420px; margin: 0 auto; padding: 60px 20px; }
.centered h1 { margin-bottom: 10px; }
.centered .lede { color: var(--muted); margin-bottom: 30px; line-height: 1.6; }
.centered .primary { width: 100%; }

.hidden { display: none !important; }
