/* Theme layer loaded last: readability floor, phone navigation and small fixes on top of the converted palette. */

/* Broad defaults: inside the base layer so the original, more specific rules still win where they set a value. */
@layer base{
summary{padding-top:9px;padding-bottom:9px}
main :where(p,li,dd){max-width:720px}
main :where(.care-controls,.visit-table,table,nav,.learn-root) :where(p,li,dd){max-width:none}
}

/* No supporting text below 14px. Numbers inside round markers keep their own size. */
small,.eyebrow,.edition,.footer,.footer a,.footer span,.pill,.care-small,
.anat-detail-kicker,.anat-map-note,.chapter-3d-mark,.signal-label,.feedback-line,.connection-label,
.learn-pill,.learn-status,.learn-small,.learn-note,.learn-breadcrumb,.learn-card__n,.learn-glossary,
.atlas-load,.atlas-selection-badge,.atlas-selection-label{font-size:.875rem}
.brand small{font-size:.875rem;letter-spacing:.02em}

/* Supporting text that fell under 4.5:1 after the palette change. */
.learn-root small,.learn-status,.learn-breadcrumb,.care-topic-link span,.atlas-selection-label{color:var(--color-text-muted)}

/* One-line statement of what the site does and does not do. */
.care-scope{margin:10px 0 0;padding:10px 14px;border:1px solid var(--color-divider);border-radius:var(--radius-control);background:var(--color-surface);font-weight:600;color:var(--color-text)}

/* Comfortable tap targets. */
.care-profile>summary{display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;min-height:48px}
.care-profile>summary span{margin-left:0}
.footer a{display:inline-flex;align-items:center;min-height:44px}
.visit-check input{width:24px;height:24px}

/* Selected choices differ by fill and weight, not by color alone. */
.care-controls button[aria-pressed=true]{font-weight:800;box-shadow:inset 0 -3px 0 var(--color-text)}

/* Phones: the five-link header wrapped onto two rows. Use a fixed bottom bar with the four main sections;
   "근거와 읽는 법" stays reachable from the footer and from each page's evidence section. */
@media(max-width:40em){
 .masthead{height:auto;padding:12px 16px;gap:10px}
 .edition{display:none}
 .topnav{position:fixed;left:0;right:0;bottom:0;z-index:40;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;margin:0;background:var(--color-surface);border-top:1px solid var(--color-divider);padding-bottom:env(safe-area-inset-bottom)}
 .topnav a{display:flex;align-items:center;justify-content:center;min-height:58px;padding:6px 2px;font-size:.9375rem;font-weight:600;text-align:center;border-bottom:0;border-top:3px solid transparent;color:var(--color-text-muted)}
 .topnav a.active{border-top-color:var(--color-primary);border-bottom:0;background:var(--color-surface-muted);color:var(--color-text);font-weight:800}
 .topnav a[data-page="sources"]{display:none}
 body{padding-bottom:calc(64px + env(safe-area-inset-bottom))}
}
@media print{.topnav{display:none}body{padding-bottom:0}}

/* Reading pages: keep lines of running text to a comfortable length on wide screens. */

/* 하루 5분: answer choices and glossary at body size, with room to tap. */
.learn-choice{font-size:1rem;min-height:48px;align-items:center;padding:12px 14px}
.learn-choice input{width:20px;height:20px;margin:0}
.learn-root a{font-size:.9375rem}

/* 3D on touch screens: guard layer until the visitor chooses to handle the model (see atlas-touch.js). */
.atlas-canvas{position:relative}
.atlas-touch-guard{position:absolute;inset:0;z-index:3;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:8px;padding:16px;text-align:center}
.atlas-touch-guard button,.atlas-touch-stop{min-height:48px;padding:10px 20px;border:1px solid var(--color-primary);border-radius:8px;background:var(--color-primary);color:var(--color-surface);font-size:1rem;font-weight:700}
.atlas-touch-guard span{padding:4px 10px;border-radius:6px;background:var(--color-surface);color:var(--color-text);font-size:.875rem}
.atlas-touch-stop{position:absolute;top:10px;right:10px;z-index:3;display:none;background:var(--color-surface);color:var(--color-text);border-color:var(--color-border)}
.atlas-canvas.is-touch-active .atlas-touch-guard{display:none}
.atlas-canvas.is-touch-active .atlas-touch-stop{display:block}
@media print{.atlas-touch-guard,.atlas-touch-stop{display:none}}

/* Large titles only use the serif face; everything else stays in the gothic body font. */
main h1,.care-result-title h2{font-family:var(--font-display);font-weight:700;letter-spacing:-.01em}

/* Link to the companion site (shown only where the two sites are deployed side by side). */
.visit-companion{margin:18px 0 0;padding:14px 0 0;border-top:1px solid var(--color-divider)}
.visit-companion a{font-weight:700}
