/* ============================================================
   Chorus — print-shop / risograph workspace
   Palette: warm paper + ink + a single flame accent
   Type: Fraunces (display) · IBM Plex Mono (everything else)
   ============================================================ */

:root{
  --paper:      #f4f1ea;
  --paper-2:    #efece3;   /* recessed panel */
  --card:       #fbfaf6;   /* raised card */
  --ink:        #1b1a17;
  --ink-soft:   #55503f;   /* was, tuned below */
  --ink-muted:  #6f6a5c;
  --ink-faint:  #928c7c;
  --flame:      #ee4a2b;
  --flame-deep: #c7381d;
  --flame-tint: rgba(238, 74, 43, 0.10);
  --line:       rgba(27, 26, 23, 0.14);
  --line-soft:  rgba(27, 26, 23, 0.08);
  --good:       #2f7d4f;
  --over:       #d1381f;
  --over-bg:    rgba(209, 56, 31, 0.14);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --shadow-1: 0 1px 0 rgba(27,26,23,0.05), 0 2px 6px rgba(27,26,23,0.05);
  --shadow-2: 0 2px 4px rgba(27,26,23,0.06), 0 14px 34px rgba(27,26,23,0.10);

  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --disp: 'Fraunces', Georgia, 'Times New Roman', serif;

  --maxw: 1240px;
  --gap: clamp(18px, 3vw, 30px);
}

*,*::before,*::after{ box-sizing:border-box; }

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

