/* =============================================================================
   김장 양념 계산기 — styles.css
   DESIGN: 한국 살림 계량대(weighing counter). 소금빛 오프화이트 × 고춧가루 감홍
   단일 액센트. tabular 숫자가 주인공. 계량 눈금(graduation rule) 모티프.
   VARIANCE 5 / MOTION 2 / DENSITY 5. 고연령 가독성 우선(16px+, 큰 탭타깃).
   ============================================================================= */

:root {
  --paper:      #F3F4F1;   /* 소금빛 오프화이트 (살짝 차가운 종이) */
  --paper-2:    #FBFBF8;   /* 카드/입력 배경 */
  --paper-3:    #ECEDE8;   /* 옅은 강조 배경 */
  --ink:        #262019;   /* 따뜻한 먹빛 차콜 */
  --ink-2:      #574f45;   /* 보조 텍스트 */
  --ink-3:      #857c70;   /* 흐린 텍스트 */
  --line:       #DEDDD5;   /* 계량 눈금선 */
  --line-2:     #E9E8E2;
  --accent:     #CF4526;   /* 고춧가루 감홍/주홍 (단일 액센트) */
  --accent-ink: #B3381C;   /* 텍스트용 진한 감홍 (대비 확보) */
  --accent-soft:#F8E7E0;   /* 액센트 tint 배경 */
  --accent-line:#EBC7BB;
  --ok:         #4f7a3f;
  --radius:     12px;
  --radius-sm:  8px;
  --maxw:       960px;
  --font: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(38,32,25,.05), 0 6px 18px rgba(38,32,25,.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #1B1712;
    --paper-2:    #241F19;
    --paper-3:    #2C2620;
    --ink:        #F1EDE6;
    --ink-2:      #C6BEB2;
    --ink-3:      #928a7e;
    --line:       #382F27;
    --line-2:     #322A22;
    --accent:     #E7593A;
    --accent-ink: #F08863;
    --accent-soft:#3A241C;
    --accent-line:#5A3527;
    --ok:         #8ab877;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --paper:#1B1712;--paper-2:#241F19;--paper-3:#2C2620;--ink:#F1EDE6;--ink-2:#C6BEB2;
  --ink-3:#928a7e;--line:#382F27;--line-2:#322A22;--accent:#E7593A;--accent-ink:#F08863;
  --accent-soft:#3A241C;--accent-line:#5A3527;--ok:#8ab877;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  --paper:#F3F4F1;--paper-2:#FBFBF8;--paper-3:#ECEDE8;--ink:#262019;--ink-2:#574f45;
  --ink-3:#857c70;--line:#DEDDD5;--line-2:#E9E8E2;--accent:#CF4526;--accent-ink:#B3381C;
  --accent-soft:#F8E7E0;--accent-line:#EBC7BB;--ok:#4f7a3f;
  --shadow:0 1px 2px rgba(38,32,25,.05),0 6px 18px rgba(38,32,25,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
.tnum, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.32; font-weight: 700; letter-spacing: -.01em; }
b, strong { font-weight: 700; }
small { font-size: .82em; }
img, svg { max-width: 100%; }

/* ---------- NAV ---------- */
.topnav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px clamp(14px, 4vw, 28px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 700; font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand .badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 700; flex: none;
}
.brand .tag {
  font-size: .64rem; letter-spacing: .12em; font-weight: 600;
  color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-variant-numeric: tabular-nums;
}
.navlinks { display: flex; gap: 2px; flex-wrap: wrap; }
.navlinks a {
  color: var(--ink-2); font-size: .92rem; font-weight: 500;
  padding: 7px 11px; border-radius: 7px; min-height: 40px; display: inline-flex; align-items: center;
}
.navlinks a:hover { background: var(--paper-3); text-decoration: none; }
.navlinks a.on { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

/* graduation ruler strip */
.grad-strip {
  height: 12px;
  background-image: repeating-linear-gradient(90deg,
    var(--line) 0, var(--line) 1px, transparent 1px, transparent 12px);
  background-position: bottom;
  border-bottom: 1px solid var(--line-2);
  opacity: .8;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(14px, 4vw, 28px); }
main { padding-bottom: 56px; }
section { margin-top: 40px; }

/* ---------- HERO ---------- */
.hero { padding: 34px 0 8px; }
.eyebrow {
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 600; margin: 0 0 12px;
}
.hero h1 { font-size: clamp(1.65rem, 5.4vw, 2.5rem); margin: 0 0 14px; }
.lede { font-size: 1.06rem; color: var(--ink-2); margin: 0; max-width: 46em; }
.lede b { color: var(--ink); }

/* ---------- CALCULATOR PANEL ---------- */
.calc {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 22px;
}
.calc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: var(--paper-3);
}
.calc-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.calc-head h2 { font-size: 1.04rem; margin: 0; flex: 1; }
.calc-head .live { font-size: .66rem; letter-spacing: .14em; color: var(--ink-3); font-weight: 600; }

.calc-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 820px) { .calc-grid { grid-template-columns: 1.05fr 1fr; } }

.calc-in { padding: 20px 18px; border-bottom: 1px solid var(--line); }
@media (min-width: 820px) { .calc-in { border-bottom: none; border-right: 1px solid var(--line); } }

/* segmented tab */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--paper-3); padding: 4px; border-radius: 10px; }
.seg button {
  border: none; background: transparent; color: var(--ink-2);
  font-family: inherit; font-size: .98rem; font-weight: 600; cursor: pointer;
  padding: 11px 8px; border-radius: 7px; min-height: 46px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.25;
}
.seg button small { font-weight: 400; color: var(--ink-3); font-size: .74rem; }
.seg button.on { background: var(--paper-2); color: var(--accent-ink); box-shadow: var(--shadow); }
.seg button.on small { color: var(--ink-2); }

