/* Nuntius — shared styles.
   Direction: a society ledger. Laid paper, iron-gall ink, oxblood accent
   like bookbinding leather, bronze for small-caps eyebrows. Hairline and
   double rules as the structural device (they mark sections the way rules
   mark a title page). One display face used sparingly; fast everywhere. */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper:   #F6F1E7;
  --ink:     #221D18;
  --oxblood: #722F2F;
  --bronze:  #8A6D3B;
  --rule:    #D9CFBC;
  --faint:   #6B6154;
  --ok:      #4A5D45;
  --display: 'Cormorant Garamond', Georgia, serif;
  --body:    'EB Garamond', Georgia, serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  /* iOS rubber-band scrolling repaints position:fixed bars mid-page as a
     ghost row; disabling the bounce removes the artifact. */
  overscroll-behavior-y: none;
}

.sheet {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* Masthead: eyebrow, title, double rule — the title-page motif. */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bronze);
  margin: 0 0 6px;
}

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}

.masthead { padding-bottom: 14px; margin-bottom: 22px; position: relative; }
.masthead::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 3px;
}

.subtitle { color: var(--faint); font-style: italic; margin: 0; }

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  margin: 30px 0 10px;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 26px 0; }

p { margin: 0 0 12px; }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 13px; }

/* Controls */
button, .btn {
  font-family: var(--body);
  font-size: 17px;
  background: var(--oxblood);
  color: var(--paper);
  border: 1px solid var(--oxblood);
  padding: 10px 22px;
  cursor: pointer;
  border-radius: 2px;
}
button:hover, .btn:hover { background: #5E2626; }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, label:focus-within {
  outline: 2px solid var(--bronze);
  outline-offset: 2px;
}
button.quiet {
  background: transparent;
  color: var(--oxblood);
  border: 1px solid var(--oxblood);
}
button.quiet:hover { background: rgba(114,47,47,0.07); }
button:disabled { opacity: 0.45; cursor: default; }

input[type=text], input[type=email], input[type=date],
input[type=datetime-local], input[type=time], textarea, select {
  font-family: var(--body);
  font-size: 16px;
  color: var(--ink);
  background: #FDFBF5;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 8px 10px;
  width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
label { display: block; margin: 12px 0 4px; }
label .hint { color: var(--faint); font-size: 14px; font-style: italic; }

/* Choice rows: likelihood scale, date approvals */
.choice {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--rule);
  background: #FDFBF5;
  padding: 12px 14px;
  margin: 8px 0;
  cursor: pointer;
  border-radius: 2px;
}
.choice input { width: auto; accent-color: var(--oxblood); }
.choice.picked { border-color: var(--oxblood); background: #F8EFE9; }

/* Status line after actions */
.status { margin-top: 14px; font-style: italic; }
.status.ok { color: var(--ok); }
.status.err { color: var(--oxblood); }

/* Tables (admin) */
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--bronze);
  text-align: left; padding: 6px 8px;
  border-bottom: 1px solid var(--ink);
}
td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }

/* Admin nav tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 20px; }
.tabs button {
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); font-size: 15px; padding: 7px 16px;
}
.tabs button.active {
  border-color: var(--ink); background: var(--ink); color: var(--paper);
}

.pill {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 1px 8px; margin: 1px 2px 1px 0; color: var(--faint);
}

.card {
  border: 1px solid var(--rule);
  background: #FDFBF5;
  padding: 16px 18px;
  margin: 12px 0;
  border-radius: 2px;
}
a.item-poll {
  display: block; text-decoration: none; color: var(--ink);
  border-color: var(--oxblood);
}
a.item-poll:hover { background: #F8EFE9; }
a.item-poll::after {
  content: "Answer →"; display: block; margin-top: 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--oxblood);
}
.item-duty { border-left: 3px solid var(--bronze); }

/* ---- Member app: four-tab layout ---- */

/* Fixed header stack: banners (if any) sit above a black title bar. The
   stack owns the notch inset, so whichever element is topmost bleeds into
   it — hence the .has-banner switch on the background colour. */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: var(--ink);
  padding-top: env(safe-area-inset-top);
  transform: translateZ(0);
  backface-visibility: hidden;
}
.topbar.has-banner { background: var(--oxblood); }

.appbar {
  background: var(--ink); color: var(--paper);
  font-family: var(--display); font-weight: 600; font-size: 20px;
  letter-spacing: 0.02em;
  padding: 11px 20px 12px;
  display: flex; align-items: center; gap: 12px;
}
.appbar .appbar-back {
  background: transparent; border: 0; color: var(--paper);
  font-family: var(--body); font-size: 17px; padding: 0;
  cursor: pointer; opacity: 0.85;
}
.appbar .appbar-back:hover { opacity: 1; background: transparent; }

