/* 논리와 수학 — 공용 스타일
   색·글꼴·헤더·상단·푸터·게시판이 모두 여기 있습니다.
   이 파일 하나를 고치면 모든 페이지에 반영됩니다. */

:root{
  --paper:#FFFFFF;
  --cream:#FBF8F4;
  --sunken:#F5F1EB;
  --ink:#241F1A;
  --body:#5E564D;
  --muted:#8F857B;
  --line:#EBE5DD;
  --line-soft:#F3EFE9;

  --c-notice:#E0823A;   --b-notice:#FDF0E2;
  --c-math:#4F8FCE;     --b-math:#E8F1FB;
  --c-sci:#5DA85F;      --b-sci:#EAF5EA;
  --c-info:#8A78BE;     --b-info:#F1ECFA;
  --c-about:#B98E4E;    --b-about:#FAF2E5;
  --c-gray:#8F857B;     --b-gray:#F1EDE8;

  --badge:#241F1A;
  --badge-ink:#FFFFFF;
  --veil:rgba(36,31,26,.52);
  --radius:18px;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --paper:#1A1714;--cream:#201C18;--sunken:#262119;
    --ink:#F2EDE6;--body:#C0B6AA;--muted:#948A7E;
    --line:#332C25;--line-soft:#2A241E;
    --b-notice:#3A2B1C;--b-math:#1E2A38;--b-sci:#1F2E20;--b-info:#2A2438;--b-about:#332818;--b-gray:#2B2621;
    --c-notice:#F0AC72;--c-math:#86B8E5;--c-sci:#8FCB91;--c-info:#B4A6DC;--c-about:#D9B884;--c-gray:#A89E92;
    --badge:#F2EDE6;--badge-ink:#1A1714;
    --veil:rgba(0,0,0,.62);
  }
}
:root[data-theme="dark"]{
  --paper:#1A1714;--cream:#201C18;--sunken:#262119;
  --ink:#F2EDE6;--body:#C0B6AA;--muted:#948A7E;
  --line:#332C25;--line-soft:#2A241E;
  --b-notice:#3A2B1C;--b-math:#1E2A38;--b-sci:#1F2E20;--b-info:#2A2438;--b-about:#332818;--b-gray:#2B2621;
  --c-notice:#F0AC72;--c-math:#86B8E5;--c-sci:#8FCB91;--c-info:#B4A6DC;--c-about:#D9B884;--c-gray:#A89E92;
  --badge:#F2EDE6;--badge-ink:#1A1714;
  --veil:rgba(0,0,0,.62);
}

