/* ==========================================================================
   Whatstack — app-layer stylesheet
   Editorial restraint over the existing reference site. Glenbran tokens.
   ========================================================================== */

/* Fonts loaded via Google Fonts in the HTML head. */

.ws {
  /* palette */
  --cream:   #F6F2E8;
  --forest:  #1F3D34;
  --forest-d:#162C25;
  --navy:    #1E2A38;
  --sage:    #8FA59A;
  --sage-d:  #6E8579;
  --pale:    #C9D3CC;
  --ink:     #23313A;
  --ink-soft:#555A56;
  --ink-faint:#9A9D98;
  --line:    #D9D2C7;
  --rule-light:#E5E6E2;
  --warn:    #A84A2A;
  --warn-bg: #FBF2EC;
  --pairing-bg:#EEF0EC;
  --tag-bg:  #F0EFE9;
  --paper-2: #FBFAF5;

  --serif: "Playfair Display", Garamond, "Times New Roman", serif;
  --sans:  "Source Sans 3", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono:  "DM Mono", "Menlo", monospace;

  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--cream);
  /* subtle dot texture */
  background-image: radial-gradient(var(--line) 0.6px, transparent 0.7px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  box-sizing: border-box;
  height: 100%;
  position: relative;
}
.ws *, .ws *::before, .ws *::after { box-sizing: border-box; }
.ws ::selection { background: rgba(143,165,154,0.32); }

/* -- Type roles ------------------------------------------------------------ */
.ws-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage-d);
  font-weight: 500;
}
.ws-eyebrow--sans {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage-d);
  font-weight: 600;
}
.ws-serif { font-family: var(--serif); color: var(--forest); font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; }
.ws-serif em, .ws-italic-accent { font-style: italic; color: var(--forest); }
.ws-lead {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.34;
}
.ws-body { font-size: 16px; line-height: 1.6; color: var(--ink); }
.ws-muted { color: var(--ink-soft); }
.ws-faint { color: var(--ink-faint); }

/* divider */
.ws-divider { width: 96px; height: 1px; background: var(--sage); border: 0; margin: 18px 0 0; }
.ws-hair { width: 100%; height: 1px; background: var(--rule-light); border: 0; }

/* -- Tag pills ------------------------------------------------------------- */
.ws-tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: 2px;
  background: var(--tag-bg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--forest);
  white-space: nowrap;
}
.ws-tag--warn { background: var(--warn-bg); color: var(--warn); }

/* evidence dots */
.ws-dots { display: inline-flex; gap: 4px; align-items: center; }
.ws-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--forest); }
.ws-dot.is-off { background: transparent; box-shadow: inset 0 0 0 1px var(--pale); }

/* -- Field rows (reference entry detail grid) ------------------------------ */
.ws-fields { display: grid; grid-template-columns: 160px 1fr; row-gap: 22px; column-gap: 28px; }
.ws-field-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--sage-d); padding-top: 2px; }
.ws-field-val { font-size: 15.5px; line-height: 1.55; color: var(--ink); }
.ws-field-val b, .ws-field-val strong { font-weight: 600; color: var(--forest); }

/* -- Callout (pairing / warning) — 3px left border, square ----------------- */
.ws-callout { padding: 18px 22px; border-left: 3px solid var(--forest); background: var(--pairing-bg); }
.ws-callout--warn { border-left-color: var(--warn); background: var(--warn-bg); }
.ws-callout-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--forest); margin-bottom: 8px; }
.ws-callout--warn .ws-callout-label { color: var(--warn); }
.ws-callout-body { font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }

/* ==========================================================================
   THE NEW APP CHROME
   ========================================================================== */

/* -- Site header ----------------------------------------------------------- */
.ws-header {
  display: flex; align-items: center; gap: 28px;
  padding: 26px 48px 22px;
  border-bottom: 1px solid var(--line);
}
.ws-brand { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; }
.ws-brand-name { font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--forest); letter-spacing: -0.01em; }
.ws-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ws-nav a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sage-d); text-decoration: none; white-space: nowrap;
}
.ws-nav a.is-active { color: var(--forest); }
.ws-nav a:hover { color: var(--forest); }

