/* Dfive Schedule — same palette and type as dfive.us, adapted for an app UI. */
:root {
  --paper:    #f5f2ec;
  --paper-2:  #efeae1;
  --card:     #fffdf9;
  --ink:      #15181c;
  --ink-soft: #565d64;
  --ink-mute: #8b9199;
  --accent:   #927545;
  --accent-2: #a9854f;
  --rule:     #cdc6b8;
  --rule-2:   #e3ded3;
  --good:     #3f6b4f;
  --warn:     #8a5a2b;
  --bad:      #8c3a34;
  /* Availability scale — muted so it reads as a signal, not a traffic light,
     against the bone paper. Never the ONLY cue: the "N of M available" count
     carries the same information in text. */
  --av-none:  #b4524a;   /* red    — nobody can make it        */
  --av-few:   #c07a34;   /* orange — a minority can            */
  --av-most:  #b39a2e;   /* yellow — a majority, but not all   */
  --av-all:   #4a7d59;   /* green  — everyone invited can      */
  --radius:   10px;
  --shadow:   0 1px 2px rgba(21, 24, 28, .05), 0 8px 24px rgba(21, 24, 28, .05);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: "Cormorant", Georgia, serif; font-weight: 500; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: .01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 .8rem; }
a  { color: var(--accent); text-underline-offset: 3px; }

/* ---------- shell ---------- */
.site-header {
  border-bottom: 1px solid var(--rule-2);
  background: rgba(245, 242, 236, .92);
  backdrop-filter: saturate(120%) blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .bar {
  max-width: 1080px; margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
}
.brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand .mark { font-family: "Cormorant", Georgia, serif; font-size: 1.5rem; letter-spacing: .02em; }
.brand .sub {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 400;
}
.site-header .spacer { flex: 1; }
.who { font-size: .78rem; color: var(--ink-soft); }

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.site-footer {
  border-top: 1px solid var(--rule-2); color: var(--ink-mute);
  font-size: .74rem; text-align: center; padding: 1.25rem;
}

/* ---------- cards / layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--rule-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.tight { gap: .35rem; }
.between { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--ink-soft); font-size: .85rem; }
.tiny  { color: var(--ink-mute); font-size: .74rem; }
.eyebrow {
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 500; margin-bottom: .35rem;
}
hr.rule { border: 0; border-top: 1px solid var(--rule-2); margin: 1.25rem 0; }

/* ---------- controls ---------- */
label { display: block; font-size: .78rem; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: .3rem; }
input, textarea, select, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%; padding: .55rem .7rem; background: #fff;
  border: 1px solid var(--rule); border-radius: 8px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(146, 117, 69, .14); }
textarea { min-height: 76px; resize: vertical; }
.field { margin-bottom: .9rem; }
.field-row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

button {
  cursor: pointer; border-radius: 8px; padding: .55rem 1rem;
  border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink);
  letter-spacing: .03em; transition: background .15s, border-color .15s, color .15s;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fffdf9; }
button.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
button.ghost { background: transparent; }
button.link {
  background: none; border: none; padding: 0; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px;
}
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--bad); }
button.small { padding: .3rem .6rem; font-size: .78rem; }
.icon-x { background: none; border: none; color: var(--ink-mute); padding: .2rem .35rem; font-size: 1rem; line-height: 1; }
.icon-x:hover { color: var(--bad); }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .74rem;
  background: var(--paper-2); border: 1px solid var(--rule-2); color: var(--ink-soft);
}
.chip.you   { background: rgba(146, 117, 69, .12); border-color: var(--accent); color: var(--accent); }
.chip.open  { color: var(--good); border-color: rgba(63, 107, 79, .35); background: rgba(63, 107, 79, .08); }
.chip.closed{ color: var(--warn); border-color: rgba(138, 90, 43, .35); background: rgba(138, 90, 43, .08); }
.chip.best  { background: var(--accent); border-color: var(--accent); color: #fffdf9; }

/* ---------- slot list ---------- */
.slots { display: grid; gap: .6rem; }
.slot {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .8rem .95rem; border: 1px solid var(--rule-2);
  border-radius: var(--radius); background: #fff;
}
.slot.pick { cursor: pointer; }
.slot.pick:hover { border-color: var(--accent); }
.slot.on { border-color: var(--accent); background: rgba(146, 117, 69, .06); }
.slot.final { border-color: var(--accent); background: rgba(146, 117, 69, .06); }

/* Availability stripe. Left edge so it survives every other state class. */
.slot.av-none { box-shadow: inset 4px 0 0 var(--av-none); }
.slot.av-few  { box-shadow: inset 4px 0 0 var(--av-few); }
.slot.av-most { box-shadow: inset 4px 0 0 var(--av-most); }
.slot.av-all  { box-shadow: inset 4px 0 0 var(--av-all); }

.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.av-none .dot { background: var(--av-none); }
.av-few  .dot { background: var(--av-few); }
.av-most .dot { background: var(--av-most); }
.av-all  .dot { background: var(--av-all); }
.slot.av-all .count strong { color: var(--av-all); }
.slot.av-none .count strong { color: var(--av-none); }

.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .74rem; color: var(--ink-mute); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.slot .box {
  flex: none; width: 20px; height: 20px; margin-top: .18rem; border-radius: 5px;
  border: 1.5px solid var(--rule); background: #fff; display: grid; place-items: center;
  font-size: .8rem; color: #fffdf9;
}
.slot.on .box { background: var(--accent); border-color: var(--accent); }
.slot .body { flex: 1; min-width: 0; }
.slot .when { font-size: .98rem; }
.slot .when .day { color: var(--ink-soft); }
.slot .meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }
.slot .who-list { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .4rem; }
.count { font-size: .78rem; color: var(--ink-soft); white-space: nowrap; }
.count strong { color: var(--ink); font-weight: 500; }

