/* ============================================================
   FRAME LABS — Shared Design System
   "Korean Medical Luxury" · Aesop meets Bloomberg Terminal
   Light primary. Fraunces (display/numbers) + Pretendard (body).
   Built once, reused across /, /studio, /intelligence, /smile.
   ============================================================ */

:root {
    /* --- Brand palette (brief §2) --- */
    --bg:        #FAFAF7;   /* off-white — never pure white in light mode */
    --card:      #FFFFFF;
    --ink:       #131316;   /* near-black, slight blue tint */
    --teal:      #2d5f5d;   /* primary */
    --teal-brt:  #4ecdc4;   /* bright teal, accents */
    --gold:      #c4a574;   /* accent — sparingly */
    --gold-dark: #a08050;
    --burgundy:  #8B4049;   /* the ONLY negative/alert color */
    --muted:     #6b6b70;   /* secondary text */

    /* --- Back-compat aliases for migrated Studio CSS --- */
    --black:      var(--ink);
    --white:      var(--card);
    --cream:      var(--bg);
    --gray:       var(--muted);
    --gray-light: #9a9aa0;

    /* --- Tints / lines --- */
    --line:      rgba(19,19,22,0.10);
    --line-soft: rgba(19,19,22,0.06);
    --teal-tint: rgba(45,95,93,0.06);
    --gold-tint: rgba(196,165,116,0.12);
    --ink-tint:  rgba(19,19,22,0.04);

    /* --- Type --- */
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body:    'Pretendard', 'Pretendard JP', 'Hiragino Sans', 'Yu Gothic',
                    system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-data:    'Inter', var(--font-body);

    /* --- Type scale (editorial; quiet body, big display) --- */
    --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --step-0:  clamp(0.95rem, 0.92rem + 0.18vw, 1.05rem);
    --step-1:  clamp(1.15rem, 1.08rem + 0.4vw, 1.4rem);
    --step-2:  clamp(1.5rem, 1.32rem + 0.9vw, 2.1rem);
    --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.4rem);
    --step-4:  clamp(2.8rem, 2.1rem + 3.6vw, 5.2rem);

    /* --- Space / radius / motion --- */
    --r-sm: 8px;  --r-md: 14px;  --r-lg: 22px;  --r-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(19,19,22,.04), 0 2px 8px rgba(19,19,22,.04);
    --shadow-md: 0 4px 14px rgba(19,19,22,.06), 0 14px 40px rgba(19,19,22,.07);
    --ease: cubic-bezier(.22,.61,.36,1);
    --nav-h: 72px;
    --maxw: 1200px;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.7;
    font-weight: 400;
    font-feature-settings: "ss01";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

::selection { background: var(--teal); color: #fff; }

/* Visible keyboard focus everywhere (brief quality floor) */
:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ============================================================
   LANGUAGE TOGGLE — CSS-class mechanism (reused from live site)
   Default EN. body.ko / body.ja swap visibility.
   ============================================================ */
[data-lang="ko"], [data-lang="ja"] { display: none; }
span[data-lang="ko"], span[data-lang="ja"] { display: none; }
span[data-lang="en"] { display: inline; }

body.ko [data-lang="ko"] { display: block; }
body.ko [data-lang="en"], body.ko [data-lang="ja"] { display: none; }
body.ko span[data-lang="ko"] { display: inline; }
body.ko span[data-lang="en"], body.ko span[data-lang="ja"] { display: none; }

body.ja [data-lang="ja"] { display: block; }
body.ja [data-lang="en"], body.ja [data-lang="ko"] { display: none; }
body.ja span[data-lang="ja"] { display: inline; }
body.ja span[data-lang="en"], body.ja span[data-lang="ko"] { display: none; }

/* inline-level elements that must stay inline when shown */
[data-lang].inline { display: none; }
span[data-lang].inline { display: none; }
body:not(.ko):not(.ja) [data-lang="en"].inline { display: inline; }
body.ko [data-lang="ko"].inline { display: inline; }
body.ja [data-lang="ja"].inline { display: inline; }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }
.section { padding: clamp(64px, 9vw, 140px) 0; }
.section--tint { background: var(--ink); color: var(--bg); }
.eyebrow {
    font-family: var(--font-data);
    font-size: var(--step--1);
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--teal);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .6em;
}
.eyebrow::before {
    content: ""; width: 16px; height: 1px; background: var(--gold);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.08; letter-spacing: -0.01em; }