/* the new account cluster on the right of the header */
.ws-account { margin-left: auto; display: flex; align-items: center; gap: 18px; flex: 0 0 auto; }

/* stack switcher button (header) */
.ws-switcher {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 12px 7px 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  cursor: pointer;
  font-family: var(--sans);
}
.ws-switcher:hover { border-color: var(--sage); }
.ws-switcher-eyebrow { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sage-d); display: block; line-height: 1.2; }
.ws-switcher-name { font-family: var(--serif); font-size: 16px; color: var(--forest); line-height: 1.1; }
.ws-caret { color: var(--sage-d); font-size: 11px; line-height: 1; }

/* avatar — monogram, square, no shadow */
.ws-avatar {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 15px; color: var(--forest); cursor: pointer;
}
.ws-avatar:hover { border-color: var(--sage); }

/* -- Buttons --------------------------------------------------------------- */
.ws-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 11px 20px; border: 1px solid var(--forest); background: var(--forest); color: var(--cream);
  cursor: pointer; border-radius: 0; transition: background 110ms ease, border-color 110ms ease;
  letter-spacing: 0.01em;
}
.ws-btn:hover { background: var(--forest-d); border-color: var(--forest-d); }
.ws-btn--ghost { background: transparent; color: var(--forest); }
.ws-btn--ghost:hover { background: rgba(31,61,52,0.06); }
.ws-btn--block { width: 100%; }

/* mono link with arrow */
.ws-link { font-family: var(--serif); font-style: italic; color: var(--sage-d); text-decoration: none; font-size: 16px; }
.ws-link:hover { color: var(--forest); }
.ws-link-mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--forest); text-decoration: none; }
.ws-link-mono:hover { color: var(--forest-d); }

/* ==========================================================================
   ADD-TO-STACK CONTROL — the signature new affordance
   Quiet by default; forest on hover. Square. No shadow.
   ========================================================================== */
.ws-add {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--sage-d);
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 13px;
  cursor: pointer; border-radius: 0;
  transition: color 110ms ease, border-color 110ms ease, background 110ms ease;
  white-space: nowrap;
}
.ws-add:hover { color: var(--forest); border-color: var(--sage); background: var(--paper-2); }
.ws-add .ws-add-glyph { font-family: var(--sans); font-size: 14px; line-height: 1; transform: translateY(-0.5px); }
.ws-add.is-added { color: var(--forest); border-color: var(--forest); background: var(--pairing-bg); }

/* compact (icon-ish) variant — sits inline in a tight title row */
.ws-add--compact { padding: 7px 11px; }

/* in-stack pill state */
.ws-add.is-added .ws-add-glyph { color: var(--forest); }

/* ==========================================================================
   WHICH-STACK PICKER — popover
   ========================================================================== */
.ws-popover {
  width: 280px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px -18px rgba(31,61,52,0.28);
  font-family: var(--sans);
}
.ws-popover-head {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--rule-light);
}
.ws-popover-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sage-d); }
.ws-popover-title { font-family: var(--serif); font-size: 17px; color: var(--forest); margin-top: 3px; line-height: 1.2; }
.ws-popover-list { padding: 6px; }
.ws-pick {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; background: transparent; cursor: pointer; text-align: left;
  transition: background 100ms ease;
}
.ws-pick:hover { background: var(--pairing-bg); }
.ws-pick-name { font-family: var(--serif); font-size: 16px; color: var(--forest); line-height: 1.15; }
.ws-pick-meta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-left: auto; }
.ws-pick-check { color: var(--forest); font-size: 13px; margin-left: auto; }
.ws-popover-foot { padding: 6px; border-top: 1px solid var(--rule-light); }
.ws-pick--new { color: var(--forest); }
.ws-pick--new .ws-pick-name { color: var(--forest); }
.ws-pick-newglyph { font-family: var(--sans); font-size: 16px; color: var(--sage-d); width: 16px; text-align: center; }

/* inline new-stack input row */
.ws-newstack { display: flex; gap: 8px; padding: 8px 8px 10px; }
.ws-input {
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); background: var(--cream);
  width: 100%; border-radius: 0; outline: none;
}
.ws-input:focus { border-color: var(--sage); }
.ws-input::placeholder { color: var(--ink-faint); }

