/* foundation.css — shared by 몸의 연결 지도 and 내 건강지킴이.
   Edit this file in shared/ and run `npm run sync`; the copies in body-atlas/dist/ and health-guardian/
   must stay identical (`npm run build` refuses to build when they differ).

   Each site defines its own colours with these names: --color-bg, --color-surface, --color-surface-muted,
   --color-text, --color-text-muted, --color-primary, --color-border, --color-divider, --color-danger.
   This file only holds what both sites share: type, spacing, shape, motion, focus and browser surfaces.
   It is unlayered and loads first, so its few element rules (focus, selection) apply everywhere. */

@font-face{font-family:"MaruBuri";src:url("fonts/MaruBuri-Bold.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}

:root{
 /* Type. Sizes are in rem so the reader's own text size setting carries through. Never set a font size on :root. */
 --font-body:"Noto Sans KR",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Segoe UI","Malgun Gothic",system-ui,sans-serif;
 --font-display:"MaruBuri",var(--font-body);
 --text-sm:.875rem;   /* 14px: the smallest text either site uses */
 --text-base:1rem;    /* 16px: controls and short labels */
 --text-md:1.125rem;  /* 18px: running text */
 --text-lg:1.25rem;   /* 20px: card titles */
 --text-xl:1.5rem;    /* 24px: section titles */
 --text-2xl:2rem;     /* 32px: page titles */

 /* Space, on a 4px grid. */
 --space-1:.25rem;--space-2:.5rem;--space-3:.75rem;--space-4:1rem;--space-5:1.5rem;--space-6:2rem;--space-7:3rem;

 /* Shape (DESIGN.md): 4px chips and badges, 8px buttons, inputs and cards, 12px dialogs and large panels, 16px pictures. */
 --radius-chip:4px;
 --radius-control:8px;
 --radius-card:8px;
 --radius-panel:12px;
 --radius-image:16px;
 --radius-full:9999px;

 /* Elevation: soft shadows tinted with each site's primary colour, never grey-black. */
 --shadow-sm:0 1px 3px color-mix(in srgb,var(--color-primary) 6%,transparent);
 --shadow:0 2px 8px color-mix(in srgb,var(--color-primary) 8%,transparent);
 --shadow-md:0 4px 16px color-mix(in srgb,var(--color-primary) 10%,transparent);
 --shadow-lg:0 8px 32px color-mix(in srgb,var(--color-primary) 14%,transparent);
 --tap-min:44px;

 /* Motion: short, ease-out, and only for state changes. */
 --duration-fast:150ms;
 --ease-out:cubic-bezier(.2,.8,.2,1);
}

/* Focus: one ring for every control in both sites, dark on light with a light gap so it shows on filled buttons too. */
:focus-visible{outline:2px solid var(--color-text);outline-offset:2px;box-shadow:0 0 0 2px var(--color-surface)}

/* Browser-drawn surfaces take the site palette. */
:root{accent-color:var(--color-primary);scrollbar-color:var(--color-border) var(--color-bg)}
::selection{background:color-mix(in oklab,var(--color-primary) 22%,var(--color-surface));color:var(--color-text)}
input,textarea{caret-color:var(--color-primary)}
::placeholder{color:var(--color-text-muted);opacity:1}
a{text-underline-offset:.2em}
/* Headings break into lines of similar length instead of leaving one word alone on the last line. */
:where(h1,h2,h3){text-wrap:balance}
table,.tabular{font-variant-numeric:tabular-nums}

/* "가+" larger-text switch: scales the whole page the way browser zoom does, header and menus included. */
html[data-text=large] body{zoom:1.15}
@media print{html[data-text=large] body{zoom:1}}

/* Modal dialogs: scrolling inside or over the backdrop must not move the page behind. */
dialog:modal{overscroll-behavior:contain}
dialog::backdrop{overflow:hidden;overscroll-behavior:contain}

/* Confirmation dialog (ask-dialog.js). */
.ask-dialog{width:min(30rem,calc(100vw - 2rem));padding:var(--space-5);border:1px solid var(--color-divider);border-radius:var(--radius-panel);background:var(--color-surface);color:var(--color-text);box-shadow:var(--shadow-lg)}
.ask-dialog::backdrop{background:rgb(0 0 0 / .45)}
.ask-dialog h2{margin:0 0 var(--space-3);font-family:var(--font-body);font-size:var(--text-lg);line-height:1.4}
.ask-dialog p{margin:0 0 var(--space-2);font-size:var(--text-base);line-height:1.7}
.ask-dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--space-2);margin-top:var(--space-5)}
.ask-dialog-button{min-height:var(--tap-min);padding:var(--space-2) var(--space-4);border:1px solid var(--color-border);border-radius:var(--radius-control);background:var(--color-surface);color:var(--color-text);font:inherit;font-weight:700;cursor:pointer}
.ask-dialog-button:hover{background:var(--color-surface-muted)}
.ask-dialog-button.is-primary{border-color:var(--color-primary);background:var(--color-primary);color:var(--color-surface)}
.ask-dialog-button.is-primary:hover{background:var(--color-text);border-color:var(--color-text)}
.ask-dialog-button.is-danger{border-color:var(--color-danger);color:var(--color-danger)}
.ask-dialog-button.is-danger:hover{background:color-mix(in oklab,var(--color-danger) 8%,var(--color-surface))}
@media (max-width:30em){.ask-dialog-actions{flex-direction:column-reverse}.ask-dialog-button{width:100%}}

/* Skip link: hidden until focused. */
.skip-link{position:absolute;left:var(--space-4);top:var(--space-2);z-index:100;padding:var(--space-3) var(--space-4);border-radius:var(--radius-control);background:var(--color-surface);color:var(--color-text);font-weight:700;transform:translateY(-200%)}
.skip-link:focus{transform:none}
