/* Ideambox download web view — companion to download-web.html.
 * Renders the same content as the PDF in a web-responsive layout. */

body.download-view-page {
  background: var(--page-bg, #f3ede4);
}

/* ----------------------------------------------------------------
   Sticky action bar (back + doc-id + download buttons)
   ---------------------------------------------------------------- */

.doc-actionbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper, #fff);
  border-bottom: 1px solid var(--line, #d9cfc0);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}

.doc-actionbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.doc-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink, #1a1714);
  text-decoration: none;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.doc-back:hover {
  background: var(--cream, #f3ede4);
}

.doc-id-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.doc-id-block .mono.small {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.doc-id-block .mono.ink {
  font-size: 12px;
  font-weight: 700;
}

.doc-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-actions .button {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ----------------------------------------------------------------
   Main document
   ---------------------------------------------------------------- */

.doc-web {
  background: var(--page-bg, #f3ede4);
  padding: 32px 0 48px;
  min-height: 50vh;
}

.doc-web-content {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  background: var(--paper, #fff);
  border-radius: 12px;
  box-shadow: 0 22px 60px rgba(52, 39, 26, 0.08);
  padding: 56px clamp(24px, 5vw, 64px) 64px;
  color: var(--text, #2a2622);
  font-family: var(--font-sans, "Geist", system-ui, sans-serif);
  line-height: 1.55;
}

/* ----------------------------------------------------------------
   Header block
   ---------------------------------------------------------------- */

.doc-web-head {
  margin-bottom: 36px;
  border-bottom: 1.5px solid var(--ink, #1a1714);
  padding-bottom: 24px;
}

.doc-web-head .eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--orange, #f78f1e);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.doc-web-head .eyebrow.eyebrow-num {
  color: var(--muted, #7a6f64);
}

body.download-view-page .doc-web-title,
body.download-view-page h1.doc-web-title {
  font-family: var(--font-sans, "Geist", system-ui, sans-serif);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 52px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 16px;
  color: var(--ink, #1a1714);
}

body.download-view-page .doc-web-title em {
  font-style: normal;
  color: var(--orange, #f78f1e);
  font-weight: 600;
}

.doc-web-subtitle {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text, #2a2622);
  margin: 0 0 28px;
  max-width: 720px;
}

/* meta grid */
.doc-web-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line, #d9cfc0);
  border-bottom: 1px solid var(--line, #d9cfc0);
  margin: 0 0 24px;
}

.doc-web-meta > div {
  padding: 14px 18px 14px 0;
  border-right: 1px solid var(--line, #d9cfc0);
}

.doc-web-meta > div:last-child {
  border-right: 0;
}

.doc-web-meta > div .mono.small {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #7a6f64);
  margin-bottom: 4px;
}

.doc-web-meta > div .mono.ink {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #1a1714);
}

/* tag chips */
.doc-web-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 24px;
}

.doc-web-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--orange-soft, rgba(247, 143, 30, 0.1));
  color: var(--orange-dark, #b85c12);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.doc-web-tag::before {
  content: "#";
  margin-right: 1px;
  opacity: 0.6;
}

/* abstract */
.doc-web-abstract {
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--paper-2, #fbfaf8);
  border-left: 3px solid var(--orange, #f78f1e);
  border-radius: 0 6px 6px 0;
}

.doc-web-abstract .abstract-label {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #7a6f64);
}

.doc-web-abstract p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text, #2a2622);
  margin: 0 0 8px;
}

.doc-web-abstract p:last-child {
  margin-bottom: 0;
}

/* hero figure */
.cover-hero {
  margin: 24px 0;
  padding: 24px;
  background: var(--paper-2, #fbfaf8);
  border: 1px solid var(--line, #d9cfc0);
  border-radius: 6px;
}

.cover-hero svg {
  width: 100%;
  max-height: 280px;
  height: auto;
  display: block;
}

.cover-hero figcaption {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #d9cfc0);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted, #7a6f64);
}

/* TOC */
.doc-web-toc {
  margin: 24px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line, #d9cfc0);
}

.doc-web-toc .toc-label {
  margin: 0 0 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #7a6f64);
}

.doc-web-toc ol {
  list-style: none;
  counter-reset: toc-section;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 4px 24px;
}

.doc-web-toc li {
  counter-increment: toc-section;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line, #d9cfc0);
  font-size: 14px;
}

.doc-web-toc li::before {
  content: counter(toc-section) ".";
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted, #7a6f64);
  letter-spacing: 0.05em;
  flex: 0 0 24px;
}

.doc-web-toc li .toc-name {
  flex: 1 1 auto;
  color: var(--ink, #1a1714);
}

/* ----------------------------------------------------------------
   Content sections (override print CSS for web)
   ---------------------------------------------------------------- */

.doc-web-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text, #2a2622);
}

.doc-web-body .section {
  page-break-before: auto;
  margin: 36px 0;
  padding-top: 0;
}

body.download-view-page .doc-web-body .section h2 {
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--ink, #1a1714);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: flex;
  align-items: baseline;
  gap: 16px;
  color: var(--ink, #1a1714);
}

.doc-web-body .section h2 .section-num {
  font-family: var(--font-mono, monospace);
  font-size: 16px;
  font-weight: 500;
  color: var(--orange, #f78f1e);
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.doc-web-body .section .section-intro {
  font-size: 15px;
  color: var(--text, #2a2622);
  max-width: none;
  margin: 0 0 20px;
  line-height: 1.6;
}

body.download-view-page .doc-web-body .section h3 {
  margin: 24px 0 10px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink, #1a1714);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.doc-web-body .section h3 .sub-num {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #7a6f64);
  flex: 0 0 auto;
}

/* bullets */
.doc-web-body .section ul {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.doc-web-body .section ul li {
  position: relative;
  padding: 6px 0 6px 18px;
  border-bottom: 1px solid rgba(217, 207, 192, 0.5);
  font-size: 14px;
  line-height: 1.55;
}

.doc-web-body .section ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 6px;
  color: var(--orange, #f78f1e);
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}

.doc-web-body .section ul li strong {
  color: var(--ink, #1a1714);
}

.doc-web-body .section ul li em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  color: var(--muted, #7a6f64);
  font-size: 13px;
}

/* paragraphs */
.doc-web-body .section p {
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 14px;
  max-width: none;
}

/* tables */
.doc-web-body .section table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 13px;
  border-top: 1.5px solid var(--ink, #1a1714);
  border-bottom: 1.5px solid var(--ink, #1a1714);
}

.doc-web-body .section table thead {
  background: var(--ink, #1a1714);
}

.doc-web-body .section table th {
  text-align: left;
  font-weight: 600;
  color: var(--paper, #fff);
  padding: 8px 12px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.doc-web-body .section table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-3, #ebe3d6);
  vertical-align: top;
}

.doc-web-body .section table td:first-child {
  color: var(--ink, #1a1714);
  font-weight: 600;
}

.doc-web-body .section table tbody tr:nth-child(even) td {
  background: var(--paper-2, #fbfaf8);
}

/* figures */
.doc-web-body .section .figure {
  margin: 24px 0;
  background: var(--paper-2, #fbfaf8);
  border: 1px solid var(--line, #d9cfc0);
  padding: 20px;
  border-radius: 6px;
}

.doc-web-body .section .figure svg {
  width: 100%;
  max-height: 320px;
  height: auto;
  display: block;
}

.doc-web-body .section .figure figcaption {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #d9cfc0);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted, #7a6f64);
}

.doc-web-body .section .figure figcaption b {
  color: var(--orange-dark, #b85c12);
  margin-right: 6px;
}

/* sidebars / notes */
.doc-web-body .section .sidebar,
.doc-web-body .section .note {
  margin: 16px 0;
  padding: 14px 18px;
  background: var(--orange-soft, rgba(247, 143, 30, 0.08));
  border-left: 3px solid var(--orange, #f78f1e);
  border-radius: 0 6px 6px 0;
}

.doc-web-body .section .sidebar h4 {
  margin: 0 0 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange-dark, #b85c12);
}

.doc-web-body .section .sidebar p,
.doc-web-body .section .note {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text, #2a2622);
}

.doc-web-body .section .note b {
  display: inline;
  text-transform: uppercase;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--orange-dark, #b85c12);
  margin-right: 8px;
}

/* callout cards */
.doc-web-body .section .callout-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.doc-web-body .section .callout-card {
  padding: 14px 16px;
  border: 1px solid var(--line, #d9cfc0);
  border-top: 3px solid var(--orange, #f78f1e);
  background: var(--paper, #fff);
  border-radius: 0 0 4px 4px;
}

.doc-web-body .section .callout-card .num {
  display: block;
  font-family: var(--font-mono, monospace);
  font-size: 22px;
  font-weight: 600;
  color: var(--orange, #f78f1e);
  line-height: 1;
  margin-bottom: 6px;
}

.doc-web-body .section .callout-card .label {
  margin: 0 0 4px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #7a6f64);
}

.doc-web-body .section .callout-card p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--ink, #1a1714);
  font-weight: 500;
}

/* deflists */
.doc-web-body .section .deflist {
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: 0;
  margin: 0 0 20px;
  border-top: 1px solid var(--line, #d9cfc0);
}

.doc-web-body .section .deflist > .dt,
.doc-web-body .section .deflist > .dd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-3, #ebe3d6);
  font-size: 14px;
  line-height: 1.5;
}

.doc-web-body .section .deflist > .dt {
  color: var(--ink, #1a1714);
  font-weight: 600;
  background: var(--paper-2, #fbfaf8);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
}

/* 2-col layout */
.doc-web-body .section .cols-2 {
  column-count: 2;
  column-gap: 32px;
  column-rule: 1px solid var(--line, #d9cfc0);
  margin: 16px 0;
}

@media (max-width: 720px) {
  .doc-web-body .section .cols-2 {
    column-count: 1;
  }
}

.doc-web-body .section .cols-2 > * {
  break-inside: avoid;
}

/* code spans */
.doc-web-body .section code {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  background: var(--paper-3, #f7f2eb);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink, #1a1714);
}

/* ----------------------------------------------------------------
   Document footer
   ---------------------------------------------------------------- */

.doc-web-foot {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1.5px solid var(--ink, #1a1714);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.doc-web-foot-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------------
   Mobile
   ---------------------------------------------------------------- */

@media (max-width: 640px) {
  .doc-actionbar-inner {
    padding: 8px 0;
  }
  .doc-id-block { display: none; }
  .doc-actions .button { font-size: 11px; padding: 6px 10px; }
  .doc-web-content {
    width: calc(100% - 16px);
    border-radius: 8px;
    padding: 32px 20px 40px;
  }
  .doc-web-title { font-size: 28px; }
  .doc-web-meta { grid-template-columns: 1fr 1fr; }
}
