/* 딸둘아빠 육아 돈 노트 — 잔잔한 톤: 따뜻한 오프화이트, 차분한 녹색, 큰 본문 */
:root {
  --bg: #fbfaf6; --surface: #ffffff; --fg: #2b2a27; --muted: #6e6b64; --line: #e8e4da;
  --accent: #3f7d5c; --accent-soft: #e8f0ea; --warn: #fff6da; --warn-line: #e9cf7a; --todo: #fff1b8;
  --radius: 14px; --wrap: 720px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171715; --surface: #1f1f1c; --fg: #eceae4; --muted: #a7a49b; --line: #2e2d29;
    --accent: #7cc29a; --accent-soft: #21302a; --warn: #33301f; --warn-line: #6b5c2a; --todo: #4a3f12; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.8 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); }

/* 머리글 */
.site-head { background: var(--bg); box-shadow: 0 1px 0 var(--line); }
.head-row { display: flex; align-items: center; height: 56px; }
.cats-bar { border-bottom: 1px solid var(--line); }
.logo { color: var(--fg); text-decoration: none; font-weight: 700; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.logo-mark { color: var(--accent); font-size: 12px; letter-spacing: -2px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-top: 12px; padding-bottom: 12px; scrollbar-width: none; }
.cats a { flex: none; font-size: 14px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.cats a[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.draft-bar { background: var(--todo); text-align: center; font-size: 14px; padding: 6px; }

/* 홈 */
.hero { padding: 44px 0 20px; }
.hero-kicker { color: var(--accent); font-weight: 600; font-size: 14px; margin: 0 0 8px; }
.hero h1 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; letter-spacing: -0.5px; }
.lead { color: var(--muted); margin: 0; }
.sec-title { font-size: 18px; margin: 36px 0 12px; }
.topics { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.topics a { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.topics span { font-size: 13px; color: var(--muted); line-height: 1.5; }
.topics em { font-style: normal; font-size: 13px; color: var(--accent); margin-top: 4px; }
@media (max-width: 480px) { .topics { grid-template-columns: 1fr; } .hero h1 { font-size: 26px; } }

/* 글 목록 카드 */
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.card a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.card a:hover { border-color: var(--accent); }
.card-meta { font-size: 13px; color: var(--muted); }
.card-title { font-size: 18px; font-weight: 700; line-height: 1.45; }
.card-desc { font-size: 15px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list { padding-top: 28px; }
.list h1 { font-size: 26px; margin: 0 0 6px; }
.list .lead { margin-bottom: 20px; }

/* 글 */
.post { padding: 24px 0 40px; }
.crumb { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.crumb a { color: var(--muted); }
.post h1 { font-size: 28px; line-height: 1.4; margin: 0 0 12px; letter-spacing: -0.4px; }
.trust { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; font-size: 13px; }
.trust span { padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.notice { background: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 16px; font-size: 15px; margin: 0 0 20px; }
.prose h2 { font-size: 22px; line-height: 1.45; margin: 44px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 18px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose strong { background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
.table { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.6; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { background: var(--accent-soft); font-weight: 600; }
.table th:first-child, .table td:first-child { white-space: nowrap; }
@media (max-width: 480px) { .table table { font-size: 14px; } .table th, .table td { padding: 8px 9px; } .hero h1 { font-size: 24px; } }
.table tr:last-child td { border-bottom: 0; }
sup.fn a { font-size: 11px; text-decoration: none; padding: 0 3px; margin-left: 1px; border-radius: 4px; background: var(--accent-soft); }
mark.todo { background: var(--todo); color: var(--fg); padding: 0 4px; border-radius: 4px; }
.photo { display: block; border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.sources { margin-top: 40px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.7; }
.sources h2 { font-size: 16px; margin: 0 0 8px; }
.sources ol { margin: 0; padding-left: 20px; }
.sources li { margin-bottom: 8px; }
.fn-label { font-weight: 600; }
.back { text-decoration: none; }
.author { margin-top: 24px; padding: 18px 20px; border-radius: var(--radius); background: var(--accent-soft); font-size: 15px; }
.author p { margin: 4px 0 8px; }
.related h2 { font-size: 18px; margin: 36px 0 12px; }
.page .prose h2 { border-top: 0; padding-top: 0; margin-top: 32px; }

/* 미니 프로필(점선 방 + 탭 + 오늘의 기분 말풍선) */
.mini { position: relative; margin: 28px 0 8px; padding: 22px 18px 14px; border-radius: 18px; background: var(--surface);
  border: 2px dashed var(--line); font-size: 15px; }
.mini-tab { position: absolute; top: -12px; left: 16px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px;
  background: var(--accent); color: var(--bg); }
.mini-row { display: flex; gap: 14px; align-items: center; }
.mini-row p { margin: 2px 0 0; color: var(--muted); line-height: 1.6; }
.family { flex: none; width: 104px; height: auto; }
.mood { position: relative; margin: 14px 0 10px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); line-height: 1.6; }
.mood::before { content: ""; position: absolute; top: -7px; left: 40px; border: 7px solid transparent; border-top: 0; border-bottom-color: var(--accent-soft); }
.mood-label { display: block; font-size: 12px; font-weight: 700; color: var(--accent); }
.mini-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: 14px; }
.mini.compact { margin-top: 32px; }
.mini.compact .family { width: 84px; }
@media (max-width: 420px) { .family { width: 84px; } }

/* 홈 로비: 아이소메트릭 미니룸 (tools/lib/room.js) */
.lobby { position: relative; margin: 28px 0 8px; padding: 18px 14px 14px; border-radius: 18px; border: 2px dashed var(--line);
  background: radial-gradient(120% 80% at 50% 30%, #fff7ef 0%, var(--surface) 70%); font-size: 15px; }
.room-stage { perspective: 900px; margin: 4px -4px 0; }
.room { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto; overflow: visible; touch-action: manipulation;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); -webkit-tap-highlight-color: transparent; user-select: none; }
.room polygon:not(.flat) { stroke: #8a6e5c; stroke-opacity: .55; stroke-width: .7; stroke-linejoin: round; }
.room .floor { cursor: pointer; }
.room .sky { fill: #3d4b7a; }
.room .sun { display: none; }
.room.day .sky { fill: #bfe3f5; } .room.day .sun { display: inline; } .room.day .night { display: none; }
.room .it { cursor: pointer; outline: none; }
.room .lift { transition: transform 260ms cubic-bezier(.3, 1.6, .5, 1), filter 200ms; }
.room .it:hover .lift, .room .it:focus-visible .lift { transform: translateY(-5px); filter: drop-shadow(0 4px 3px rgba(80, 60, 40, .18)); }
.room .it:focus-visible .lift { filter: drop-shadow(0 0 2.5px var(--accent)); }
.room #it-clock:hover .lift, .room #it-frame:hover .lift, .room #it-clock:focus-visible .lift, .room #it-frame:focus-visible .lift { transform: translateY(-2px); }
.room .tip { opacity: 0; transition: opacity 150ms; pointer-events: none; }
.room .tip.on { opacity: 1; }
.room .tip rect, .room .tip path { fill: #2b2a27; }
.room .tip text { fill: #fff; font-size: 11px; font-weight: 600; }
.room .tag { font-size: 6px; fill: #4f8f80; font-weight: 700; }
.room .zz { font-size: 8px; font-weight: 700; fill: #8fa3c8; }
.room #dad { transition: transform 1s ease-in-out; }
.room .say { opacity: 0; transition: opacity 180ms; pointer-events: none; }
.room .say.on { opacity: 1; }
.room .say text { font-size: 10px; fill: #2b2a27; font-weight: 600; }
.room .pupil { transform: translate(var(--ex, 0px), var(--ey, 0px)); }
.room .coin { opacity: 0; }
.room-hint { margin: 6px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.lobby .mood { margin-top: 10px; }
@media (hover: none) { .room-hint { font-size: 0; } .room-hint::after { content: "소품을 누르면 주제별 글로 가요 · 바닥을 누르면 아빠가 걸어가요"; font-size: 12.5px; } }
@media (prefers-reduced-motion: no-preference) {
  .room .bob { animation: bob 2.6s ease-in-out infinite; } .room .b2 { animation-duration: 1.9s; }
  .room .walking .bob { animation: hop 320ms ease-in-out infinite; }
  .room .zz { animation: zz 2.8s ease-in infinite; } .room .z2 { animation-delay: 1.4s; }
  .room .tw { animation: tw 2.4s ease-in-out infinite; } .room .t2 { animation-delay: .8s; } .room .t3 { animation-delay: 1.6s; }
  .room .cur { animation: tw 1s steps(1) infinite; }
  .room .drop { animation: drop 3.2s ease-in-out infinite; }
  .room .wob { transform-box: fill-box; transform-origin: 50% 100%; }
  .room #it-trash:hover .wob { animation: wob 500ms ease-in-out; }
  .room #it-pig:hover .coin, .room #it-pig:focus-visible .coin { animation: coin 700ms ease-in forwards; }
}
@keyframes bob { 50% { transform: translateY(-1.6px); } }
@keyframes hop { 50% { transform: translateY(-3px); } }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(4px, -10px); } }
@keyframes tw { 50% { opacity: .25; } }
@keyframes drop { 0%, 60%, 100% { opacity: 0; transform: translateY(-2px); } 70%, 90% { opacity: 1; transform: translateY(0); } }
@keyframes wob { 25% { transform: rotate(-6deg); } 75% { transform: rotate(5deg); } }
@keyframes coin { 0% { opacity: 1; transform: translateY(-6px); } 80% { opacity: 1; transform: translateY(8px); } 100% { opacity: 0; transform: translateY(9px); } }
@media (prefers-color-scheme: dark) { .lobby { background: radial-gradient(120% 80% at 50% 30%, #2a2622 0%, var(--surface) 70%); } .room { filter: brightness(.9) saturate(.92); } }

/* 우리 집 타임라인 */
.timeline { list-style: none; padding: 0 0 0 18px; margin: 16px 0 0; border-left: 2px dashed var(--line); }
.timeline li { position: relative; margin: 0 0 20px; padding-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 7px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); }
.tl-when { display: block; font-size: 13px; color: var(--accent); font-weight: 600; }
.timeline p { margin: 2px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

/* 손맛·접근성 (apple-design 원칙 중 읽기 사이트에 맞는 것만: 큰 글씨일수록 좁은 자간·행간,
   누르는 순간의 반응, 반투명 고정 머리글, 움직임·투명도·대비 설정 존중) */
.hero h1, .post h1, .list h1 { letter-spacing: -0.02em; line-height: 1.32; }
.prose h2 { letter-spacing: -0.012em; }
.site-head { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }
.card a, .topics a, .cats a { transition: transform 100ms ease-out, border-color 150ms ease-out; -webkit-tap-highlight-color: transparent; }
.card a:active, .topics a:active, .cats a:active { transform: scale(0.98); }
:target { scroll-margin-top: 72px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { .card a, .topics a, .cats a { transition: none; } .card a:active, .topics a:active, .cats a:active { transform: none; } }
@media (prefers-reduced-transparency: reduce) { .site-head { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (prefers-contrast: more) { :root { --line: #8a867c; --muted: #4a4842; } .card a, .topics a, .table, .sources { border-width: 2px; } }

/* 바닥글 */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; font-size: 14px; color: var(--muted); }
.site-foot p { margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 14px; }
.foot-links a { color: var(--muted); }