.lab { display: block; font-size: .9rem; font-weight: 600; color: var(--ink-2); margin: 18px 0 7px; }
.lab .h { font-weight: 400; color: var(--ink-3); font-size: .82rem; }

.amount-row { display: flex; align-items: stretch; gap: 8px; }
input[type="number"], input[type="text"] {
  width: 100%; font-family: inherit; font-size: 1.35rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--paper-2);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 52px;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.amount-row .unit { display: grid; place-items: center; padding: 0 16px; font-weight: 600; color: var(--ink-2); background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius-sm); flex: none; }

.presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.presets button {
  font-family: inherit; font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-2); background: var(--paper-2); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 8px 15px; min-height: 42px; cursor: pointer;
}
.presets button:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.presets button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* slider */
.slider-wrap { margin-top: 6px; }
.slider-wrap.hide { display: none; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-head .v { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
input[type="range"] { width: 100%; margin: 8px 0 2px; accent-color: var(--accent); height: 40px; }

/* toggles */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.toggle:first-of-type { margin-top: 14px; }
.toggle .t-txt strong { display: block; font-size: .98rem; }
.toggle .t-txt span { font-size: .8rem; color: var(--ink-3); }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .tr { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .18s; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.switch input:checked + .tr { background: var(--accent); }
.switch input:checked + .tr::after { transform: translateX(22px); }
.switch input:focus-visible + .tr { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- RESULTS ---------- */
.calc-out { padding: 18px 18px 20px; background: var(--paper-2); }
.out-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.out-summary .lbl { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.out-summary .kg { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.out-summary .kg b { color: var(--accent-ink); }

.group { border-top: 1px solid var(--line); }
.group:first-of-type { border-top: none; }
.group-h { display: flex; align-items: baseline; gap: 8px; padding: 12px 0 4px; }
.group-h .g-title { font-size: .78rem; letter-spacing: .1em; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; }
.group-h .g-total { margin-left: auto; font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.ing { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line-2); }
.ing:first-child { border-top: none; }
.ing .name { font-size: .98rem; font-weight: 600; flex: none; min-width: 5.4em; }
.ing .badge-ref { font-size: .64rem; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; margin-left: 2px; vertical-align: middle; }
.ing .val { margin-left: auto; text-align: right; }
.ing .val .g { font-size: 1.32rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ing .val .g u { font-size: .74em; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.ing .val .fr { display: block; font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ing.chap .val { text-align: right; }
.ing.chap .sub { display: block; font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 2px; }

/* notices */
.notice { font-size: .84rem; line-height: 1.6; color: var(--ink-2); background: var(--paper-3); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 14px; }
.notice.warn { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }
.notice strong { color: var(--ink); }
.notice.warn strong { color: var(--accent-ink); }
.authority { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); background: var(--paper-3); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.authority .d { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* coupang */
.cp-wrap { margin-top: 16px; }
.cp-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff !important; font-weight: 700; font-size: 1rem;
  padding: 14px 18px; border-radius: var(--radius-sm); min-height: 52px; text-align: center;
}
.cp-link:hover { text-decoration: none; filter: brightness(1.05); }
.cp-note { font-size: .76rem; color: var(--ink-3); margin: 7px 0 0; text-align: center; }

/* details basis */
.basis { margin-top: 16px; border-top: 1px solid var(--line); }
details.basis > summary, details.acc > summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; color: var(--ink-2); font-size: .92rem; }
details > summary::-webkit-details-marker { display: none; }
details.basis > summary::before, details.acc > summary::before { content: "＋ "; color: var(--accent-ink); font-weight: 700; }
details[open].basis > summary::before, details[open].acc > summary::before { content: "－ "; }
.basis .db { font-size: .86rem; color: var(--ink-2); line-height: 1.65; padding-bottom: 8px; }
.basis .db p { margin: 0 0 8px; }

/* salting helper foldable */
.fold { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fold > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; background: var(--paper-3); list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-body { padding: 16px; }

/* ---------- SECTION TITLES ---------- */
.sec-title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sec-title .n { font-size: .7rem; letter-spacing: .14em; font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.sec-title h2 { font-size: clamp(1.28rem, 3.6vw, 1.62rem); margin: 0; }
.sec-title .ln { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--line) 0, var(--line) 4px, transparent 4px, transparent 8px); }

/* ---------- PROSE ---------- */
.prose { max-width: 44em; }
.prose h2 { font-size: 1.3rem; margin: 30px 0 10px; }
.prose h3 { font-size: 1.08rem; margin: 22px 0 8px; color: var(--ink); }
.prose p { margin: 0 0 14px; color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.3em; }
.prose li { margin: 0 0 7px; }
.prose .src { font-size: .82rem; color: var(--ink-3); border-left: 3px solid var(--accent-line); padding-left: 12px; margin-top: 14px; }
.steps { counter-reset: st; list-style: none; padding: 0; margin: 8px 0 16px; }
.steps li { position: relative; padding: 12px 0 12px 46px; border-top: 1px solid var(--line); }
.steps li::before { counter-increment: st; content: counter(st); position: absolute; left: 0; top: 12px; width: 30px; height: 30px; background: var(--accent-soft); color: var(--accent-ink); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.steps li strong { display: block; }

/* ---------- TABLES ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 6px 0 12px; -webkit-overflow-scrolling: touch; }
table.gtable { border-collapse: collapse; width: 100%; min-width: 640px; font-size: .9rem; }
table.gtable th, table.gtable td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.gtable thead th { position: sticky; top: 0; background: var(--paper-3); color: var(--ink-2); font-size: .82rem; text-align: right; z-index: 1; }
table.gtable thead th:first-child, table.gtable tbody th { text-align: left; }
table.gtable tbody th { background: var(--paper-2); font-weight: 700; }
table.gtable tbody th small { display: block; font-weight: 400; color: var(--ink-3); font-size: .74rem; }
table.gtable td small { color: var(--ink-3); font-weight: 400; }
table.gtable td.hl { color: var(--accent-ink); font-weight: 700; }
table.gtable tbody tr:hover td, table.gtable tbody tr:hover th { background: var(--paper-3); }
table.conv th, table.conv td { text-align: left; }

/* anchor cards */
.anchor { background: var(--paper-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.anchor h3 { margin: 0 0 6px; }
.anchor .big { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.anchor p { margin: 6px 0 10px; }
.btn-link { display: inline-flex; align-items: center; gap: 6px; background: var(--ink); color: var(--paper-2) !important; font-weight: 600; font-size: .9rem; padding: 9px 15px; border-radius: 999px; min-height: 42px; }
.btn-link:hover { text-decoration: none; filter: brightness(1.1); }

/* ---------- LINK CARDS ---------- */
.linkcards { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .linkcards { grid-template-columns: 1fr 1fr; } }
.linkcard { display: block; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--ink); }
.linkcard:hover { text-decoration: none; border-color: var(--accent-line); box-shadow: var(--shadow); }
.linkcard .lc-tag { font-size: .64rem; letter-spacing: .12em; font-weight: 700; color: var(--accent-ink); }
.linkcard h3 { margin: 5px 0 5px; font-size: 1.06rem; }
.linkcard p { margin: 0; font-size: .88rem; color: var(--ink-2); }

/* ---------- FAQ / ACCORDION ---------- */
.acc { border-bottom: 1px solid var(--line); }
.acc > summary { font-size: 1.02rem; color: var(--ink); padding: 16px 0; }
.acc .fa { padding: 0 0 16px; color: var(--ink-2); font-size: .96rem; }
.acc .fa p { margin: 0 0 10px; }
.qmark { color: var(--accent-ink); font-weight: 700; margin-right: 8px; }

/* ---------- FOOTER ---------- */
footer { border-top: 1px solid var(--line); background: var(--paper-2); margin-top: 56px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 20px; padding: 34px 0 10px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-col h4 { font-size: .82rem; letter-spacing: .04em; color: var(--ink-3); margin: 0 0 10px; text-transform: uppercase; }
.footer-col a { display: block; color: var(--ink-2); font-size: .9rem; padding: 4px 0; }
.footer-bottom { border-top: 1px solid var(--line); padding: 16px 0 30px; color: var(--ink-3); font-size: .82rem; }
.footer-bottom .plate { font-size: .7rem; letter-spacing: .1em; margin-top: 4px; }

/* utils */
.mt0 { margin-top: 0; }
.center { text-align: center; }
.hide { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
