/* Zoe Swellmark Poetic Resonance Studio -- Zero-CDN Static Stylesheet
 * Dark Nocturnal (default) & Light Daylight Vellum WCAG AA/AAA Themes
 * Enforces Zoe's 10 Design Laws & >= 44px interactive hit targets.
 */

html[data-theme="dark"],
body.pr-body[data-theme="nocturnal"] {
  color-scheme: dark;
  --bg-canvas: #080b12;
  --bg-surface: #0f1624;
  --bg-elevated: #162033;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --btn-primary-bg: #0369a1;
  --btn-primary-fg: #ffffff;
  --btn-primary-hover: #075985;
  --btn-emerald-bg: #065f46;
  --btn-emerald-fg: #ecfdf5;
  --btn-emerald-hover: #047857;
  --accent-blue: #38bdf8;
  --accent-amber: #fbbf24;
  --accent-purple: #c084fc;
  --accent-emerald: #6ee7b7;
  --border-default: #64748b;
  --chip-normal-bg: #1e293b;
  --chip-normal-fg: #f1f5f9;
  --chip-sweet-bg: #0c2d48;
  --chip-sweet-fg: #e0f2fe;
  --chip-novel-bg: #2e1065;
  --chip-novel-fg: #f3e8ff;
  --chip-chill-bg: #451a03;
  --chip-chill-fg: #fef3c7;
  --focus-ring: #38bdf8;
}

html[data-theme="light"],
body.pr-body[data-theme="vellum"] {
  color-scheme: light;
  --bg-canvas: #f7f3ea;
  --bg-surface: #fffdf8;
  --bg-elevated: #efe9dc;
  --text-primary: #1c1917;
  --text-secondary: #374151;
  --text-muted: #57534e;
  --btn-primary-bg: #075985;
  --btn-primary-fg: #ffffff;
  --btn-primary-hover: #0c4a6e;
  --btn-emerald-bg: #065f46;
  --btn-emerald-fg: #ffffff;
  --btn-emerald-hover: #047857;
  --accent-blue: #0369a1;
  --accent-amber: #92400e;
  --accent-purple: #6b21a8;
  --accent-emerald: #065f46;
  --border-default: #78716c;
  --chip-normal-bg: #e7e0d2;
  --chip-normal-fg: #1c1917;
  --chip-sweet-bg: #e0f2fe;
  --chip-sweet-fg: #0c4a6e;
  --chip-novel-bg: #f3e8ff;
  --chip-novel-fg: #4c1d95;
  --chip-chill-bg: #fef3c7;
  --chip-chill-fg: #78350f;
  --focus-ring: #075985;
}

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

.pr-shell [hidden] {
  display: none !important;
}

body.pr-body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: clip;
}

body.pr-body:not(.ns-split-ready) {
  padding: 0;
}

body.pr-body.ns-split-ready {
  padding-top: 56px;
}

.pr-shell .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;
}

.studio-shell.pr-shell {
  max-width: 1320px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pr-shell .pr_topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  min-width: 0;
  max-width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
}

.pr-shell .brand-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.pr-shell h1.brand-title {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
}

.pr-shell p.brand-sub {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.pr-shell .editorial-note,
.pr-shell .prose-body {
  max-width: 65ch;
  line-height: 1.6;
}

.pr-shell .grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}

.pr-shell .grid-main > * {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 1024px) {
  .pr-shell .grid-main {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
  }

  .pr-shell .zs-licensing-band,
  .pr-shell .constitutional-card {
    grid-column: 1 / -1;
  }
}

/* Commercial IP Lock Banner */
.pr-shell .zs-licensing-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.pr-shell .zs-licensing-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.pr-shell .zs-licensing-copy p {
  margin: 0;
  color: var(--text-primary);
}

.pr-shell .zs-licensing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pr-shell .zs-licensing-actions .zs-btn {
  min-height: 44px;
}

.pr-shell .col-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}

.pr-shell .card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.pr-shell .section-bar {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-default);
}

.pr-shell h2.section-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 650;
  color: var(--text-primary);
}

.pr-shell .section-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pr-shell .row-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.pr-shell .control-bar {
  gap: 10px;
}

.pr-shell .meta-row {
  gap: 10px;
}

.pr-shell .poem-title {
  font-size: 1rem;
  color: var(--text-primary);
}

.pr-shell .muted-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.pr-shell .label-caps {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.pr-shell .active-word {
  font-size: 1.125rem;
  color: var(--text-primary);
}

/* Interactive Controls -- Strictly >= 44px x 44px */
.pr-shell .btn,
.pr-shell .select-ctrl,
.pr-shell .word-chip {
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-default);
}

