/* Shared warm-paper surfaces. Load after the existing page styles.
   Homepage composition, proof stages and upload/dropzone geometry stay local. */
:root {
  --surface-rule: rgba(23, 19, 15, .11);
  --surface-rule-strong: rgba(23, 19, 15, .24);
  --surface-inset: #f0eadd;
  --surface-quiet: #6c6257;
  --surface-input-line: #978675;
  --code-paper: #efe9dd;
  --code-ink: #3b332a;
}

body {
  background: var(--paper);
  caret-color: var(--signal-strong);
  scrollbar-color: #b9ae9d var(--paper);
}
body::before { content: none; }
/* A document field carries the converter's visual language beyond its hero. */
main { position: relative; isolation: isolate; }
main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 65% 480px at 90% 26%, #c7d2b32b, transparent), radial-gradient(ellipse 55% 500px at 8% 72%, #e6b88e20, transparent);
}
body[data-home-page] #capability-directory,
body[data-home-page] #access-methods,
body[data-converter-page] .content-section,
body.source-page .faq-section {
  position: relative;
  isolation: isolate;
}
body[data-home-page] #capability-directory::before,
body[data-home-page] #access-methods::before,
body[data-converter-page] main::after,
body[data-docs-page] main::after,
body[data-pricing-page] main::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  width: min(960px,100%);
  height: 600px;
  right: 0;
  top: -130px;
  background: url('/document-field.svg') right top / contain no-repeat;
}
body[data-home-page] #access-methods::before { top: -90px; opacity: .6; }
body[data-converter-page] main::after { top: 600px; }
body[data-docs-page] main::after,
body[data-pricing-page] main::after { top: 120px; }
:is(h1,h2,h3) { text-wrap: balance; }
@supports (animation-timeline: view()) {
  @media(prefers-reduced-motion:no-preference) {
    body[data-home-page] #capability-directory::before {
      animation: document-field-pass linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
  }
}
@keyframes document-field-pass { from { transform: translateY(32px); opacity: .5; } to { transform: translateY(-24px); opacity: 1; } }
@media(max-width:760px) {
  body[data-home-page] #capability-directory::before,
  body[data-home-page] #access-methods::before,
  body[data-converter-page] main::after { top: -30px; opacity: .7; height: 420px; }
  body[data-converter-page] main::after { top: 500px; }
}
::selection { background: #eed3be; color: var(--ink); }
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--signal-strong);
  outline-offset: 4px;
}

