/* Talk Tools — visual tokens drawn from the openpeacelab.org aesthetic
   (palette, type, rhythm). No logo, name, copy, or images from that site. */
:root {
  --background: #f6f7f8;
  --foreground: #16272b;
  --card: #fff;
  --card-foreground: #16272b;
  --primary: #193638;
  --primary-foreground: #fff;
  --secondary: #e9edef;
  --muted: #eef1f2;
  --muted-foreground: #5b6a70;
  --accent: #e4ebed;
  --destructive: #b32632;
  --destructive-bg: #fceff0;
  --border: #dce2e4;
  --input-border: #cbd8db;
  --ring: #6d8f93;
  --focus-ring: #497d86;
  --lime: #e0f6a0;
  --lime-border: #cfe394;
  --lime-hover: #d5ee88;
  --lime-ink: #233c32;
  --ink: #173437;
  --ink-hover: #285055;
  --text-muted: #657378;
  --text-label: #35565e;
  --eyebrow: #4a5d61;
  --tab-inactive: #5b6a70;
  --tab-underline: #24494b;
  --warn-bg: #fcf0e7;
  --warn-fg: #7a4a2e;
  --note-bg: #e9eff0;
  --note-fg: #355e62;
  --verify-bg: #edf2ee;
  --verify-border: #d8e2db;
  --sage-bg: #eaf0e7;
  --sage-border: #d9e3d3;
  --shadow: 0 8px 30px #1535380a;
  --radius: 8px;
  --radius-btn: 5px;
  --radius-input: 4px;
  --font-sans: Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --space: 8px;
  --page-pad: max(5vw, 24px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { color: #163236; background: #d8ee98; }

.skip {
  position: fixed;
  z-index: 99;
  left: 20px;
  top: -80px;
  color: var(--ink);
  background: #fff;
  padding: 10px;
}
.skip:focus { top: 10px; outline: 2px solid var(--focus-ring); outline-offset: 5px; }

.wrap { width: min(1080px, calc(100% - 2 * var(--page-pad))); margin: 0 auto; }

/* Header — white bar, tight brand, muted tagline with a hairline rule */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 var(--page-pad);
}
.site-header .brand,
.brand {
  color: var(--ink);
  letter-spacing: -1px;
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-light,
.brand span {
  font-weight: 400;
  letter-spacing: -0.5px;
}
.header-description,
.site-header .tagline {
  border-left: 1px solid var(--border);
  color: #657378;
  padding-left: 28px;
  font-size: 0.875rem;
  margin: 0;
}

.mode-banner {
  background: var(--ink);
  color: #f8f9f5;
  text-align: center;
  padding: 0.7rem var(--page-pad);
  font-size: 0.875rem;
  line-height: 1.55;
}
.mode-banner strong {
  color: var(--lime);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}
.mode-banner code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #d6eda1;
}

main.wrap { padding: 43px 0 0; }

.card {
  background: var(--card);
  border: 1px solid #dbe2e4;
  border-radius: var(--radius);
  padding: 26px 25px 27px;
  margin: 0 0 20px;
}
.card:hover { box-shadow: var(--shadow); }

.form h1, .results-header h2, .routine h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.8px;
  line-height: 1.14;
  margin: 0 0 13px;
  color: var(--ink);
}
.form h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.125rem);
}
.lede {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

label, legend {
  display: block;
  color: var(--text-label);
  font-weight: 500;
  font-size: 0.875rem;
  margin: 0.9rem 0 0.35rem;
}
.req, .opt { font-weight: 400; font-size: 0.75rem; }
.req { color: #a02d32; }
.opt { color: #6d8287; }

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  font: 400 1rem/1.5 var(--font-sans);
  color: #203f47;
  background: #fff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  min-height: 44px;
  padding: 10px 11px;
  outline: none;
}
textarea { resize: vertical; min-height: 110px; }
input::placeholder, textarea::placeholder { color: #5f7378; }
input:focus, select:focus, textarea:focus {
  border-color: #567e87;
  box-shadow: 0 0 0 2px #567e8718;
}
button:focus-visible,
a:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 5px;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-3 p { margin: 0; }

.levels {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
  margin: 1rem 0;
  background: #fbfcfc;
}
.chip-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; }
.chip-checks label {
  font-weight: 400;
  margin: 0;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--foreground);
}

.routine-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
  margin: 1rem 0;
  background: #fbfcfc;
}
.routine-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0.65rem;
}
.routine-choice {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 14px 16px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-weight: 400;
  color: var(--foreground);
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.routine-choice:hover { border-color: #567e87; }
.routine-choice:has(input:checked) {
  background: #f4f9e0;
  border-color: var(--lime-border);
  box-shadow: 0 0 0 1px var(--lime-border);
}
.routine-choice:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}
.routine-choice input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.choice-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.choice-blurb {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.trtw-hint {
  background: var(--sage-bg);
  border: 1px solid var(--sage-border);
  border-radius: var(--radius-input);
  padding: 10px 13px;
  color: var(--note-fg);
  margin-top: 0.6rem;
}

.generate-another {
  margin-top: 8px;
}
.generate-another .kicker { margin-top: 0; }
.generate-another .actions { flex-wrap: wrap; }

.hint { font-size: 0.75rem; color: #697a7d; margin: 0.35rem 0 0; }

.error {
  color: #a02d32;
  background: var(--destructive-bg);
  border-radius: var(--radius-input);
  padding: 10px;
  font-size: 0.875rem;
}
.warn {
  background: var(--warn-bg);
  border: 1px solid #f0dcc8;
  color: var(--warn-fg);
  padding: 10px 13px;
  border-radius: var(--radius-input);
  font-size: 0.875rem;
}

.actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; align-items: center; }

.btn {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: 1px solid var(--input-border);
  background: #fff;
  color: #244b52;
  min-height: 46px;
  padding: 13px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.18s, transform 0.18s, border-color 0.18s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
  background: var(--lime);
  border-color: var(--lime-border);
  color: var(--lime-ink);
}
.btn.primary:hover { background: var(--lime-hover); }
.btn.ghost,
.btn.secondary {
  background: #fff;
  color: #244b52;
  border: 1px solid #cbd9db;
}
.btn.dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn.dark:hover { background: var(--ink-hover); }
.btn:disabled { opacity: 0.65; cursor: wait; transform: none; }

/* Results */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 0 0 25px;
  border-bottom: 1px solid #d5dee0;
  height: 48px;
  align-items: stretch;
}
.tab {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--tab-inactive);
  padding: 0 0 15px;
  height: 48px;
  cursor: pointer;
  position: relative;
}
.tab.is-on {
  color: var(--ink);
  font-weight: 600;
}
.tab.is-on:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--tab-underline);
}
.tab:hover { color: var(--ink); }
.print-all-bar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 20px;
}