.pr-shell .btn {
  padding: 10px 16px;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.pr-shell .btn:hover {
  border-color: var(--accent-blue);
}

.pr-shell .btn-accent {
  background-color: var(--btn-primary-bg);
  border-color: var(--accent-blue);
  color: var(--btn-primary-fg);
}

.pr-shell .btn-accent:hover {
  background-color: var(--btn-primary-hover);
}

.pr-shell .btn-emerald {
  background-color: var(--btn-emerald-bg);
  border-color: var(--accent-emerald);
  color: var(--btn-emerald-fg);
}

.pr-shell .btn-emerald:hover {
  background-color: var(--btn-emerald-hover);
}

.pr-shell .select-ctrl {
  padding: 8px 14px;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
}

.pr-shell .text-ctrl {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-family: Charter, Cambria, Georgia, serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

.pr-shell .text-ctrl::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.pr-shell .btn:focus-visible,
.pr-shell .select-ctrl:focus-visible,
.pr-shell .text-ctrl:focus-visible,
.pr-shell .word-chip:focus-visible,
.pr-shell input[type="range"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.pr-shell .pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
}

.pr-shell .pill-emerald {
  color: var(--accent-emerald);
}

.pr-shell .pill-amber {
  color: var(--accent-amber);
}

.pr-shell .pill-chill {
  background-color: var(--chip-chill-bg);
  color: var(--chip-chill-fg);
  border-color: var(--accent-amber);
}

/* Word-Chip Stage */
.pr-shell .verse-stage {
  max-width: 65ch;
  font-family: Charter, Cambria, Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

.pr-shell .verse-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pr-shell .word-chip {
  padding: 8px 14px;
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.4;
}

.pr-shell .word-chip.read-normal {
  background-color: var(--chip-normal-bg);
  color: var(--chip-normal-fg);
}

.pr-shell .word-chip.read-sweet {
  background-color: var(--chip-sweet-bg);
  color: var(--chip-sweet-fg);
  border-color: var(--accent-blue);
}

.pr-shell .word-chip.read-novel {
  background-color: var(--chip-novel-bg);
  color: var(--chip-novel-fg);
  border-color: var(--accent-purple);
  text-decoration: underline dotted var(--accent-purple);
  text-underline-offset: 4px;
}

.pr-shell .word-chip.read-chill {
  background-color: var(--chip-chill-bg);
  color: var(--chip-chill-fg);
  border-color: var(--accent-amber);
}

.pr-shell .word-chip.is-active {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
  color: var(--text-primary);
}

.pr-shell .telemetry-panel {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-shell .kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .pr-shell .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .pr-shell .kpi-grid-three {
    grid-template-columns: repeat(3, 1fr);
  }
}

.pr-shell .kpi-cell {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  min-width: 0;
}

.pr-shell .kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pr-shell .kpi-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 4px;
}

.pr-shell .val-blue {
  color: var(--accent-blue);
}

.pr-shell .val-emerald {
  color: var(--accent-emerald);
}

.pr-shell .val-amber {
  color: var(--accent-amber);
}

.pr-shell .val-purple {
  color: var(--accent-purple);
}

/* SVG Staircase */
.pr-shell .staircase-svg {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  display: block;
}

.pr-shell .svg-axis {
  stroke: var(--border-default);
  stroke-width: 1.2;
}

.pr-shell .svg-cap-line {
  stroke: var(--accent-emerald);
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
}

.pr-shell .svg-label {
  fill: var(--text-secondary);
  font-size: 9.5px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.pr-shell .svg-stair-sm {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
}

.pr-shell .svg-stair-area {
  fill: var(--accent-blue);
  fill-opacity: 0.18;
  stroke: none;
}

.pr-shell .svg-stair-star {
  fill: none;
  stroke: var(--accent-blue);
  stroke-width: 2.2;
}

.pr-shell .svg-bar-softmax {
  fill: var(--text-muted);
  fill-opacity: 0.55;
}

.pr-shell .svg-bar-star {
  fill: var(--accent-blue);
}

.pr-shell .svg-bar-star-sub {
  fill: var(--border-default);
}

/* Sliders (>= 44px height) */
.pr-shell .slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.pr-shell .slider-cell {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  min-width: 0;
}

.pr-shell .mono-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-primary);
}

.pr-shell input[type="range"] {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent-blue);
  background: transparent;
}

/* Canvases */
.pr-shell .wave-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 84px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
}

.pr-shell .chart-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 210px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
}

.pr-shell .full-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pr-shell .custom-poem-wrap {
  width: 100%;
  max-width: 65ch;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-shell .constitutional-card {
  gap: 10px;
}

.pr-shell p.footer-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.pr-shell p.mono-note {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-word;
}

@media (max-width: 520px) {
  .studio-shell.pr-shell {
    padding: 14px 12px 28px;
  }

  .pr-shell .card,
  .pr-shell .pr_topbar,
  .pr-shell .zs-licensing-band {
    padding: 16px;
  }
}