/* Shared navigation retains its existing desktop and mobile arrangement. */
body .site-header {
  min-height: 72px;
  border-bottom-color: transparent;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: none;
}
.site-header .nav-links {
  border-color: var(--surface-rule);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: none;
  font-size: .9rem;
}
.site-header :is(.account-link, .task-inbox-trigger, .site-menu-toggle) {
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}
.site-header .account-link.is-authenticated { background: #f0eadd; }
.site-header .header-account-popover {
  border-color: var(--surface-rule);
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(45, 32, 20, .1);
}
.site-header :is(.nav-links a, .account-link, .task-inbox-trigger, .site-menu-toggle) {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.site-header :is(.account-link, .task-inbox-trigger, .site-menu-toggle):hover,
.header-account-popover :is(a, button):hover {
  border-color: var(--surface-rule-strong);
  background: var(--surface-inset);
  color: var(--ink);
}
.site-header .nav-links a[aria-current="page"] {
  background: var(--ink);
  color: var(--surface);
}
body:not([data-home-page]) .site-footer {
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}

/* Converter and provider explanations use the same open reading surface. */
body[data-converter-page] .hero-shell {
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .hero-copy h1 {
  letter-spacing: -.025em;
  text-wrap: balance;
}
body.source-page[data-converter-page] .hero-copy h1 {
  font-size: clamp(2.5rem, 4.7vw, 4.1rem);
  line-height: 1.03;
}
body[data-converter-page] :is(.hero-lede, .source-boundary) {
  color: var(--surface-quiet);
  line-height: 1.65;
}
body[data-converter-page] .upload-panel {
  border-color: var(--surface-rule);
  background: var(--surface);
  box-shadow: none;
}
body[data-converter-page] .section-band {
  width: min(1120px, calc(100% - 64px));
  padding-block: clamp(40px, 5vw, 64px);
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .section-heading {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 24px 56px;
  align-items: start;
}
body[data-converter-page] .section-heading h2 {
  margin-top: 0;
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  text-wrap: balance;
}
body[data-converter-page] .section-heading > p {
  max-width: 66ch;
  margin-top: 0;
  color: var(--surface-quiet);
  font-size: .97rem;
  line-height: 1.75;
}
body[data-converter-page] :is(.flow-steps, .developer-lanes) > article {
  border: 0;
  border-top: 1px solid var(--surface-rule);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .developer-lanes > article { padding: 24px 0; }
body[data-converter-page] .converter-tool-discovery {
  border-color: var(--surface-rule);
  background: transparent;
}
body[data-converter-page] .converter-tool-discovery a {
  border-color: var(--surface-rule);
  color: var(--surface-quiet);
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 600;
}
body[data-converter-page] .converter-tool-discovery a:hover,
body[data-converter-page] .converter-tool-discovery a[aria-current="page"] {
  background: var(--surface-inset);
  color: var(--ink);
}
body[data-converter-page] .faq-section details {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--surface-rule);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .faq-section summary {
  min-height: 44px;
  padding-block: 20px;
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.5;
}
body[data-converter-page] .faq-section details p {
  max-width: 72ch;
  margin: 0 0 22px;
  color: var(--surface-quiet);
  font-size: .94rem;
  line-height: 1.7;
}
body[data-converter-page] .url-estimate {
  border-color: var(--surface-rule);
  background: transparent;
}
body[data-converter-page] .primary-action { box-shadow: none; }

/* Account overview and settings: large paper surfaces, quiet inset groups. */
.app-page :is(.account-overview, .app-card) {
  border-color: var(--surface-rule);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}
.app-page .account-overview { padding: clamp(24px, 4vw, 40px); }
.app-page .account-section-nav {
  border-color: var(--surface-rule);
  background: var(--paper);
  box-shadow: none;
}
.app-page .account-section-nav a { min-height: 44px; }
.app-page .account-section-nav a:hover { background: var(--surface-inset); color: var(--ink); }
.app-page .account-section-nav a.active { background: var(--ink); color: var(--surface); }
.app-page :is(.account-primary-metrics article, .account-access-details, .account-setting-panel,
  .connected-methods, .account-strip > span, .overview-grid > span, .compact-form) {
  border-color: var(--surface-rule);
  background: var(--paper);
  box-shadow: none;
}
.app-page .account-primary-metrics .credit-balance-card {
  border-color: transparent;
  background: #e8ebe0;
  color: var(--ink);
}
.app-page .account-primary-metrics .credit-balance-card :is(span, small) { color: #56614e; }
.app-page .account-primary-metrics strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.app-page .account-avatar { border: 0; background: var(--green); box-shadow: none; }
.app-page :is(.app-card h2, .account-setting-panel h2) { font-weight: 600; line-height: 1.2; }
.app-page :is(.app-card p, .account-setting-panel p, .empty-state) { color: var(--surface-quiet); line-height: 1.6; }
.app-page .table-row { border-color: var(--surface-rule); }
.app-page .table-row:not(.table-head):hover { background: color-mix(in srgb, var(--paper) 64%, transparent); }

/* Authentication and native dialogs keep their existing focus and scroll model. */
.auth-card {
  padding: clamp(24px, 4vw, 36px);
  border-color: var(--surface-rule);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(45, 32, 20, .08);
}
.auth-card-title h2,
.auth-gate-title h2 { font-weight: 600; letter-spacing: -.025em; line-height: 1.08; }
.auth-card-title p:last-child { color: var(--surface-quiet); line-height: 1.6; }
.auth-gate-card { padding-top: 48px; }
:is(.auth-gate-dialog, .surface-dialog)::backdrop {
  background: rgba(40, 32, 25, .38);
  backdrop-filter: blur(4px);
}
:is(.auth-tabs, .auth-intent, .auth-alert, .verification-mark) {
  border-color: var(--surface-rule);
  background: var(--paper);
}
.auth-tabs button.active { background: var(--surface); box-shadow: none; }
.auth-alert.is-error { border-color: #d6a28b; background: #faeade; }
.auth-card .auth-form { padding: 0; border: 0; background: transparent; }
.social-button { border-color: var(--surface-rule-strong); background: var(--surface); box-shadow: none; font-weight: 600; }
.social-button:not(:disabled):hover { border-color: var(--ink); background: var(--paper); box-shadow: none; transform: none; }
:is(.auth-gate-close, .surface-dialog-close, .feedback-close) {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--surface-rule);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}
:is(.auth-gate-close, .surface-dialog-close, .feedback-close):hover { background: var(--surface-inset); border-color: var(--surface-rule-strong); }
:is(.task-inbox-shell, .result-sheet-shell) { border-color: var(--surface-rule); background: var(--surface); box-shadow: -12px 0 44px rgba(45, 32, 20, .1); }
:is(.surface-dialog-header, .review-workbench-header) h2 { font-size: clamp(1.8rem, 2.7vw, 2.35rem); font-weight: 600; line-height: 1.12; }
.task-inbox-item { border-color: var(--surface-rule); border-radius: 9px; background: var(--paper); }
.task-inbox-empty { border: 0; background: var(--paper); }
.task-inbox-copy strong { font-weight: 600; }
.task-inbox-copy span { color: var(--surface-quiet); }
.review-workbench-dialog { border-color: var(--surface-rule); border-radius: 12px; }
.review-workbench-shell { background: var(--paper); }
.review-workbench-header { border-color: var(--surface-rule); }
.review-workbench-dialog .review-pane { border-color: var(--surface-rule); border-radius: 8px; background: var(--surface); }
.review-pane > header { border-color: var(--surface-rule); background: var(--paper); font-size: .88rem; }
.review-warning-nav { border-color: var(--surface-rule); background: var(--surface); }
.review-pane-tabs button { min-height: 44px; }
.review-pane-tabs button[aria-pressed="true"] { border-bottom-color: var(--signal-strong); background: var(--surface-inset); }
.result-panel { border-color: var(--surface-rule); border-radius: 12px; background: var(--surface); box-shadow: none; }
.result-panel h2 { font-weight: 600; line-height: 1.12; letter-spacing: -.015em; }
:is(.result-panel, .result-sheet-shell) .preview,
.review-workbench-dialog .review-markdown-pane pre { border-color: var(--surface-rule); background: var(--code-paper); color: var(--code-ink); font-size: .83rem; line-height: 1.7; }
.result-review-warning { border-color: #dec2a4; background: #f6ecdc; color: #6c4f28; }

/* Inputs and actions retain useful boundaries; dark primary labels stay white. */
:is(.app-page, .auth-card) :is(input, select, textarea),
#feedback-form :is(input, textarea) {
  border-color: var(--surface-input-line);
  background: var(--surface);
  color: var(--ink);
}
:is(.app-page, .auth-card) :is(input, select, textarea):focus,
#feedback-form :is(input, textarea):focus {
  border-color: var(--signal-strong);
  outline: 2px solid var(--signal-strong);
  outline-offset: 2px;
  box-shadow: none;
}
:is(.app-page, .auth-card) :is(input, textarea)::placeholder,
#feedback-form :is(input, textarea)::placeholder { color: #7d7063; opacity: 1; }
:is(.app-page, .auth-card) button,
.result-actions :is(a, button), .review-primary-download, .feedback-submit {
  min-height: 44px;
  font-weight: 600;
  box-shadow: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.result-actions :is(a, button) { font-weight: 600; }
:is(.app-page, .auth-card) .ghost-action,
.result-actions .secondary { border-color: var(--surface-rule-strong); background: var(--surface); color: var(--ink); }
:is(.app-page, .auth-card) .text-action { background: transparent; color: var(--surface-quiet); }
:is(.app-page, .auth-card) :is(.ghost-action, .text-action):not(:disabled):hover,
.result-actions .secondary:hover { background: var(--surface-inset); color: var(--ink); }
:is(.task-inbox-actions, .result-actions) button:not(.secondary):not(:disabled):hover,
.review-primary-download:not(:disabled):hover { background: var(--ink-soft); color: var(--surface); }

.feedback-toggle { min-height: 44px; border-color: var(--surface-rule); background: var(--surface); box-shadow: 0 4px 16px rgba(45, 32, 20, .06); }
.feedback-panel { border-color: var(--surface-rule); border-radius: 12px; background: var(--surface); box-shadow: 0 16px 44px rgba(45, 32, 20, .13); }
.feedback-panel h2 { font-weight: 600; line-height: 1.12; }
.feedback-submit { background: var(--signal-strong); color: var(--surface); font-weight: 600; }
.feedback-submit:not(:disabled):hover { background: #a93716; }

/* Shared light code palette, excluding the separately maintained homepage proof. */
body:not([data-home-page]) .code-frame,
.surface-dialog .code-frame { border-color: var(--surface-rule); border-radius: 10px; background: var(--code-paper); box-shadow: none; }
body:not([data-home-page]) .code-toolbar,
.surface-dialog .code-toolbar { border-color: var(--surface-rule); background: var(--code-paper); }
body:not([data-home-page]) .code-frame pre.copyable-code,
.surface-dialog .code-frame pre.copyable-code { background: var(--code-paper); color: var(--code-ink); font-size: .82rem; line-height: 1.75; }
:is(.docs-page, .app-page .developer-setup) .connection-panel-setup .code-frame code,
body:not([data-home-page]) .code-frame code { color: var(--code-ink); }
body:not([data-home-page]) .code-frame .copy-button,
.surface-dialog .code-frame .copy-button { min-height: 36px; border-color: var(--surface-rule-strong); background: var(--surface); color: var(--code-ink); font-weight: 600; box-shadow: none; }
body:not([data-home-page]) .code-frame .copy-button:hover,
.surface-dialog .code-frame .copy-button:hover { background: #e6decf; }
.code-scroll:focus-visible { outline-offset: -3px; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.comment, .syntax-comment) { color: #6f6559; font-style: italic; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.keyword, .syntax-keyword) { color: #954821; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.string, .syntax-string) { color: #39604a; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.number, .syntax-number, .token.boolean, .syntax-boolean) { color: #855627; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.function, .syntax-function) { color: #6f4e77; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.property, .syntax-property, .token.attr-name, .syntax-key) { color: #345e62; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame, .review-markdown-pane) :is(.token.operator, .token.punctuation, .syntax-operator, .syntax-punctuation) { color: #726151; }

/* Legal pages read as a document, without a separate card for every paragraph. */
.legal-page { max-width: 1000px; }
.legal-page .page-hero { max-width: 760px; margin-inline: auto; }
.legal-page .page-hero h1 { font-size: clamp(2.6rem, 5vw, 4.25rem); line-height: 1.04; letter-spacing: -.025em; }
.legal-page .doc-stack { max-width: 760px; margin-inline: auto; gap: 0; }
.legal-page .doc-section { padding: 30px 0; border: 0; border-top: 1px solid var(--surface-rule); border-radius: 0; background: transparent; }
.legal-page .doc-section h2 { margin: 0 0 14px; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.legal-page .doc-section :is(p, li) { color: var(--surface-quiet); font-size: 1rem; line-height: 1.8; }
.legal-page .doc-section p:last-child { margin-bottom: 0; }
.legal-page .doc-section a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--surface-rule-strong); text-underline-offset: 3px; }
.legal-page .doc-section a:hover { color: var(--signal-strong); text-decoration-color: currentColor; }

@media (max-width: 760px) {
  body .site-header { min-height: 64px; }
  body[data-converter-page] .section-band { width: calc(100% - 36px); padding-block: 36px; }
  body[data-converter-page] .section-heading { grid-template-columns: 1fr; gap: 12px; }
  body[data-converter-page] .section-heading h2 { max-width: 26ch; margin-bottom: 0; }
  body[data-converter-page] .section-heading > p { font-size: .94rem; }
  .app-page .account-overview { padding: 22px 18px; }
  .app-page :is(.account-overview-head, .account-head-actions) { flex-wrap: wrap; }
  .app-page :is(.account-settings-grid, .account-setting-panel, .account-primary-metrics) { grid-template-columns: minmax(0, 1fr); }
  .app-page .account-access-details summary { gap: 12px; flex-wrap: wrap; }
  .app-page .account-section-nav { width: 100%; }
  .app-page .account-section-nav a { padding-inline: 12px; font-size: .82rem; }
  .auth-card { padding: 28px 22px; }
  .auth-gate-card { padding-top: 50px; }
  :is(.app-page, .auth-card) :is(input, select, textarea),
  #feedback-form :is(input, textarea) { font-size: 16px; }
  .feedback-panel { padding: 22px 18px; max-height: calc(100dvh - 96px); }
  .task-inbox-item { grid-template-columns: auto minmax(0, 1fr); }
  .task-inbox-actions { grid-column: 2; flex-wrap: wrap; }
  .legal-page .doc-section { padding-block: 26px; }
  .legal-page .doc-section h2 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  :is(.surface-dialog, .auth-gate-dialog)[open], .surface-dialog::backdrop { animation: none; }
  :is(.site-header, .app-page, .auth-card, .feedback-panel, .result-panel) :is(a, button, input, textarea) { transition: none; }
}