.results-header h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.125rem);
  letter-spacing: -0.8px;
}
.kicker, .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 12px;
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin: 0.3rem 0 1.2rem;
}
.meta-line div { margin: 0; font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.4px; }
.meta-line dt { display: inline; font-weight: 600; color: var(--ink); letter-spacing: 0.8px; text-transform: uppercase; }
.meta-line dd { display: inline; margin: 0 0 0 0.3rem; font-family: var(--font-sans); letter-spacing: 0; font-size: 0.875rem; color: var(--text-muted); }
.obj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.results-header h3, .routine h3 {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.1rem 0 0.35rem;
  color: var(--ink);
  letter-spacing: 0;
}
.vocab { list-style: none; padding: 0; margin: 0; }
.vocab li { padding: 0.45rem 0; border-bottom: 1px solid #e4e9ea; }
.vocab li:last-child { border-bottom: 0; }
.vocab strong { font-weight: 600; }
.core-q {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.3px;
  line-height: 1.3;
  margin: 0.2rem 0 0.9rem;
  color: var(--ink);
}

.verify-banner, .flag, .demo-note, .val-errors {
  border-radius: 6px;
  padding: 14px 16px;
  margin: 0.7rem 0;
}
.verify-banner {
  background: var(--verify-bg);
  border: 1px solid var(--verify-border);
  color: #355e62;
}
.flag {
  background: #eaf3f7;
  border: 1px solid #d7e3e4;
  color: #3d6b7a;
}
.flag.misconception {
  background: var(--verify-bg);
  border-color: var(--verify-border);
  color: #344e42;
}
.flag.sensitive {
  background: var(--warn-bg);
  border-color: #f0dcc8;
  color: var(--warn-fg);
}
.demo-note {
  background: var(--ink);
  color: #f8f9f5;
  border: 0;
}
.demo-note strong { color: var(--lime); }
.val-errors {
  background: var(--destructive-bg);
  border: 1px solid #e8c5c8;
  color: #8b2a30;
}

[contenteditable] { border-radius: 4px; }
[contenteditable]:hover { background: rgba(23, 52, 55, 0.04); }

.routine { margin: 0 0 1.6rem; }
.routine-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 0.9rem; }
.attr { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin: 0 0 0.8rem; }
.steps { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.steps li { display: flex; gap: 0.7rem; padding: 0.35rem 0; border-bottom: 1px solid #eef1f2; }
.steps .mins {
  flex: 0 0 4.4rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  color: #3e6c70;
}
.moves, .stems { margin: 0; padding-left: 1.15rem; }
.stem-band { margin: 0.4rem 0 0.8rem; }
.stem-band h4 {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #697b7f;
}
.needs-text {
  background: var(--sage-bg);
  border: 1px solid var(--sage-border);
  padding: 18px 20px;
  border-radius: var(--radius);
  margin: 0.6rem 0 1rem;
}
.needs-text strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.3px;
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.print-only-head { display: none; }

.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  color: #5b6a70;
  margin-top: 48px;
  padding: 27px var(--page-pad);
  font-size: 0.75rem;
}
.site-footer .wrap { width: min(1080px, 100%); }
.site-footer p { margin: 0 0 0.35rem; }
.site-footer .hint { color: #5b6a70; }

@media (max-width: 800px) {
  .site-header { gap: 15px; min-height: 79px; padding: 0 22px; }
  .brand { font-size: 1.5rem; }
  .header-description, .site-header .tagline { display: none; }
  main.wrap { padding-top: 30px; }
  .grid-3, .obj-grid, .routine-choices { grid-template-columns: 1fr; }
  .tabs { gap: 24px; }
  .form h1 { font-size: 1.8rem; }
  .core-q { font-size: 1.25rem; }
}
@media (max-width: 440px) {
  .site-header { padding: 0 18px; gap: 12px; }
  .brand { font-size: 1.25rem; letter-spacing: -0.5px; }
  .wrap { width: calc(100% - 36px); }
  .card { padding: 22px 18px; }
  .btn { min-height: 40px; padding: 10px 14px; }
  .tabs { gap: 16px; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Per-card loading / error */
.routine.is-loading,
.routine.is-error {
  min-height: 8rem;
}
.routine-status {
  margin: 0.75rem 0 0;
  color: var(--muted, #4a5555);
}
.routine.is-loading .routine-status::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.45em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.routine.is-error .routine-status.error {
  color: #8a1f1f;
}
#core-error .btn { margin-left: 0.5rem; }

/* Print: letter, B&W-friendly, one routine per page */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 9.5pt;
    line-height: 1.35;
  }
  .no-print,
  .site-header,
  .mode-banner,
  .form,
  .tabs,
  .print-all-bar,
  .generate-another,
  .routine-actions,
  .skip,
  .site-footer {
    display: none !important;
  }
  .wrap { width: auto; margin: 0; }
  .card { border: none; box-shadow: none; padding: 0; margin: 0; background: #fff; }
  .results { display: block !important; }
  .results-header { display: none !important; }
  .print-only-head {
    display: block;
    margin: 0 0 0.5rem;
    padding: 0 0 0.4rem;
    border-bottom: 1px solid #333;
  }
  .print-only-head p { margin: 0.15rem 0; color: #000; }
  .routine { break-after: page; page-break-after: always; margin: 0; box-shadow: none; }
  .routine:last-child { break-after: auto; page-break-after: auto; }
  .routine.is-loading, .routine.is-error { display: none !important; }
  .routine h2 { font-size: 14pt; margin: 0 0 0.15rem; color: #000; letter-spacing: -0.4px; }
  .routine h3 { font-size: 11pt; margin: 0.45rem 0 0.12rem; color: #000; }
  .routine p, .routine li { margin: 0.12rem 0; color: #000; }
  .attr, .hint, .kicker, .stem-band h4, .steps .mins { color: #222; }
  .core-q { color: #000; }
  .needs-text, .verify-banner, .flag {
    background: #fff;
    border: 1px solid #444;
    color: #000;
  }
  .steps li { border-bottom: 1px solid #ccc; }
  body.print-one .routine { display: none !important; }
  body.print-one .routine.print-target {
    display: block !important;
    break-after: auto;
    page-break-after: auto;
  }
  a { color: inherit; text-decoration: none; }
  [contenteditable] { outline: none; }
  @page { size: letter; margin: 0.55in; }
}