.display { font-size: var(--step-4); line-height: 1.0; letter-spacing: -0.025em; }
.h2 { font-size: var(--step-3); }
.lede { font-size: var(--step-1); color: var(--muted); font-weight: 400; line-height: 1.55; }
.num { font-family: var(--font-display); font-feature-settings: "tnum"; letter-spacing: -0.02em; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55em;
    padding: .85em 1.6em;
    border-radius: var(--r-pill);
    font-size: var(--step-0); font-weight: 500;
    line-height: 1; letter-spacing: .01em;
    transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
    white-space: nowrap;
}
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: #244e4c; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-dark); transform: translateY(-2px); }
.btn--lg { padding: 1.05em 2em; font-size: var(--step-1); }

/* ============================================================
   STATUS PILLS — honest division status system (brief §3)
   ============================================================ */
.pill {
    display: inline-flex; align-items: center; gap: .5em;
    font-family: var(--font-data);
    font-size: var(--step--1); font-weight: 600;
    letter-spacing: .04em;
    padding: .42em .9em;
    border-radius: var(--r-pill);
    line-height: 1;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--now    { color: var(--teal);   background: var(--teal-tint); }
.pill--soon   { color: var(--gold-dark); background: var(--gold-tint); }
.pill--dev    { color: var(--muted);  background: transparent; border: 1px solid var(--line); }
.pill--dev::before { background: var(--muted); opacity: .6; }

/* ============================================================
   APERTURE MARK — signature motif (brief §2)
   ============================================================ */
.aperture { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; }
.aperture-divider {
    display: flex; align-items: center; justify-content: center;
    gap: 18px; color: var(--gold); padding: clamp(28px,5vw,56px) 0;
}
.aperture-divider::before, .aperture-divider::after {
    content: ""; height: 1px; width: min(120px, 22vw); background: var(--line);
}
.aperture-divider .aperture { width: 24px; height: 24px; color: var(--gold); }

/* ============================================================
   SHARED HEADER
   ============================================================ */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--nav-h);
    display: flex; align-items: center;
    background: rgba(250,250,247,0.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: .55em; font-family: var(--font-display); font-size: 1.32rem; letter-spacing: -0.01em; color: var(--ink); }
.brand .aperture { width: 26px; height: 26px; color: var(--teal); }
.brand b { font-weight: 500; }
.brand .brand-loc { font-family: var(--font-data); font-size: .62em; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-left: .2em; align-self: center; }

.nav-links { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 34px); list-style: none; }
.nav-links a {
    font-size: var(--step-0); color: var(--ink); position: relative; padding: .3em 0;
    transition: color .2s var(--ease);
}
.nav-links a::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1.5px;
    background: var(--teal); transition: right .3s var(--ease);
}
.nav-links a:hover { color: var(--teal); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { right: 0; }
.nav-links a[aria-current="page"] { color: var(--teal); }

.nav-right { display: flex; align-items: center; gap: 18px; }
.lang-toggle { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-data); font-size: var(--step--1); }
.lang-opt { padding: .3em .45em; color: var(--gray-light); font-weight: 600; letter-spacing: .05em; border-radius: 6px; transition: color .2s; }
.lang-opt:hover { color: var(--ink); }
.lang-sep { color: var(--line); }
body:not(.ko):not(.ja) .en-toggle,
body.ko .ko-toggle,
body.ja .ja-toggle { color: var(--teal); }