.banner {
  display: block; background: var(--oxblood); color: var(--paper);
  font-family: var(--body); text-decoration: none;
  padding: 10px 20px; border: 0; border-radius: 0;
  border-bottom: 1px solid rgba(246,241,231,0.25);
}

/* A hidden tab must collapse completely — without this, a stray descender
   from the tab's first heading can survive as a sliver. */
[hidden] { display: none !important; }

.mtab[hidden] { display: none !important; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--paper);
  border-top: 1px solid var(--ink);
  /* Own compositing layer: without this iOS Safari leaves ghost strips of
     the fixed bar painted mid-scroll. */
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
  /* Sit well clear of the home indicator, the way native apps do —
     the inset alone leaves the row low enough that taps fight the
     system gesture area. */
  padding-bottom: calc(env(safe-area-inset-bottom) + 34px);
}
.tabbar button {
  flex: 1; background: transparent; color: var(--faint);
  border: 0; border-radius: 0; padding: 14px 0 8px;
  font-family: var(--display); font-size: 16px; font-weight: 600;
}
.tabbar button.active {
  color: var(--oxblood);
  border-top: 2px solid var(--oxblood); margin-top: -1px;
}
.tabbar button:hover { background: rgba(114,47,47,0.05); }

.survey-strip {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 2px 2px 10px; -webkit-overflow-scrolling: touch;
}
.survey-card {
  flex: 0 0 auto; width: 200px;
  border: 1px solid var(--oxblood); background: #F8EFE9;
  border-radius: 2px; padding: 12px 14px;
  text-decoration: none; color: var(--ink);
}
.survey-kind {
  display: block; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--oxblood); margin-bottom: 4px;
}

.dayrule {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 6px; color: var(--bronze);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.dayrule::before, .dayrule::after {
  content: ""; flex: 1; border-top: 1px solid var(--rule);
}

.job-card .job-head { display: flex; justify-content: space-between; gap: 10px; }
.job-card .job-open { display: block; margin-top: 10px; font-size: 13px; padding: 4px 12px; }

a.item-poll.answered { border-color: var(--rule); }
a.item-poll.answered::after { content: "Revise →"; color: var(--faint); }

.prop-wrap { position: relative; }
.prop-wrap .prop-approve {
  display: block; width: 100%; margin: -4px 0 14px;
  font-size: 13px; padding: 6px 12px;
  border-color: var(--bronze); color: var(--bronze);
}
.prop-wrap .prop-approve:hover { background: rgba(138,109,59,0.08); }

.jobsheet {
  position: fixed; inset: 0; z-index: 90;
  background: var(--paper); overflow-y: auto;
}

/* Modals — the panel is a sheet of paper laid over the ledger, so it keeps
   the same rules and type rather than becoming a generic dialog box. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(34, 29, 24, 0.42);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-panel {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 0 12px 40px rgba(34, 29, 24, 0.25);
  max-width: 480px; width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  border-radius: 2px;
}
.modal-head {
  padding: 18px 22px 12px; position: relative;
}
.modal-head::after {
  content: ""; position: absolute; left: 22px; right: 22px; bottom: 0;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  height: 3px;
}
.modal-head h2 { margin: 0; font-size: 22px; }
.modal-head p { margin: 4px 0 0; font-size: 15px; font-style: italic; }
.modal-body { padding: 20px 22px 6px; overflow-y: auto; flex: 1; }
.modal-actions {
  padding: 14px 22px 18px; display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--rule);
}

/* Audience picker */
.picker-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.picker-quick button { font-size: 14px; padding: 5px 13px; }
.picker-quick button.strong { border-color: var(--ink); color: var(--ink); }
.picker-quick button.strong:hover { background: rgba(34,29,24,0.06); }
.picker-search { margin-bottom: 10px; }
.picker-list {
  border: 1px solid var(--rule); background: #FDFBF5;
  max-height: 260px; overflow-y: auto; border-radius: 2px;
}
.picker-list > p { padding: 14px; margin: 0; font-style: italic; }
.picker-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 0; cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: #F3ECE0; }
.picker-row.picked { background: #F8EFE9; }
.picker-row input { width: auto; accent-color: var(--oxblood); }
.picker-roles {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--faint); white-space: nowrap;
}
.picker-warn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--oxblood);
  border: 1px solid var(--oxblood); border-radius: 999px; padding: 0 6px;
}
.picker-roles + .picker-warn { margin-left: 8px; }
.picker-count {
  margin: 10px 0 4px; font-style: italic; color: var(--faint); font-size: 15px;
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fade 0.35s ease-out; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } }
  .modal-panel { animation: rise 0.18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}
