/* ==========================================================================
   Module workbook pages
   ========================================================================== */

.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--rust); z-index: 120; transition: width .1s linear; }

/* ---------- Module hero ---------- */
.mod-hero { padding: clamp(32px, 5vw, 64px) 0 clamp(36px, 5vw, 56px); border-bottom: 1px solid var(--line); }
.mod-hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 56px); align-items: center; }
@media (max-width: 900px) { .mod-hero-grid { grid-template-columns: 1fr; } }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal); text-decoration: underline; }
.mod-hero .h1 { margin: 14px 0 16px; }
.mod-hero .lede { margin-bottom: 22px; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.mod-chips span { font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.mod-includes { font-size: 15px; color: var(--muted); margin-bottom: 26px; }
.mod-hero-figure { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.mod-hero-figure img { border-radius: 10px; width: 100%; }

/* ---------- Layout ---------- */
.mod-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); padding-top: 48px; padding-bottom: 72px; align-items: start; }
@media (max-width: 1060px) { .mod-layout { grid-template-columns: minmax(0, 1fr); padding-top: 24px; } }

.mod-aside { position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; padding-right: 6px; scrollbar-width: thin; }
@media (max-width: 1060px) { .mod-aside { position: static; max-height: none; overflow: visible; padding: 0; } }
.toc-box { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.toc-box summary { list-style: none; cursor: pointer; padding: 14px 16px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.toc-box summary::-webkit-details-marker { display: none; }
.toc-box summary::after { content: '+'; font-size: 18px; color: var(--muted); }
.toc-box[open] summary::after { content: '–'; }
.toc-box ol { list-style: none; padding: 0 8px 10px; margin: 0; counter-reset: toc; }
.toc-box li { margin: 0; }
.toc-box a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--ink-2); text-decoration: none; border-left: 2px solid transparent; }
.toc-box a:hover { background: var(--surface-2); color: var(--ink); }
.toc-box a.active { color: var(--teal); background: var(--teal-50); font-weight: 600; border-left-color: var(--teal); border-radius: 0 8px 8px 0; }
.aside-cta { margin-top: 16px; padding: 18px; border-radius: 14px; background: var(--night); color: rgba(255,255,255,.8); font-size: 14px; }
.aside-cta strong { display: block; color: #fff; font-family: var(--font-display); font-stretch: 106%; font-size: 17px; margin-bottom: 6px; }
.aside-cta .btn { margin-top: 12px; width: 100%; }
@media (max-width: 1060px) { .aside-cta { display: none; } }

/* ---------- Article typography ---------- */
.mod-article { max-width: 760px; font-size: 17.5px; line-height: 1.7; color: var(--ink-2); }
.mod-article > *:first-child { margin-top: 0 !important; }
.mod-article h2 {
  font-family: var(--font-display); font-stretch: 106%; font-weight: 800; letter-spacing: -0.02em; color: var(--ink);
  font-size: clamp(26px, 3vw, 34px); line-height: 1.15; margin: 64px 0 18px; padding-top: 28px; border-top: 1px solid var(--line);
}
.mod-article h3 { font-family: var(--font-display); font-stretch: 104%; font-weight: 700; color: var(--ink); font-size: 22px; line-height: 1.25; margin: 38px 0 12px; letter-spacing: -0.01em; }
.mod-article h4 { font-weight: 700; color: var(--ink); font-size: 17.5px; margin: 28px 0 8px; }
.mod-article p { margin: 0 0 16px; }
.mod-article strong { color: var(--ink); }
.mod-article a { color: var(--teal); text-underline-offset: 3px; }
.mod-article ul, .mod-article ol { margin: 0 0 20px 1.3em; }
.mod-article li { margin-bottom: 8px; padding-left: 4px; }
.mod-article li::marker { color: var(--teal); font-weight: 700; }
.mod-article ul ul, .mod-article ol ol { margin-top: 8px; }

.mod-article .callout {
  background: var(--teal-50); border-left: 4px solid var(--teal); border-radius: 0 10px 10px 0; padding: 16px 20px; margin: 20px 0; font-size: 16px; color: var(--ink-2);
}
.mod-article .practice {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px 8px; margin: 30px 0; box-shadow: var(--shadow-sm); position: relative;
}
.mod-article .practice-label {
  display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  background: var(--amber); color: var(--night); padding: 5px 10px; border-radius: 6px; margin-bottom: 14px;
}
.mod-article .practice .callout { background: var(--surface-2); border-left-color: var(--amber); }
.mod-article details { margin: 8px 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.mod-article details summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--teal); font-size: 15px; }
.mod-article details[open] summary { border-bottom: 1px solid var(--line); }
.mod-article details > *:not(summary) { padding: 0 16px; }
.mod-article details > p:first-of-type { padding-top: 12px; }

.mod-article .figure { margin: 30px 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.mod-article .figure img { width: 100%; border-radius: 6px; cursor: zoom-in; }
.mod-article .figure figcaption { font-size: 14px; color: var(--muted); padding: 12px 4px 2px; line-height: 1.5; }

.mod-article .mod-table-wrap { overflow-x: auto; margin: 22px 0 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); -webkit-overflow-scrolling: touch; }
.mod-article .mod-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; min-width: 520px; }
.mod-article .mod-table th, .mod-article .mod-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.mod-article .mod-table tr:first-child th, .mod-article .mod-table tr:first-child td { background: var(--surface-3); color: var(--ink); font-size: 13px; }
.mod-article .mod-table tr:last-child td { border-bottom: 0; }
.mod-article .mod-table td strong, .mod-article .mod-table th strong { color: var(--ink); }

.mod-article .qa { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; margin: 22px 0 6px; }
.mod-article .qa-num { width: 30px; height: 30px; border-radius: 8px; background: var(--teal); color: #fff; font-family: var(--font-mono); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.mod-article .qa p { margin: 3px 0 0; }
.mod-article .qa + p { margin-left: 42px; font-size: 15.5px; color: var(--muted); white-space: pre-wrap; }
.mod-article .blank-line { font-family: var(--font-mono); font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- End of module ---------- */
.mod-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
@media (max-width: 620px) { .mod-next { grid-template-columns: 1fr; } }
.mod-next a { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.mod-next a:hover { border-color: var(--teal); box-shadow: var(--shadow-sm); }
.mod-next small { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.mod-next b { font-family: var(--font-display); font-stretch: 106%; font-size: 19px; }
.mod-next .next { text-align: right; }

.mod-cta { margin-top: 28px; padding: clamp(24px, 4vw, 36px); border-radius: 18px; background: linear-gradient(135deg, var(--teal-700), var(--night)); color: rgba(255,255,255,.82); }
.mod-cta h2 { font-family: var(--font-display); font-stretch: 106%; font-weight: 800; color: #fff; font-size: clamp(24px, 3vw, 30px); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 10px; }
.mod-cta p { margin-bottom: 20px; }
.mod-disclaimer { margin-top: 28px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.mod-disclaimer p { margin-bottom: 6px; }

/* ---------- Image lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(12, 26, 33, .88); display: none; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1600px, 100%); max-height: 100%; background: #fff; border-radius: 10px; padding: 10px; }

@media print {
  .site-header, .mod-aside, .mod-cta, .mod-next, .site-footer, .read-progress, .sticky-cta { display: none !important; }
  .mod-layout { display: block; }
  .mod-article { max-width: none; }
}