/* ---------- proposal list ---------- */
.plist { display: grid; gap: .6rem; }
.pitem {
  display: block; width: 100%; text-align: left; background: #fff;
  border: 1px solid var(--rule-2); border-radius: var(--radius); padding: .9rem 1rem;
}
.pitem:hover { border-color: var(--accent); }
.pitem .t { font-family: "Cormorant", Georgia, serif; font-size: 1.25rem; }

/* ---------- share panel ---------- */
.share { background: var(--paper-2); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 1rem; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem; letter-spacing: .12em; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-radius: 8px;
  padding: .5rem .8rem; display: inline-block;
}
.copybox {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem; background: #fff; border: 1px solid var(--rule);
  border-radius: 8px; padding: .6rem .7rem; min-height: 110px;
}

/* ---------- misc ---------- */
.notice { padding: .7rem .9rem; border-radius: 8px; font-size: .85rem; border: 1px solid; }
.notice.err  { color: var(--bad);  border-color: rgba(140, 58, 52, .35); background: rgba(140, 58, 52, .07); }
.notice.ok   { color: var(--good); border-color: rgba(63, 107, 79, .35); background: rgba(63, 107, 79, .07); }
.notice.info { color: var(--ink-soft); border-color: var(--rule-2); background: var(--paper-2); }
.notice.chosen {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.notice.chosen .when { font-size: 1.05rem; color: var(--ink); }

/* ---------- add-to-calendar menu ---------- */
.cal { position: relative; display: inline-block; }
.cal-menu {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20;
  min-width: 272px; max-width: min(340px, calc(100vw - 2.5rem)); padding: .3rem;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal-menu[hidden] { display: none; }
.cal-menu a, .cal-menu button {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  width: 100%; text-align: left; background: none; border: none;
  padding: .45rem .55rem; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: .85rem; letter-spacing: 0;
}
.cal-menu a:hover, .cal-menu button:hover { background: var(--paper-2); }
/* The target name must never wrap; the hint gives way instead. */
.cal-menu a > span:first-child, .cal-menu button > span:first-child { white-space: nowrap; }
.cal-menu .hint { color: var(--ink-mute); font-size: .7rem; text-align: right; }
.cal-menu .note {
  margin: .2rem .55rem .35rem; padding-top: .4rem;
  border-top: 1px solid var(--rule-2);
  color: var(--ink-mute); font-size: .7rem; line-height: 1.45;
}

/* ---------- day grouping + block entry ---------- */
.day-head {
  font-family: "Cormorant", Georgia, serif;
  font-size: 1.05rem; color: var(--ink-soft);
  padding: .55rem .1rem .15rem;
  border-bottom: 1px solid var(--rule-2);
  margin-top: .35rem;
}
.slots .day-head:first-child { margin-top: 0; }

.block-row {
  padding: .6rem .75rem; background: #fff;
  border: 1px solid var(--rule-2); border-radius: var(--radius);
  align-items: center;
}

textarea.paste { min-height: 92px; font-size: .85rem; }

.inv-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
  gap: .5rem; align-items: center;
  padding: .35rem .5rem; background: #fff;
  border: 1px solid var(--rule-2); border-radius: 8px;
}
.inv-row input { padding: .35rem .5rem; font-size: .85rem; }
.inv-email {
  font-size: .8rem; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 620px) {
  .inv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .inv-email { grid-column: 1 / -1; }
}

/* ---------- optional note ---------- */
.note-field { margin: .25rem 0 .35rem; }
.note-open { font-size: .85rem; }
.note-shown { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.note-text {
  font-family: "Cormorant", Georgia, serif;
  font-size: 1rem; font-style: italic; color: var(--ink-soft);
  line-height: 1.5;
}

.empty { text-align: center; color: var(--ink-mute); padding: 2rem 1rem; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--rule); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

table.matrix { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--rule-2); padding: .45rem .5rem; text-align: center; }
table.matrix th.when { text-align: left; white-space: nowrap; font-weight: 400; }
table.matrix thead th { color: var(--ink-soft); font-weight: 400; vertical-align: bottom; }
table.matrix td.yes { color: var(--good); }
table.matrix td.no  { color: var(--rule); }
.scroll-x { overflow-x: auto; }

@media (max-width: 620px) {
  .card { padding: 1.15rem; }
  main { padding: 1.25rem 1rem 3rem; }
}
