:root {
  color-scheme: light;
  font: 16px/1.55 system-ui, sans-serif;
  color: #26223a;
  background: #f8f6f2;
  --ink: #26223a;
  --accent: #563883;
  --line: #d9d2e0;
  --muted: #615a6a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); }
.masthead, footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem max(1.25rem, calc((100% - 1080px) / 2));
  border-bottom: 1px solid var(--line);
}
.masthead a {
  font: bold 1.35rem Georgia, serif;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.masthead span, footer, small { color: var(--muted); }
main { max-width: 1120px; margin: auto; padding: 2.25rem 1.25rem 3.5rem; }
.intro { max-width: 660px; margin-bottom: 2.25rem; }
.eyebrow {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 .65rem;
}
h1, h2 { font-family: Georgia, serif; line-height: 1.12; }
h1 { font-size: clamp(2.3rem, 7vw, 4.4rem); margin: 0; }
h2 { font-size: 1.75rem; margin: 0 0 1.2rem; }
h3 { margin: 0; }
.intro > p:last-child { max-width: 55ch; font-size: 1.1rem; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 1fr 1.15fr; gap: 1.25rem; align-items: start; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); padding: clamp(1.1rem, 3vw, 1.75rem); border-radius: .75rem; }
label { display: block; font-weight: 650; margin: .9rem 0 .25rem; }
input, output, select {
  display: block;
  width: 100%;
  min-height: 2.7rem;
  padding: .5rem .65rem;
  border: 1px solid #b8aebf;
  border-radius: .35rem;
  color: var(--ink);
  background: white;
  font: inherit;
}
input[type=file] { border-style: dashed; background: #f7f3fb; }
input::file-selector-button { padding: .25rem .5rem; margin-right: .5rem; cursor: pointer; }
output { background: #f8f5fa; }
small { display: block; margin-top: .4rem; }
.dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: .35rem;
  padding: .72rem 1rem;
  font: 700 1rem system-ui, sans-serif;
  margin-top: 1rem;
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid #8663b5; outline-offset: 2px; }
.preview-placeholder {
  padding: 1rem;
  border: 1px dashed var(--line);
  color: var(--muted);
}
.chart-viewport { max-height: 25rem; overflow: auto; border: 1px solid var(--line); }
.chart-viewport img, .chart-viewport canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 24.8rem; margin-inline: auto; }
.chart-viewport.zoomed img, .chart-viewport.zoomed canvas { min-width: 200%; max-width: none; max-height: none; margin-inline: 0; }
.chart-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: .65rem 0 1rem; }
.chart-actions button {
  margin: 0;
  background: white;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.chart-actions button[aria-pressed=true] { background: var(--accent); color: white; }
.source-picker { display: flex; gap: .65rem; align-items: center; }
.source-picker input { flex: 1; min-width: 0; }
.source-picker img { width: 4.5rem; height: 4.5rem; object-fit: contain; }
.buy-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
#buy { border-top: 1px solid var(--line); padding-top: 1rem; }
.error { color: #97234b; }
.error:empty { margin: 0; }
.confirmation { max-width: 700px; }
.confirmation h1 { font-size: clamp(2rem, 5vw, 3rem); }
.confirmation p { overflow-wrap: anywhere; }
footer { border-bottom: 0; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .workspace { grid-template-columns: 1fr; }
  .masthead span { font-size: .85rem; }
}

/* Public release layout and launch components. Shared identity is in style.css. */
:root {
  --surface: #fff;
  --surface-soft: #f8f5fa;
  --accent-hover: #422769;
  --error: #97234b;
}
::selection { background: #e4d9f1; color: var(--ink); }
a { text-underline-offset: .18em; }
input, textarea { caret-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input, select, textarea, output { min-height: 44px; }
button { min-height: 44px; }
button:not(:disabled):hover { background: var(--accent-hover); }
button:not(:disabled):active { background: var(--ink); }
.error { color: var(--error); }
.skip-link { position: absolute; left: 1rem; top: -8rem; z-index: 10; padding: .8rem 1rem; background: var(--surface); border: 2px solid var(--accent); }
.skip-link:focus { top: .5rem; }
.browser-studio h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); text-wrap: balance; }
.browser-studio h2 { text-wrap: balance; }
.browser-studio .workspace { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.browser-studio .workspace > .panel { padding: clamp(1.1rem, 2.5vw, 1.75rem); }
.browser-studio .preview-placeholder { min-height: 15rem; display: flex; align-items: center; padding: clamp(1.25rem, 3vw, 2rem); background: var(--surface-soft); line-height: 1.7; }
.browser-studio #generate { width: 100%; margin-top: 1.3rem; }
.browser-studio #summary, .browser-studio output { font-variant-numeric: tabular-nums; }
.browser-studio #summary:empty, .browser-studio #runtime-status:empty { margin: 0; }
.browser-studio #runtime-status:not(:empty) { padding-block: .75rem; color: var(--muted); }
.browser-studio #cancel, #feedback-open, #feedback-close { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.browser-studio #cancel:hover, #feedback-open:hover, #feedback-close:hover, .chart-actions button:hover { background: var(--surface-soft); color: var(--accent); }
.browser-studio #downloads { padding: 0; list-style: none; }
.browser-studio #downloads li + li { margin-top: .65rem; }
.browser-studio #downloads a { display: block; padding: .7rem 1rem; border: 1px solid var(--accent); border-radius: .35rem; overflow-wrap: anywhere; }
.browser-studio #downloads a:hover { background: var(--surface-soft); }
.guide { max-width: 960px; margin: 2rem auto; line-height: 1.65; }
.guide > p { max-width: 72ch; }
.guide h2:not(:first-child) { margin-top: 2rem; }
.guide ol { padding-left: 1.4rem; }
.guide li + li { margin-top: .5rem; }
.guide details { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.guide details:last-child { border-bottom: 0; }
.guide summary { cursor: pointer; font-weight: 650; min-height: 44px; padding-block: .5rem; }
.guide summary:hover { color: var(--accent); }
.guide details p { max-width: 72ch; margin: .5rem 0; }
dialog { width: min(92vw, 650px); max-height: 90vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.1rem, 4vw, 2rem); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #25213a99; }
dialog h2 { line-height: 1.2; }
textarea { display: block; width: 100%; font: inherit; padding: .65rem; border: 1px solid #b8aebf; border-radius: .35rem; resize: vertical; }
#feedback-error { color: var(--error); }
#feedback-error:empty { margin: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
footer { flex-wrap: wrap; }
@media (max-width: 700px) {
  .browser-studio .workspace { grid-template-columns: minmax(0, 1fr); }
  .browser-studio main { padding-top: 1.5rem; }
  .browser-studio .preview-placeholder { min-height: 10rem; }
  .source-picker { flex-wrap: wrap; }
  .source-picker input { flex-basis: 100%; }
}

.studio-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.studio-header #feedback-open { margin: 0; flex-shrink: 0; font-size: .9rem; }
.studio-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.studio-tabs a { display: block; padding: .75rem 0; min-height: 44px; border-bottom: 2px solid transparent; font-weight: 650; text-decoration: none; color: var(--muted); }
.studio-tabs a:hover { color: var(--accent); }
.studio-tabs a[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.browser-studio .guide { max-width: 75ch; margin: 0; padding-block: .5rem; }
.help-links { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; padding-top: 1rem; font-size: .9rem; }
@media (max-width: 450px) {
  .studio-header { align-items: flex-start; flex-direction: column; gap: .75rem; }
  .studio-tabs { gap: 1.2rem; }
}
.checkbox-label { display: flex; align-items: center; gap: .65rem; min-height: 44px; margin-top: 1.1rem; }
.checkbox-label input { width: 1.2rem; min-height: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--accent); }
#subject-tools { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
#subject-status:empty, #subject-error:empty { margin: 0; }
.subject-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .75rem; }
.subject-comparison figure { margin: 0; min-width: 0; }
.subject-comparison figcaption { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.subject-comparison img, .subject-comparison canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: .35rem; background: #eee8f3; }
#subject-canvas { cursor: crosshair; touch-action: none; }
#selection-details { margin-top: .75rem; }
#selection-details summary { cursor: pointer; min-height: 44px; padding-block: .6rem; font-weight: 650; }
#subject-tools button { background: var(--surface); border: 1px solid var(--accent); color: var(--accent); font-size: .9rem; }
#subject-tools button:hover { background: var(--surface-soft); }
.selection-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
#selection-brush { accent-color: var(--accent); padding-inline: 0; }

#subject-tools:has(#selection-details[open]) .subject-comparison { grid-template-columns: 1fr; }
#subject-tools:has(#selection-details[open]) .subject-comparison figure:first-child { display: none; }
#subject-tools:has(#selection-details[open]) #subject-canvas { max-height: 32rem; max-width: 100%; width: auto; }
.document-page { max-width: 760px; padding: 2rem 1.25rem 3rem; }
.document-page h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 1.5rem 0 2rem; }
.document-page h2 { font-size: 1.5rem; line-height: 1.25; margin: 2rem 0 .65rem; }
.document-page p { margin: .65rem 0; }
.document-page .back-link { display: inline-block; min-height: 44px; padding-block: .6rem; }
.document-page details { border-block: 1px solid var(--line); margin-top: 1.5rem; padding-block: .4rem; }
.document-page summary { min-height: 44px; padding-block: .65rem; cursor: pointer; font-weight: 650; }
.document-page li + li { margin-top: .5rem; }
.document-page a { overflow-wrap: anywhere; }

/* Reading pages share the tool's paper, typography and native link behavior. */
.reading-guide { line-height: 1.7; }
.reading-guide h1 { line-height: 1.15; text-wrap: balance; }
.reading-guide nav { margin-top: 2.5rem; border-top: 1px solid var(--line); }
.reading-guide .table-scroll { overflow-x: auto; margin-block: 1.5rem; }
.reading-guide table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.reading-guide caption { text-align: left; margin-bottom: .75rem; }
.reading-guide th, .reading-guide td { padding: .65rem; text-align: left; border-bottom: 1px solid var(--line); }

.tutorial-figure { margin: 1.5rem 0; }
.tutorial-figure img { display: block; max-width: 100%; height: auto; background: var(--surface); }
.tutorial-figure figcaption { color: var(--muted); font-size: .9rem; margin-top: .6rem; }