.nav-toggle { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
    content: ""; display: block; width: 22px; height: 1.5px; background: var(--ink); transition: transform .3s var(--ease), opacity .2s;
}
.nav-toggle span::before { position: absolute; transform: translateY(-7px); }
.nav-toggle span::after { position: absolute; transform: translateY(7px); }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; position: relative; }
    .nav-links {
        position: fixed; inset: var(--nav-h) 0 auto 0;
        flex-direction: column; gap: 0; align-items: stretch;
        background: var(--bg); border-bottom: 1px solid var(--line);
        padding: 8px clamp(20px,5vw,48px) 20px;
        transform: translateY(-12px); opacity: 0; pointer-events: none;
        transition: transform .3s var(--ease), opacity .3s var(--ease);
    }
    .nav-links a { padding: .9em 0; border-bottom: 1px solid var(--line-soft); font-size: var(--step-1); }
    body.nav-open .nav-links { transform: none; opacity: 1; pointer-events: auto; }
    body.nav-open .nav-toggle span { background: transparent; }
    body.nav-open .nav-toggle span::before { transform: rotate(45deg); }
    body.nav-open .nav-toggle span::after { transform: rotate(-45deg); }
}

/* ============================================================
   SHARED FOOTER
   ============================================================ */
.site-footer { background: var(--ink); color: rgba(250,250,247,0.7); padding: clamp(56px,7vw,88px) 0 40px; }
.site-footer .wrap { display: grid; gap: 40px; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; align-items: start; }
.footer-brand { display: inline-flex; align-items: center; gap: .5em; font-family: var(--font-display); font-size: 1.5rem; color: var(--bg); }
.footer-brand .aperture { width: 28px; height: 28px; color: var(--teal-brt); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 22px; font-size: var(--step-0); }
.footer-nav a { color: rgba(250,250,247,0.7); transition: color .2s; }
.footer-nav a:hover { color: var(--bg); }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; border-top: 1px solid rgba(250,250,247,0.12); padding-top: 24px; font-size: var(--step--1); font-family: var(--font-data); color: rgba(250,250,247,0.55); letter-spacing: .02em; }
.footer-meta a { color: var(--teal-brt); }
.site-footer .lang-toggle .lang-opt { color: rgba(250,250,247,0.5); }
.site-footer .lang-toggle .lang-opt:hover { color: var(--bg); }
body:not(.ko):not(.ja) .site-footer .en-toggle,
body.ko .site-footer .ko-toggle,
body.ja .site-footer .ja-toggle { color: var(--teal-brt); }
.site-footer .lang-sep { color: rgba(250,250,247,0.2); }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line); }

/* ============================================================
   FORMS (shared consultation / waitlist / interest)
   ============================================================ */
.field { display: grid; gap: .45em; margin-bottom: 18px; }
.field label { font-family: var(--font-data); font-size: var(--step--1); letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
    font: inherit; font-size: var(--step-0); color: var(--ink);
    background: var(--bg); border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: .8em 1em; width: 100%;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint);
}
.field textarea { min-height: 120px; resize: vertical; }

/* ============================================================
   MODAL (shared consultation dialog)
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(19,19,22,0.5); backdrop-filter: blur(4px); }
.modal-card { position: relative; background: var(--card); border-radius: var(--r-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; padding: clamp(28px,4vw,44px); box-shadow: var(--shadow-md); animation: modalIn .35s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.4rem; line-height: 1; transition: background .2s, color .2s; }
.modal-close:hover { background: var(--ink-tint); color: var(--ink); }

/* ============================================================
   REVEAL ON SCROLL
   ============================================================ */
/* Progressive enhancement: only hide-to-animate when JS is present.
   No-JS visitors (and crawlers) always see content. */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ============================================================
   REDUCED MOTION (brief quality floor)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .reveal { opacity: 1; transform: none; }
}

/* skip link */
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); z-index: 3000; }
.skip-link:focus { left: 16px; }

/* Korean typography: never break inside words (KO only — JA has no spaces,
   so keep-all would overflow there). */
body.ko { word-break: keep-all; overflow-wrap: break-word; }