body{
  margin:0;
  font-family: var(--mono);
  font-weight:400;
  font-size:15px;
  line-height:1.55;
  color:var(--ink);
  background:var(--paper);
  /* subtle print-shop paper grain via two faint dotted gradients */
  background-image:
    radial-gradient(rgba(27,26,23,0.028) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}

h1,h2,h3{ font-family:var(--disp); font-weight:600; line-height:1.08; margin:0; letter-spacing:-0.01em; }

button{ font-family:inherit; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

.skip-link{
  position:absolute; left:12px; top:-46px; z-index:60;
  background:var(--ink); color:var(--paper); padding:8px 14px;
  border-radius:var(--r-sm); text-decoration:none; font-size:13px;
  transition:top .15s ease;
}
.skip-link:focus{ top:12px; }

/* ---------------- top bar ---------------- */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
  padding:14px clamp(16px, 4vw, 40px);
  background:rgba(244,241,234,0.86);
  backdrop-filter:saturate(1.3) blur(10px);
  -webkit-backdrop-filter:saturate(1.3) blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{ display:inline-flex; align-items:center; gap:12px; text-decoration:none; color:inherit; }
.brand-mark{ display:block; border-radius:8px; flex:none; }
.brand-text{ display:flex; flex-direction:column; line-height:1.05; }
.brand-name{ font-family:var(--disp); font-weight:600; font-size:22px; letter-spacing:-0.02em; }
.brand-tag{
  font-size:11px; letter-spacing:0.14em; text-transform:uppercase;
  color:var(--ink-muted); font-weight:500;
}

/* ---------------- buttons ---------------- */
.btn{
  --bg:var(--card); --fg:var(--ink); --bd:var(--line);
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:var(--mono); font-weight:500; font-size:14px;
  letter-spacing:0.01em;
  padding:10px 18px; border-radius:var(--r-pill);
  border:1.5px solid var(--bd); background:var(--bg); color:var(--fg);
  cursor:pointer; text-decoration:none;
  transition:transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover{ transform:translateY(-1px); box-shadow:var(--shadow-1); }
.btn:active{ transform:translateY(0); box-shadow:none; }
.btn:focus-visible{ outline:3px solid var(--flame); outline-offset:2px; }
.btn:disabled{ opacity:0.45; cursor:not-allowed; transform:none; box-shadow:none; }

.btn-primary{
  --bg:var(--flame); --fg:#fff; --bd:var(--flame);
  box-shadow:0 2px 0 var(--flame-deep);
}
.btn-primary:hover{ --bg:var(--flame-deep); box-shadow:0 4px 0 var(--flame-deep), var(--shadow-1); }
.btn-primary:active{ box-shadow:0 1px 0 var(--flame-deep); }
.btn-primary:disabled{ box-shadow:none; }

.btn-ink{ --bg:var(--ink); --fg:var(--paper); --bd:var(--ink); }
.btn-ink:hover{ --bg:#2c2a25; }

.btn-ghost{ --bg:transparent; }
.btn-ghost:hover{ --bg:var(--card); }

.btn-sm{ padding:8px 14px; font-size:13px; }

.icon-btn{
  border:1.5px solid var(--line); background:var(--card); color:var(--ink-muted);
  width:34px; height:34px; border-radius:var(--r-pill); cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; font-size:14px;
  transition:background .15s, color .15s, border-color .15s;
}
.icon-btn:hover{ color:var(--ink); border-color:var(--ink); }
.icon-btn:focus-visible{ outline:3px solid var(--flame); outline-offset:2px; }

/* ---------------- workspace layout ---------------- */
.workspace{
  max-width:var(--maxw);
  margin:0 auto;
  padding:clamp(20px,3.5vw,40px) clamp(16px,4vw,40px) 40px;
  display:grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap:var(--gap);
  align-items:start;
}
.pane{ min-width:0; display:flex; flex-direction:column; gap:18px; }

.card{
  background:var(--card);
  border:1.5px solid var(--line);
  border-radius:var(--r-lg);
  padding:clamp(16px,2.4vw,22px);
  box-shadow:var(--shadow-1);
}

.eyebrow{
  font-size:11px; letter-spacing:0.16em; text-transform:uppercase;
  color:var(--flame-deep); font-weight:600;
}
.eyebrow-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.saved-note{ font-size:11px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-faint); }

/* ---------------- compose card ---------------- */
.compose-card{ padding-bottom:14px; }
.draft-area{
  width:100%;
  min-height:210px;
  resize:vertical;
  border:none; outline:none; background:transparent;
  font-family:var(--mono); font-size:clamp(16px,1.9vw,19px); line-height:1.6;
  color:var(--ink);
  padding:2px 0 4px;
}
.draft-area::placeholder{ color:var(--ink-faint); }
.compose-foot{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  margin-top:10px; padding-top:12px; border-top:1px solid var(--line-soft);
  flex-wrap:wrap;
}
.count-overall{ font-weight:600; font-size:15px; }
.count-overall .num{ color:var(--flame-deep); }
.count-hint{ font-size:11px; color:var(--ink-faint); letter-spacing:0.02em; }

/* ---------------- link card ---------------- */
.field-label{ display:block; font-weight:500; font-size:13px; margin-bottom:8px; }
.field-label .opt{ color:var(--ink-faint); font-weight:400; }
.text-input{
  width:100%;
  font-family:var(--mono); font-size:14px; color:var(--ink);
  background:var(--paper); border:1.5px solid var(--line); border-radius:var(--r-md);
  padding:11px 13px; outline:none;
  transition:border-color .15s, box-shadow .15s;
}
.text-input::placeholder{ color:var(--ink-faint); }
.text-input:focus{ border-color:var(--flame); box-shadow:0 0 0 3px var(--flame-tint); }
.field-help{ margin:9px 0 0; font-size:12px; color:var(--ink-muted); line-height:1.5; }

/* ---------------- platforms / chips ---------------- */
.section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.section-head h2{ font-size:clamp(19px,2.4vw,23px); }
.sel-count{ font-size:12px; color:var(--ink-muted); letter-spacing:0.04em; }

.chips{ display:flex; flex-wrap:wrap; gap:9px; margin-top:14px; }
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 14px 8px 9px; border-radius:var(--r-pill);
  border:1.5px solid var(--line); background:var(--card); color:var(--ink);
  cursor:pointer; font-family:var(--mono); font-size:13.5px; font-weight:500;
  transition:transform .12s ease, box-shadow .15s ease, border-color .15s, background .15s;
  user-select:none;
}
.chip:hover{ transform:translateY(-1px); box-shadow:var(--shadow-1); border-color:var(--ink-faint); }
.chip:focus-visible{ outline:3px solid var(--flame); outline-offset:2px; }
.chip[aria-pressed="true"]{
  border-color:var(--ink); background:var(--ink); color:var(--paper);
  box-shadow:var(--shadow-1);
}
.chip[aria-pressed="true"] .chip-icon{ box-shadow:0 0 0 2px rgba(255,255,255,0.16); }
.chip-icon{
  width:24px; height:24px; border-radius:7px; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  color:#fff; font-weight:600; font-size:12px;
}
.chip-icon svg{ width:15px; height:15px; display:block; }
.chip-check{ font-size:11px; opacity:0; margin-left:-2px; transition:opacity .12s; }
.chip[aria-pressed="true"] .chip-check{ opacity:1; color:var(--flame); }

/* ---------------- actions row ---------------- */
.actions-row{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.actions-row .btn-primary{ font-size:15px; padding:12px 22px; }
.actions-hint{ font-size:12px; color:var(--ink-muted); max-width:34ch; }

/* ---------------- how it works ---------------- */
.how{ padding:0; overflow:hidden; }
.how summary{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; cursor:pointer; list-style:none;
  font-weight:500;
}
.how summary::-webkit-details-marker{ display:none; }
.how-title{ font-size:14px; }
.how-title::before{ content:"ⓘ "; color:var(--flame-deep); }
.how-chev{ color:var(--ink-muted); transition:transform .2s ease; }
.how[open] .how-chev{ transform:rotate(180deg); }
.how-body{ padding:0 20px 18px; border-top:1px solid var(--line-soft); }
.how-body p{ margin:14px 0 0; font-size:13.5px; line-height:1.62; color:var(--ink-soft); }
.how-body strong{ color:var(--ink); }

/* ---------------- preview pane ---------------- */
.preview-pane{ position:sticky; top:78px; }
.sticky-head{ margin-bottom:2px; }
.previews{ display:flex; flex-direction:column; gap:14px; }

.empty{
  border:1.5px dashed var(--line); border-radius:var(--r-lg);
  padding:34px 24px; text-align:center; color:var(--ink-muted);
  font-size:13.5px; line-height:1.6; background:var(--paper-2);
}
.empty-mark{ display:block; font-size:26px; color:var(--ink-faint); margin-bottom:10px; }

/* ---------------- preview card ---------------- */
.pcard{
  background:var(--card); border:1.5px solid var(--line); border-radius:var(--r-lg);
  overflow:hidden; box-shadow:var(--shadow-1);
  animation:pop .22s ease both;
}
@keyframes pop{ from{ opacity:0; transform:translateY(6px) scale(.99);} to{opacity:1; transform:none;} }
.pcard-head{
  display:flex; align-items:center; gap:11px;
  padding:13px 15px 12px;
  border-bottom:1px solid var(--line-soft);
}
.pcard-icon{
  width:30px; height:30px; border-radius:8px; flex:none;
  display:inline-flex; align-items:center; justify-content:center; color:#fff;
}
.pcard-icon svg{ width:17px; height:17px; }
.pcard-titles{ flex:1; min-width:0; }
.pcard-name{ font-family:var(--disp); font-weight:600; font-size:16px; }
.pcard-sub{ font-size:11px; color:var(--ink-faint); letter-spacing:0.02em; }
.pcard-count{
  font-size:12.5px; font-weight:600; white-space:nowrap;
  padding:3px 9px; border-radius:var(--r-pill); background:var(--paper-2);
  color:var(--ink-muted);
}
.pcard-count.ok{ color:var(--good); }
.pcard-count.over{ color:#fff; background:var(--over); animation:shake .3s ease; }
.pcard-count.nolimit{ color:var(--ink-faint); }
@keyframes shake{ 10%,90%{transform:translateX(-1px);} 30%,70%{transform:translateX(2px);} 50%{transform:translateX(-2px);} }

.pcard-body{ padding:13px 15px; }
.preview-text{
  font-size:13.5px; line-height:1.58; white-space:pre-wrap; word-break:break-word;
  color:var(--ink); background:var(--paper); border:1px solid var(--line-soft);
  border-radius:var(--r-md); padding:11px 13px; min-height:20px;
  max-height:210px; overflow:auto;
}
.preview-text .over{ background:var(--over-bg); color:var(--over); border-radius:2px; text-decoration:line-through; text-decoration-color:rgba(209,56,31,0.55); }
.preview-text .plink{ color:var(--flame-deep); word-break:break-all; }
.preview-text.empty-text{ color:var(--ink-faint); font-style:italic; }

.over-note{
  margin:9px 0 0; font-size:12px; color:var(--over);
  display:flex; align-items:center; gap:6px;
}
.info-note{ margin:9px 0 0; font-size:12px; color:var(--ink-muted); line-height:1.5; }
.info-note a{ color:var(--flame-deep); }

.pfield{ margin-bottom:11px; }
.pfield label{ display:block; font-size:12px; font-weight:500; margin-bottom:6px; color:var(--ink-soft); }
.pfield .text-input{ font-size:13px; padding:9px 11px; background:var(--card); }
.pfield .req{ color:var(--over); }
.instance-wrap{ display:flex; align-items:center; }
.instance-wrap .prefix{ color:var(--ink-faint); font-size:12px; padding:0 8px 0 2px; white-space:nowrap; }
.instance-wrap .text-input{ flex:1; }

.pcard-actions{
  display:flex; gap:9px; flex-wrap:wrap; margin-top:13px;
}
.pcard-actions .btn{ flex:1 1 auto; }
.btn-copy{ flex:0 0 auto; }

/* ---------------- post-everywhere sequence ---------------- */
.sequence-overlay{ position:fixed; inset:0; z-index:80; display:flex; align-items:flex-end; justify-content:center; }
.sequence-overlay[hidden]{ display:none; }
.sequence-scrim{ position:absolute; inset:0; background:rgba(27,26,23,0.42); backdrop-filter:blur(3px); animation:fade .2s ease; }
@keyframes fade{ from{opacity:0;} to{opacity:1;} }
.sequence-sheet{
  position:relative; width:min(520px, 100%);
  background:var(--card); border:1.5px solid var(--line);
  border-radius:var(--r-lg) var(--r-lg) 0 0;
  box-shadow:var(--shadow-2);
  padding:22px clamp(18px,4vw,26px) calc(22px + env(safe-area-inset-bottom));
  animation:slideup .26s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes slideup{ from{ transform:translateY(20px); opacity:0;} to{transform:none; opacity:1;} }
.seq-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.seq-head h3{ font-size:21px; margin-top:3px; }
.seq-progress{ display:flex; align-items:center; gap:12px; margin:16px 0 4px; }
.seq-progress-bar{ flex:1; height:7px; background:var(--paper-2); border-radius:var(--r-pill); overflow:hidden; border:1px solid var(--line-soft); }
.seq-progress-fill{ display:block; height:100%; width:0%; background:var(--flame); border-radius:var(--r-pill); transition:width .3s ease; }
.seq-counter{ font-size:12px; font-weight:600; color:var(--ink-muted); white-space:nowrap; }

.seq-body{ padding:16px 0 6px; }
.seq-current{ display:flex; align-items:center; gap:13px; margin-bottom:14px; }
.seq-current .pcard-icon{ width:42px; height:42px; border-radius:11px; }
.seq-current .pcard-icon svg{ width:23px; height:23px; }
.seq-cur-name{ font-family:var(--disp); font-weight:600; font-size:20px; }
.seq-cur-sub{ font-size:12px; color:var(--ink-muted); }
.seq-hint{ font-size:13px; color:var(--ink-soft); line-height:1.6; margin:0 0 4px; }
.seq-dots{ display:flex; gap:6px; flex-wrap:wrap; margin-top:14px; }
.seq-dot{ width:9px; height:9px; border-radius:50%; background:var(--line); transition:background .2s, transform .2s; }
.seq-dot.done{ background:var(--good); }
.seq-dot.current{ background:var(--flame); transform:scale(1.25); }

.seq-done{ text-align:center; padding:12px 0 6px; }
.seq-done .big{ font-size:40px; line-height:1; }
.seq-done h4{ font-family:var(--disp); font-weight:600; font-size:22px; margin:12px 0 6px; }
.seq-done p{ font-size:13.5px; color:var(--ink-muted); margin:0; }

.seq-foot{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding-top:16px; border-top:1px solid var(--line-soft); }
.seq-foot .btn-primary{ min-width:180px; }

/* ---------------- toast ---------------- */
.toast{
  position:fixed; left:50%; bottom:26px; transform:translateX(-50%) translateY(12px);
  z-index:100; background:var(--ink); color:var(--paper);
  padding:11px 20px; border-radius:var(--r-pill); font-size:13.5px; font-weight:500;
  box-shadow:var(--shadow-2); opacity:0; pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
  display:inline-flex; align-items:center; gap:9px;
}
.toast[hidden]{ display:none; }
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.toast .tick{ color:#7bd39a; }

/* ---------------- footer ---------------- */
.site-footer{ border-top:1px solid var(--line); margin-top:20px; background:var(--paper-2); }
.footer-inner{ max-width:var(--maxw); margin:0 auto; padding:34px clamp(16px,4vw,40px) 44px; }
.footer-brand{ display:inline-flex; align-items:center; gap:10px; font-size:15px; }
.footer-brand strong{ font-family:var(--disp); font-weight:600; }
.footer-note{ margin:14px 0 0; font-size:13px; color:var(--ink-muted); max-width:62ch; line-height:1.6; }
.footer-colophon{ margin:10px 0 0; font-size:12px; color:var(--ink-faint); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px){
  .workspace{ grid-template-columns:1fr; }
  .preview-pane{ position:static; }
  .sequence-overlay{ align-items:flex-end; }
}
@media (max-width: 560px){
  body{ font-size:14.5px; }
  .topbar{ padding:12px 16px; }
  .brand-tag{ display:none; }
  .brand-name{ font-size:20px; }
  .btn{ padding:10px 15px; }
  .draft-area{ min-height:180px; }
  .actions-row .btn-primary{ width:100%; }
  .actions-hint{ max-width:none; }
  .pcard-actions .btn{ flex:1 1 100%; }
  .sequence-sheet{ border-radius:var(--r-lg) var(--r-lg) 0 0; }
  .seq-foot{ flex-direction:column-reverse; align-items:stretch; }
  .seq-foot .btn{ width:100%; }
}

/* ---------------- motion / a11y ---------------- */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; }
}
