/* Hub pages (the seven pages one click from the home menu): line diagrams, hairline figures, reading aids.
 *
 * .hd        a diagram <figure> generated by tools/pagegen/hub_diagrams.py (never hand-edit the SVG; edit the
 *            spec and rerun). Two SVGs per figure: .hd__svg--wide for tablets and up, .hd__svg--tall for phones.
 *            Strokes carry pathLength="1" so the draw-on animation is one rule; html.hd-js + .is-in gate it,
 *            so without JavaScript (or with reduced motion) everything is simply visible.
 * .hub-hl    a hairline figure host (assets/js/hairline.js + hairline-hubs.js), desktop only like the home page:
 *            the density gate on phones is at its limit and the figures are decorative (hosts carry aria-hidden).
 * .hub-lead  the 「한눈에」 box at the top of a page's first section: three or four facts quoted from the page.
 */
:root {
  --hd-ink: #0d1b3f;
  --hd-line: #475569;
  --hd-muted: #64748b;
  --hd-accent: #4f46e5;
  --hd-soft: #eef2ff;
  --hd-plate: #ffffff;
  --hd-grid: #e2e8f0;
}

/* ---- diagrams --------------------------------------------------------------------------------- */
.hd { margin: 20px 0 8px; padding: 0; max-width: 760px; }
.hd__art { position: relative; border: 1px solid var(--hd-grid); border-radius: 14px; background: var(--hd-plate); padding: 12px 10px 8px; overflow: hidden; }
.hd__svg { display: block; width: 100%; height: auto; font-family: inherit; }
.hd__svg--tall { display: none; }
@media (max-width: 767px) {
  .hd__svg--wide { display: none; }
  .hd__svg--tall { display: block; }
  .hd--one .hd__svg--wide { display: block; } /* square figures ship one SVG */
}
.hd__cap { margin: 8px 2px 0; font-size: 14px; line-height: 1.5; color: var(--hd-muted); }
.hd--dark { --hd-ink: #ffffff; --hd-line: #c7d2fe; --hd-muted: #a5b4fc; --hd-accent: #a5b4fc; --hd-soft: rgba(165, 180, 252, 0.14); --hd-plate: rgba(13, 27, 63, 0.55); --hd-grid: rgba(199, 210, 254, 0.35); }

.hd .s  { fill: none; stroke: var(--hd-line); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.hd .a  { fill: none; stroke: var(--hd-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hd .d  { fill: none; stroke: var(--hd-line); stroke-width: 1.2; stroke-dasharray: 3 4; stroke-linecap: round; }
.hd .f  { fill: var(--hd-soft); stroke: none; }
.hd .g  { fill: var(--hd-plate); stroke: var(--hd-line); stroke-width: 1.4; stroke-linejoin: round; }
.hd .ga { fill: var(--hd-soft); stroke: var(--hd-accent); stroke-width: 1.6; stroke-linejoin: round; }
.hd .t  { fill: var(--hd-ink); font-size: 14px; font-weight: 700; }
.hd .tm { fill: var(--hd-muted); font-size: 12.5px; font-weight: 500; }
.hd .tn { fill: var(--hd-accent); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.hd .tb { fill: var(--hd-ink); font-size: 15px; font-weight: 800; }
.hd .n  { fill: var(--hd-accent); }

/* draw-on: strokes have pathLength="1"; the dash runs from fully hidden to fully drawn, texts fade after */
html.hd-js .hd:not(.is-in) .s, html.hd-js .hd:not(.is-in) .a, html.hd-js .hd:not(.is-in) .d,
html.hd-js .hd:not(.is-in) .g, html.hd-js .hd:not(.is-in) .ga { stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0; }
html.hd-js .hd:not(.is-in) .t, html.hd-js .hd:not(.is-in) .tm, html.hd-js .hd:not(.is-in) .tn,
html.hd-js .hd:not(.is-in) .tb, html.hd-js .hd:not(.is-in) .n, html.hd-js .hd:not(.is-in) .f { opacity: 0; }
html.hd-js .hd.is-in .s, html.hd-js .hd.is-in .a, html.hd-js .hd.is-in .g, html.hd-js .hd.is-in .ga {
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: hd-draw 1.1s cubic-bezier(.4, 0, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
html.hd-js .hd.is-in .d { stroke-dasharray: 3 4; animation: hd-fade .6s ease both; animation-delay: calc(var(--i, 0) * 90ms + .3s); }
html.hd-js .hd.is-in .t, html.hd-js .hd.is-in .tm, html.hd-js .hd.is-in .tn, html.hd-js .hd.is-in .tb,
html.hd-js .hd.is-in .n, html.hd-js .hd.is-in .f { animation: hd-fade .6s ease both; animation-delay: calc(var(--i, 0) * 90ms + .45s); }
@keyframes hd-draw { from { stroke-dashoffset: 1; fill-opacity: 0; } 70% { fill-opacity: 0; } to { stroke-dashoffset: 0; fill-opacity: 1; } }
@keyframes hd-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html.hd-js .hd:not(.is-in) .s, html.hd-js .hd:not(.is-in) .a, html.hd-js .hd:not(.is-in) .d, html.hd-js .hd:not(.is-in) .g,
  html.hd-js .hd:not(.is-in) .ga { stroke-dasharray: none; stroke-dashoffset: 0; fill-opacity: 1; }
  html.hd-js .hd:not(.is-in) .t, html.hd-js .hd:not(.is-in) .tm, html.hd-js .hd:not(.is-in) .tn, html.hd-js .hd:not(.is-in) .tb,
  html.hd-js .hd:not(.is-in) .n, html.hd-js .hd:not(.is-in) .f { opacity: 1; }
  html.hd-js .hd.is-in * { animation: none !important; }
}

/* ---- hairline hosts (desktop only) ------------------------------------------------------------- */
.hub-hl { display: none; }
@media (min-width: 1100px) {
  .hub-hl { display: block; --hairline-plate: #f8fafc; --hairline-hi: #0d1b3f; --hairline-edge: #475569; --hairline-mid: #94a3b8; --hairline-lo: #e2e8f0; --hairline-stroke: 1; }
  .hub-hl[data-theme="dark"] { --hairline-plate: #0f1d44; --hairline-hi: #ffffff; --hairline-edge: #c7d2fe; --hairline-mid: #6366f1; --hairline-lo: #27336a; }
  /* hero: the hero section is position:relative; the copy is capped at max-w-3xl, so the right 300px are free */
  .hub-hl--hero { position: absolute; right: max(16px, calc((100% - 1152px) / 2)); top: 50%; transform: translateY(-50%); width: 280px; aspect-ratio: 5 / 4; pointer-events: none; }
  .hub-hl--hero[data-theme="dark"] { --hairline-plate: #16264f; }
  /* CTA band: a small figure above the heading */
  .hub-hl--cta { width: 220px; aspect-ratio: 5 / 4; margin: 0 auto 6px; }
  .hub-hl--cta[data-theme="dark"] { --hairline-plate: #6d6ad6; --hairline-hi: #ffffff; --hairline-edge: #ede9fe; --hairline-mid: #c4b5fd; --hairline-lo: #7c6fd0; }
}
@media (min-width: 1100px) and (max-width: 1279px) { .hub-hl--hero { width: 240px; } }

/* ---- reading aids ------------------------------------------------------------------------------ */
.hub-lead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: start; margin: 0 0 22px; padding: 14px 16px; border: 1px solid #c7d2fe; border-left: 4px solid var(--hd-accent); border-radius: 12px; background: #f8f9ff; max-width: 760px; }
.hub-lead__k { grid-column: 1; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--hd-accent); padding-top: 3px; white-space: nowrap; }
.hub-lead__list { grid-column: 2; margin: 0; padding: 0; list-style: none; }
.hub-lead__list li { position: relative; padding-left: 14px; font-size: 15px; line-height: 1.55; color: #1f2937; }
.hub-lead__list li + li { margin-top: 4px; }
.hub-lead__list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--hd-accent); }
.hub-lead__list b { color: var(--hd-ink); font-weight: 700; }
@media (max-width: 640px) { .hub-lead { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; } .hub-lead__list { grid-column: 1; } }
.hub-lead--dark { --hd-ink: #ffffff; border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); }
.hub-lead--dark .hub-lead__list li { color: #d4d4d8; }
.hub-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