*{box-sizing:border-box;margin:0;padding:0}
html{scroll-padding-top:84px}
body{
  background:var(--paper);color:var(--body);
  font-family:"Noto Sans KR",-apple-system,BlinkMacSystemFont,"Malgun Gothic",sans-serif;
  font-size:15px;line-height:1.75;word-break:keep-all;-webkit-font-smoothing:antialiased;
}
img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}
:focus-visible{outline:2px solid var(--c-math);outline-offset:3px;border-radius:6px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
.wrap{max-width:1120px;margin:0 auto;padding-inline:20px}
.disp{font-family:"Black Han Sans","Noto Sans KR",sans-serif;font-weight:400;letter-spacing:-.01em}
.logomark{display:block;width:42px;height:auto;flex:none}
.choco-img{display:block;flex:none;height:auto}

/* ── 헤더 ─────────────────────────────── */
.site-header{position:sticky;top:env(safe-area-inset-top,0px);z-index:40;background:var(--paper);border-bottom:1px solid var(--line)}
.bar{display:flex;align-items:center;justify-content:space-between;height:70px;gap:16px}
.brand{display:flex;align-items:center;gap:9px;flex:none}
.brand b{font-family:"Black Han Sans",sans-serif;font-weight:400;color:var(--ink);font-size:1.2rem}
.nav{display:flex;gap:4px}
.nav a{padding:9px 14px;font-size:.93rem;font-weight:500;color:var(--body);border-radius:20px;transition:background .15s,color .15s;white-space:nowrap}
.nav a:hover{background:var(--sunken);color:var(--ink)}
.nav a[aria-current="page"]{background:var(--sunken);color:var(--ink);font-weight:700}
.burger{display:none;width:42px;height:42px;align-items:center;justify-content:center;flex:none}
.burger i,.burger i::before,.burger i::after{display:block;width:19px;height:2px;background:var(--ink);border-radius:2px;transition:.2s}
.burger i{position:relative}
.burger i::before,.burger i::after{content:"";position:absolute;left:0}
.burger i::before{top:-6px}.burger i::after{top:6px}
.burger.on i{background:transparent}
.burger.on i::before{top:0;transform:rotate(45deg)}
.burger.on i::after{top:0;transform:rotate(-45deg)}
@media(max-width:900px){
  .nav{position:absolute;top:70px;left:0;right:0;flex-direction:column;gap:0;background:var(--paper);
    border-bottom:1px solid var(--line);padding:6px 20px 16px;display:none}
  .nav.open{display:flex}
  .nav a{padding:14px 6px;border-radius:0;border-bottom:1px solid var(--line-soft);font-size:1rem}
  .nav a[aria-current="page"]{background:none}
  .burger{display:flex}
}

/* ── 상단 (모든 페이지 공통) ──────────── */
.hero{background:var(--cream);padding-block:56px 0;overflow:hidden}
.hero-top{display:flex;align-items:center;justify-content:center;gap:28px;flex-wrap:wrap;text-align:center}
.hero h1{color:var(--ink);font-size:clamp(2.8rem,9vw,5.4rem);line-height:1.02;text-wrap:balance}
.hero h1 .sub{display:block;font-family:"Noto Sans KR",sans-serif;font-weight:500;
  font-size:clamp(.82rem,2.2vw,1rem);color:var(--muted);letter-spacing:.14em;margin-bottom:14px;line-height:1}
.hero-top .choco-img{width:clamp(110px,20vw,170px);animation:bob 4.5s ease-in-out infinite}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
.hero-lede{text-align:center;color:var(--body);font-size:clamp(.95rem,2.2vw,1.08rem);margin-top:20px}
.tree{margin-top:26px;height:46px;position:relative}
.tree svg{position:absolute;inset:0;width:100%;height:100%}
@media(max-width:720px){.tree{display:none}.hero-lede{margin-bottom:26px}}

/* 메뉴 카드 (랜딩) */
.menu{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;padding-bottom:56px}
.card{
  position:relative;background:var(--paper);border:1px solid var(--line);
  border-radius:var(--radius);padding:22px 16px 20px;text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:12px;
  transition:transform .18s,box-shadow .18s,border-color .18s;
}
.card:hover{transform:translateY(-4px);border-color:var(--tint);box-shadow:0 14px 28px -18px rgba(36,31,26,.34)}
.card .pill{font-size:.78rem;font-weight:700;color:var(--tint);background:var(--wash);padding:5px 14px;border-radius:20px}
.card .ico{width:46px;height:46px}
.card .ico svg{width:100%;height:100%;display:block}
.card .cap{font-size:.79rem;color:var(--muted);line-height:1.55}
.no{
  position:absolute;left:12px;bottom:12px;width:19px;height:19px;border-radius:50%;
  background:var(--badge);color:var(--badge-ink);font-size:.65rem;font-weight:700;
  display:flex;align-items:center;justify-content:center;line-height:1;
}
@media(max-width:720px){.menu{grid-template-columns:repeat(2,1fr);padding-bottom:44px}.card{padding:18px 14px 16px}}
@media(max-width:400px){.menu{grid-template-columns:1fr}}

/* ── 섹션 ─────────────────────────────── */
.sect{padding-block:68px;border-top:1px solid var(--line)}
.sect.tinted{background:var(--cream)}
.head{margin-bottom:30px}
.head h2{color:var(--ink);font-size:clamp(1.5rem,3.6vw,2.1rem);line-height:1.3}
.head p{margin-top:8px;color:var(--muted);font-size:.94rem;max-width:42em}
.head-row{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.head-row h2{color:var(--ink);font-size:clamp(1.4rem,3.4vw,1.9rem);line-height:1.3}
.head-row .count{font-size:.86rem;color:var(--muted);font-variant-numeric:tabular-nums}
@media(max-width:640px){.sect{padding-block:50px}}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:13px 26px;border-radius:26px;font-size:.94rem;font-weight:500;transition:.16s}
.btn.solid{background:var(--ink);color:var(--paper)}
.btn.solid:hover{opacity:.86}
.btn.plain{background:var(--paper);color:var(--ink);border:1px solid var(--line)}
.btn.plain:hover{border-color:var(--ink)}
.btn.small{padding:8px 16px;font-size:.84rem}

.pill{display:inline-flex;align-items:center;font-size:.76rem;font-weight:700;padding:5px 13px;border-radius:20px;background:var(--wash);color:var(--tint);line-height:1.3}
.mini{display:inline-flex;align-items:center;font-size:.72rem;padding:3px 9px;border-radius:14px;background:var(--wash,var(--b-gray));color:var(--tint,var(--c-gray));font-weight:500;line-height:1.4}
.mini.gray{--tint:var(--c-gray);--wash:var(--b-gray)}
.mini.pin{--tint:var(--badge-ink);--wash:var(--badge)}

/* ── 게시판: 상단 카드 3개 ─────────────── */
.feature{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;padding-bottom:56px}
.fcard{
  position:relative;background:var(--paper);border:1px solid var(--line);border-radius:var(--radius);
  overflow:hidden;display:flex;flex-direction:column;cursor:pointer;text-align:left;
  transition:transform .18s,box-shadow .18s,border-color .18s;
}
.fcard:hover{transform:translateY(-4px);border-color:var(--tint);box-shadow:0 14px 28px -18px rgba(36,31,26,.34)}
.fcard .shot{aspect-ratio:16/10;background:var(--sunken);display:flex;align-items:center;justify-content:center;overflow:hidden}
.fcard .shot img{width:100%;height:100%;object-fit:cover}
.fcard .shot .choco-img{width:28%;height:auto;object-fit:contain;opacity:.85}
.fcard .txt{padding:18px 20px 46px;display:flex;flex-direction:column;gap:8px;flex:1}
.fcard .tags{display:flex;gap:6px;flex-wrap:wrap}
.fcard .ttl{color:var(--ink);font-size:1.06rem;font-weight:700;line-height:1.45;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.fcard .desc{font-size:.87rem;line-height:1.7;color:var(--body);
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.fcard .date{position:absolute;right:18px;bottom:14px;font-size:.8rem;color:var(--muted);font-variant-numeric:tabular-nums}
.fcard .no{left:18px;bottom:15px}
.fcard.ghost{cursor:default;border-style:dashed;background:transparent}
.fcard.ghost:hover{transform:none;box-shadow:none;border-color:var(--line)}
.fcard.ghost .shot{background:transparent}
.fcard.ghost .shot .choco-img{opacity:.35}
.fcard.ghost .txt{align-items:center;justify-content:center;padding:16px 20px 22px}
.fcard.ghost .desc{color:var(--muted)}
.feature-empty{grid-column:1/-1;background:var(--paper);border:1px dashed var(--line);border-radius:var(--radius);
  padding:40px 20px;text-align:center;color:var(--muted);font-size:.93rem}
.feature-empty .choco-img{width:70px;margin:0 auto 12px;opacity:.8}
@media(max-width:860px){.feature{grid-template-columns:1fr 1fr}.feature .fcard:nth-child(3){display:none}}
@media(max-width:560px){
  .feature{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;padding-bottom:40px;
    margin-inline:-20px;padding-inline:20px;scrollbar-width:none}
  .feature::-webkit-scrollbar{display:none}
  .feature .fcard{flex:0 0 82%;scroll-snap-align:center}
  .feature .fcard:nth-child(3){display:flex}
  .feature .fcard:hover{transform:none}
  .feature-empty{flex:1 0 100%}
}

/* ── 게시판: 목록 ─────────────────────── */
.tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:20px}
.tabs button{padding:8px 16px;font-size:.87rem;font-weight:500;color:var(--muted);border:1px solid var(--line);border-radius:20px;transition:.15s;background:var(--paper)}
.tabs button:hover{color:var(--ink);border-color:var(--ink)}
.tabs button[aria-pressed="true"]{background:var(--ink);color:var(--paper);border-color:var(--ink);font-weight:700}

.board{border-top:2px solid var(--ink)}
.row{
  display:grid;grid-template-columns:76px 1fr 108px;gap:18px;align-items:center;
  padding:18px 6px;border-bottom:1px solid var(--line-soft);cursor:pointer;transition:background .14s;
}
.row:hover{background:var(--cream)}
.row .thumb{width:76px;aspect-ratio:1;border-radius:12px;overflow:hidden;background:var(--sunken);display:flex;align-items:center;justify-content:center}
.row .thumb img{width:100%;height:100%;object-fit:cover}
.row .thumb .choco-img{width:44px;height:auto;object-fit:contain;opacity:.6}
.row .mid{min-width:0;display:flex;flex-direction:column}
.row .tt{color:var(--ink);font-size:1rem;font-weight:500;line-height:1.5}
.row .ex{font-size:.87rem;color:var(--muted);margin-top:3px;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.row .meta{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:7px}
.row .date{font-size:.85rem;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums}
@media(max-width:640px){
  .row{grid-template-columns:60px 1fr;gap:14px;align-items:start}
  .row .thumb{width:60px}
  .row .date{grid-column:2;text-align:left;margin-top:-6px}
}
.state{padding:64px 10px;text-align:center;color:var(--muted);font-size:.93rem}
.state .choco-img{width:72px;margin:0 auto 14px;opacity:.7}

.pager{display:flex;justify-content:center;gap:6px;margin-top:28px;flex-wrap:wrap}
.pager button{min-width:38px;height:38px;padding:0 10px;border-radius:19px;font-size:.88rem;color:var(--body);font-variant-numeric:tabular-nums;transition:.15s}
.pager button:hover{background:var(--sunken);color:var(--ink)}
.pager button[aria-current="page"]{background:var(--ink);color:var(--paper);font-weight:700}
.pager button[disabled]{opacity:.35;cursor:default;background:none}

/* ── 글 보기 창 ───────────────────────── */
.sheet{position:fixed;inset:0;z-index:60}
.sheet .veil{position:absolute;inset:0;background:var(--veil)}
.sheet .box{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:min(720px,calc(100% - 32px));max-height:min(88vh,900px);overflow:auto;
  background:var(--paper);border-radius:20px;padding:30px 28px 30px;
}
.sheet .tags{display:flex;gap:6px;flex-wrap:wrap;padding-right:40px}
.sheet h2{color:var(--ink);font-size:clamp(1.25rem,3.4vw,1.7rem);line-height:1.36;margin:12px 0 6px;text-wrap:balance}
.sheet .when{font-size:.85rem;color:var(--muted);font-variant-numeric:tabular-nums}
.sheet .pic{border-radius:14px;margin:18px 0 4px;width:100%}
.sheet .bodytext{font-size:.98rem;line-height:1.9;white-space:pre-line;margin-top:14px;color:var(--body)}
.sheet .hashes{display:flex;gap:6px;flex-wrap:wrap;margin-top:22px}
.sheet .foot{display:flex;justify-content:flex-end;gap:8px;margin-top:24px;padding-top:18px;border-top:1px solid var(--line-soft)}
.sheet .x{position:absolute;right:16px;top:14px;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}
.sheet .x:hover{background:var(--sunken);color:var(--ink)}
@media(max-width:560px){.sheet .box{padding:24px 20px}}

.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,16px);z-index:80;
  background:var(--ink);color:var(--paper);padding:11px 20px;border-radius:22px;font-size:.87rem;font-weight:500;
  opacity:0;pointer-events:none;transition:.22s;margin-bottom:env(safe-area-inset-bottom,0px)}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* ── 푸터 ─────────────────────────────── */
.site-footer{border-top:1px solid var(--line);padding-block:40px 52px;background:var(--cream)}
.fgrid{display:flex;justify-content:space-between;gap:28px;flex-wrap:wrap}
.fbrand{display:flex;align-items:center;gap:9px;margin-bottom:10px}
.fbrand .logomark{width:34px}
.fbrand b{font-family:"Black Han Sans",sans-serif;font-weight:400;color:var(--ink);font-size:1.02rem}
.site-footer .info{font-size:.85rem;color:var(--muted);line-height:1.9}
.site-footer .info a:hover{color:var(--ink)}
.site-footer .links{display:flex;gap:18px;font-size:.88rem;flex-wrap:wrap;align-items:flex-start}
.site-footer .links a:hover{color:var(--ink)}
.copy{margin-top:26px;padding-top:18px;border-top:1px solid var(--line);font-size:.78rem;color:var(--muted)}