/* ==========================================================================
   STACK DETAIL — item rows
   ========================================================================== */
.ws-stack-group { margin-top: 36px; }
.ws-stack-grouphead { display: flex; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ws-stack-grouptitle { font-family: var(--serif); font-size: 22px; color: var(--forest); }
.ws-stack-count { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-faint); }

.ws-item { display: grid; grid-template-columns: 1fr auto; gap: 10px 24px; padding: 18px 0; border-bottom: 1px solid var(--rule-light); align-items: start; }
.ws-item-name { font-family: var(--serif); font-size: 19px; color: var(--forest); line-height: 1.15; }
.ws-item-summary { font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 5px; max-width: 62ch; }
.ws-item-data { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; white-space: nowrap; }
.ws-item-metric { font-family: var(--mono); font-size: 12px; color: var(--forest); letter-spacing: 0.02em; }
.ws-item-metric-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

/* small remove affordance */
.ws-remove { font-family: var(--sans); font-size: 16px; color: var(--ink-faint); background: transparent; border: 0; cursor: pointer; line-height: 1; padding: 2px 4px; }
.ws-remove:hover { color: var(--warn); }

/* schedule chips (weekly) */
.ws-week { display: inline-flex; gap: 3px; }
.ws-week span { width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint); border: 1px solid var(--rule-light); }
.ws-week span.on { background: var(--forest); color: var(--cream); border-color: var(--forest); }

/* biomarker target range bar */
.ws-range { width: 150px; }
.ws-range-track { position: relative; height: 4px; background: var(--rule-light); }
.ws-range-fill { position: absolute; top: 0; height: 4px; background: var(--sage); }
.ws-range-mark { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--forest); }
.ws-range-labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); margin-top: 4px; letter-spacing: 0.04em; }

/* ==========================================================================
   STACK CARDS (dashboard / index)
   ========================================================================== */
.ws-stackcard { padding: 26px 28px 24px; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
.ws-stackcard:hover { border-color: var(--sage); background: var(--paper-2); }
.ws-stackcard-num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--sage-d); }
.ws-stackcard-name { font-family: var(--serif); font-size: 26px; color: var(--forest); margin: 8px 0 6px; line-height: 1.05; }
.ws-stackcard-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.ws-stackcard-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-top: 12px; }

/* dashed "new stack" card */
.ws-stackcard--new { border-style: dashed; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 100%; color: var(--sage-d); }
.ws-stackcard--new:hover { color: var(--forest); }
.ws-stackcard--new .ws-newbig { font-family: var(--sans); font-size: 28px; font-weight: 300; line-height: 1; margin-bottom: 10px; }

/* today's protocol row */
.ws-proto-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--rule-light); align-items: baseline; }
.ws-proto-time { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage-d); }
.ws-proto-name { font-family: var(--serif); font-size: 17px; color: var(--forest); }
.ws-proto-dose { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* check (done) toggle */
.ws-check { width: 18px; height: 18px; border: 1px solid var(--sage); display: inline-flex; align-items: center; justify-content: center; color: var(--cream); font-size: 11px; }
.ws-check.on { background: var(--forest); border-color: var(--forest); }

/* recommendation row */
.ws-rec { padding: 18px 0; border-bottom: 1px solid var(--rule-light); display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: start; }
.ws-rec:last-child { border-bottom: 0; }
.ws-rec-name { font-family: var(--serif); font-size: 18px; color: var(--forest); }
.ws-rec-type { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage-d); margin-left: 10px; }
.ws-rec-why { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-top: 5px; max-width: 70ch; }

/* auth surface */
.ws-authcard { width: 380px; }
.ws-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sage-d); display: block; margin-bottom: 7px; }
.ws-field { margin-bottom: 18px; }

/* mobile sheet */
.ws-sheet { border-top: 1px solid var(--line); background: var(--paper-2); box-shadow: 0 -18px 40px -20px rgba(31,61,52,0.25); }
.ws-sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 4px; }
