/* ROAS calculator article layer; relies on the site's shared reading theme tokens when present. */
:root {
  color-scheme: light dark;
  --roas-bg: #f5f7fa;
  --roas-surface: #fff;
  --roas-text: #182638;
  --roas-muted: #526176;
  --roas-border: #d7e0e9;
  --roas-accent: #176b62;
  --roas-accent-ink: #fff;
  --roas-soft: #eaf3f1;
  --roas-focus: #145fc0;
  --article-max: 74rem;
}html[data-reading-theme=dark]:not([data-theme="light"]):not([data-reading-theme="light"]){
    --roas-bg: #111821;
    --roas-surface: #19232f;
    --roas-text: #edf3f8;
    --roas-muted: #b6c2d0;
    --roas-border: #354556;
    --roas-accent: #63c5b3;
    --roas-accent-ink: #10221f;
    --roas-soft: #1c3534;
    --roas-focus: #8dc4ff;
  }
:root[data-theme="dark"], :root[data-reading-theme="dark"] {
  --roas-bg: #111821; --roas-surface: #19232f; --roas-text: #edf3f8;
  --roas-muted: #b6c2d0; --roas-border: #354556; --roas-accent: #63c5b3;
  --roas-accent-ink: #10221f; --roas-soft: #1c3534; --roas-focus: #8dc4ff;
}
:root[data-theme="light"], :root[data-reading-theme="light"] {
  color-scheme: light;
  --roas-bg: #f5f7fa; --roas-surface: #fff; --roas-text: #182638;
  --roas-muted: #526176; --roas-border: #d7e0e9; --roas-accent: #176b62;
  --roas-accent-ink: #fff; --roas-soft: #eaf3f1; --roas-focus: #145fc0;
}
:root[data-theme="dark"], :root[data-reading-theme="dark"] { color-scheme: dark; }
html { scroll-padding-top: var(--roas-anchor-offset, 1.5rem); }
body { color: var(--roas-text); }
.guide-content.editorial-body { width: min(var(--article-max), calc(100% - 3rem)); margin-inline: auto; }
.editorial-body article { min-width: 0; }
.article-header { max-width: 58rem; margin: 0 auto 1.4rem; padding: clamp(1rem, 2vw, 2rem) 0 .5rem; }
.article-header h1 { max-width: 18ch; margin: .25rem 0 .65rem; line-height: 1.06; letter-spacing: -.035em; font-size: clamp(2.1rem, 4vw, 3.65rem); }
.article-header .dek { max-width: 62ch; margin: 0 0 .7rem; color: var(--roas-muted); font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.5; }
.article-header .byline, .eyebrow { color: var(--roas-muted); }
.roas-workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(18rem, .8fr); gap: 1rem; padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid var(--roas-border); border-radius: 1.25rem; background: var(--roas-surface); box-shadow: 0 12px 36px rgb(25 43 62 / .09); }
.workspace-input, .workspace-result { min-width: 0; }
.workspace-input h2 { margin: .15rem 0 1rem; font-size: clamp(1.35rem, 2vw, 1.8rem); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.quick-grid label { display: grid; align-content: start; gap: .35rem; min-width: 0; color: var(--roas-muted); font-size: .9rem; font-weight: 650; }
.quick-grid input, .quick-grid select, #record-import { box-sizing: border-box; width: 100%; min-width: 0; min-height: 2.9rem; padding: .65rem .75rem; border: 1px solid var(--roas-border); border-radius: .65rem; background: var(--roas-bg); color: var(--roas-text); font: inherit; font-size: 1rem; }
.quick-grid [hidden] { display: none !important; }
.workspace-result { display: flex; flex-direction: column; justify-content: center; min-height: 13rem; padding: 1.1rem; border-radius: .9rem; background: var(--roas-soft); }
.result-topline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; }
.result-topline span { font-weight: 700; }
#result-value { font-size: clamp(2.2rem, 4vw, 3.35rem); line-height: 1; color: var(--roas-accent); font-variant-numeric: tabular-nums; }
#formula-line { margin: .55rem 0 .8rem; color: var(--roas-muted); font-variant-numeric: tabular-nums; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .15rem 0 .6rem; }
.status-grid div { min-width: 0; }
.status-grid dt { color: var(--roas-muted); font-size: .78rem; }
.status-grid dd { margin: .1rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.next-action { margin: .45rem 0 .65rem; line-height: 1.4; }
.workspace-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
button, .resource-grid a { -webkit-tap-highlight-color: transparent; }
.roas-workspace button, .image-dialog button { min-height: 2.7rem; padding: .62rem .85rem; border: 1px solid var(--roas-border); border-radius: .65rem; background: var(--roas-surface); color: var(--roas-text); font: inherit; font-weight: 700; cursor: pointer; }
.roas-workspace button:first-child, #load-example { border-color: var(--roas-accent); background: var(--roas-accent); color: var(--roas-accent-ink); }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--roas-focus); outline-offset: 3px; }
.workspace-advanced { grid-column: 1 / -1; border-top: 1px solid var(--roas-border); padding-top: .75rem; }
.workspace-advanced summary, .contents summary { cursor: pointer; font-weight: 750; }
.workspace-advanced p { color: var(--roas-muted); }
#record-import { display: block; min-height: 10rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.contents { margin: 1.25rem 0 2rem; padding: .75rem 1rem; border: 1px solid var(--roas-border); border-radius: .8rem; background: var(--roas-surface); }
.contents ol { columns: 2; column-gap: 2rem; margin: .8rem 0 .25rem; padding-left: 1.35rem; }
.contents li { break-inside: avoid; margin: .45rem 0; }
.editorial-body > article > p, .editorial-body > article > ul, .editorial-body > article > ol, .editorial-body > article > h2, .editorial-body > article > h3, .editorial-body > article > pre, .editorial-body > article > .table-wrap { max-width: 52rem; margin-inline: auto; }
.editorial-body article > h2 { margin-top: clamp(2.2rem, 5vw, 3.5rem); scroll-margin-top: var(--roas-anchor-offset, 1.5rem); }
.editorial-body article > h3 { margin-top: 1.75rem; scroll-margin-top: var(--roas-anchor-offset, 1.5rem); }
.editorial-body article > p, .editorial-body article > li { line-height: 1.72; }
.editorial-body pre { max-width: 100%; overflow: auto; padding: 1rem; border: 1px solid var(--roas-border); border-radius: .75rem; background: var(--roas-bg); color: var(--roas-text); }
.original-diagram { max-width: 68rem; margin: 1.2rem auto 1.6rem; }
.original-diagram button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.original-diagram img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; border: 1px solid var(--roas-border); border-radius: .85rem; background: #f4f7fb; }
figcaption { margin-top: .45rem; color: var(--roas-muted); font-size: .9rem; }
.table-wrap { width: 100%; overflow-x: auto; margin-block: 1.2rem; border: 1px solid var(--roas-border); border-radius: .75rem; }
table { width: 100%; border-collapse: collapse; background: var(--roas-surface); text-align: left; }
th, td { padding: .75rem .85rem; border-bottom: 1px solid var(--roas-border); vertical-align: top; }
th { background: var(--roas-soft); font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.video-lessons, .resource-kit { max-width: 68rem; margin: 2.75rem auto; }
.video-grid, .resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.video-grid > article, .resource-grid > a { min-width: 0; padding: 1rem; border: 1px solid var(--roas-border); border-radius: .85rem; background: var(--roas-surface); }
.video-frame { aspect-ratio: 16 / 9; overflow: hidden; border-radius: .55rem; background: #000; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.resource-grid a { display: flex; flex-direction: column; gap: .4rem; color: var(--roas-text); font-weight: 750; text-decoration-thickness: .08em; text-underline-offset: .18em; }
.resource-grid a span { color: var(--roas-muted); font-size: .9rem; font-weight: 400; line-height: 1.5; }
.image-dialog { width: min(92vw, 72rem); max-width: none; max-height: 90dvh; padding: 1rem; border: 1px solid var(--roas-border); border-radius: 1rem; background: var(--roas-surface); color: var(--roas-text); }
.image-dialog::backdrop { background: rgb(5 12 20 / .78); }
.image-dialog > button, .image-dialog > a { margin-right: .5rem; }
.image-dialog__canvas { max-height: calc(90dvh - 8rem); margin-top: .8rem; overflow: auto; text-align: center; }
.image-dialog__canvas img { display: inline-block; width: auto; max-width: 100%; height: auto; max-height: calc(90dvh - 9rem); object-fit: contain; }
@media (min-width: 761px) {
  .article-header { margin-bottom: .7rem; padding-top: .5rem; }
  .article-header .eyebrow { margin-block: .5rem; }
  .article-header h1 { margin-block: .15rem .45rem; font-size: clamp(2.1rem, 3.35vw, 3rem); }
  .article-header .dek { margin-bottom: .4rem; line-height: 1.4; }
  .article-header .byline { margin-block: .35rem; }
  .roas-workspace { gap: .75rem; padding: 1rem; }
  .workspace-input > .eyebrow { margin-block: .4rem; }
  .workspace-input h2 { margin-bottom: .7rem; }
  .quick-grid { gap: .6rem; }
  .workspace-input .workspace-actions { flex-wrap: nowrap; margin-top: .5rem; }
  .workspace-input .workspace-actions button { flex: 1 1 0; }
  .workspace-result { justify-content: flex-start; min-height: 0; padding: .85rem; }
  #result-value { font-size: 2.45rem; }
  #formula-line { margin-block: .35rem .5rem; }
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; margin-block: 0 .3rem; }
  .status-grid dd { font-size: .9rem; line-height: 1.2; }
  .next-action { margin: .3rem 0 .4rem; font-size: .92rem; line-height: 1.3; }
  .workspace-result .workspace-actions { margin-top: .3rem; }
}
@media (max-width: 760px) {
  .guide-content.editorial-body { width: min(100% - 1.25rem, 42rem); }
  .article-header { margin-bottom: .8rem; padding-top: .9rem; }
  .article-header h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .roas-workspace { grid-template-columns: minmax(0, 1fr); gap: .75rem; padding: .85rem; border-radius: .9rem; }
  .workspace-input h2 { margin-bottom: .7rem; }
  .quick-grid { gap: .55rem; }
  .workspace-result { min-height: 0; padding: .9rem; }
  .workspace-actions button { flex: 1 1 auto; }
  .workspace-advanced { grid-column: auto; }
  .contents { position: relative; z-index: 2; margin: .85rem 0 1.5rem; }
  .contents ol { columns: 1; max-height: min(55dvh, 28rem); overflow: auto; }
  .video-grid, .resource-grid { grid-template-columns: minmax(0, 1fr); }
  .video-lessons, .resource-kit { margin-block: 2rem; }
  .original-diagram { margin-inline: 0; }
  .original-diagram img { max-height: none; }
  th, td { padding: .6rem; }
}
@media (max-width: 360px) {
  .guide-content.editorial-body { width: calc(100% - .9rem); }
  .roas-workspace { padding: .65rem; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid label:nth-child(1), .quick-grid label:nth-child(2) { grid-column: 1 / -1; }
  .result-topline { align-items: baseline; flex-direction: row; }
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace-actions button { flex-basis: 0; }
  .contents { padding: .65rem .75rem; }
}
@media (max-width: 420px) {
  .article-header { margin-bottom: .3rem; padding-top: .25rem; }
  .article-header .eyebrow { margin: .15rem 0; font-size: .78rem; }
  .article-header h1 { margin: .08rem 0 .3rem; font-size: 1.72rem; line-height: 1; }
  .article-header .dek { margin-bottom: .3rem; font-size: .9rem; line-height: 1.3; }
  .article-header .byline { margin: 0; font-size: .78rem; }
  .roas-workspace { gap: .4rem; padding: .55rem; }
  .workspace-input > .eyebrow { display: none; }
  .workspace-input h2 { margin: 0 0 .35rem; font-size: 1.08rem; line-height: 1.12; }
  .quick-grid { gap: .32rem; }
  .quick-grid label:nth-child(1), .quick-grid label:nth-child(2) { grid-column: 1 / -1; }
  .quick-grid label { gap: .12rem; font-size: .75rem; }
  .quick-grid input, .quick-grid select { min-height: 2.25rem; padding: .35rem .45rem; font-size: .86rem; }
  .workspace-actions { flex-wrap: nowrap; gap: .3rem; margin-top: .38rem; }
  .roas-workspace button { min-height: 2.2rem; padding: .35rem .42rem; font-size: .75rem; line-height: 1.12; }
  .workspace-result { padding: .55rem; }
  .result-topline { gap: .2rem .45rem; }
  .result-topline span { font-size: .75rem; }
  #result-value { font-size: 1.72rem; }
  #formula-line { margin: .22rem 0 .32rem; font-size: .75rem; }
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; margin: 0 0 .25rem; }
  .status-grid dt { font-size: .68rem; line-height: 1.08; }
  .status-grid dd { font-size: .74rem; line-height: 1.08; }
  .next-action { margin: .22rem 0 .3rem; font-size: .75rem; line-height: 1.2; }
  .workspace-result .workspace-actions { margin-top: .22rem; }
  .workspace-advanced { padding-top: .4rem; font-size: .78rem; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .roas-workspace button, .resource-grid a { transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
  .resource-grid a:hover { transform: translateY(-2px); }
}
