/* 공통 디자인: 한지 바탕 + 원고지 칸 + 랙돌의 색(크림·갈색 포인트·파란 눈·분홍 코) */

:root {
  --paper: #fbf7ee;
  --paper-2: #f5eedf;
  --paper-3: #ede3d0;
  --card: #fffdf8;
  --ink: #2c2521;
  --ink-2: #5a4e45;
  --ink-3: #8b7e72;
  --line: #e3d8c5;
  --line-2: #d2c4ad;
  --seal: #5b4034;

  --blue: #2c6bd9;
  --blue-deep: #1e4fa6;
  --blue-soft: #e4eefd;
  --coral: #e8604c;
  --coral-deep: #c4452f;
  --coral-soft: #fce6e1;
  --mint: #2e9e6b;
  --mint-deep: #1f7a50;
  --mint-soft: #ddf3e7;
  --amber: #e9a23b;
  --amber-soft: #fbefd5;
  --pink: #f29ba5;
  --violet: #7a5cc9;
  --violet-soft: #ece6fa;
  --grid: #e9b7ac; /* 원고지 줄 */

  --shadow-1: 0 1px 2px rgba(74, 51, 41, 0.06), 0 4px 14px rgba(74, 51, 41, 0.06);
  --shadow-2: 0 2px 4px rgba(74, 51, 41, 0.06), 0 14px 36px rgba(74, 51, 41, 0.12);
  --radius: 18px;
  --radius-s: 12px;

  --font-display: 'Gowun Batang', 'Nanum Myeongjo', 'Batang', serif;
  --font-body: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;

  --wrap: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(var(--wrap), 100% - 40px);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ───── 글자 ───── */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--coral-deep);
}

/* ───── 버튼 ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 3px 0 var(--blue-deep);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: #3877e4;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--blue-deep);
}
.btn svg {
  width: 18px;
  height: 18px;
}
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--line-2);
  border: 1.5px solid var(--line-2);
}
.btn.ghost:hover {
  background: #fff;
}
.btn.ghost:active {
  box-shadow: 0 0 0 var(--line-2);
}
.btn.coral {
  background: var(--coral);
  box-shadow: 0 3px 0 var(--coral-deep);
}
.btn.coral:hover {
  background: #ee6f5c;
}
.btn.coral:active {
  box-shadow: 0 0 0 var(--coral-deep);
}
.btn.small {
  min-height: 38px;
  padding: 0 16px;
  font-size: 14px;
}

/* ───── 칩 ───── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* 영역(듣기·말하기 / 읽기 / 쓰기 / 문법 / 문학 / 매체) 색 */
.dom-듣말 { --dom: var(--amber); --dom-soft: var(--amber-soft); --dom-ink: #8a5a0c; }
.dom-읽기 { --dom: var(--blue); --dom-soft: var(--blue-soft); --dom-ink: var(--blue-deep); }
.dom-쓰기 { --dom: var(--mint); --dom-soft: var(--mint-soft); --dom-ink: var(--mint-deep); }
.dom-문법 { --dom: var(--coral); --dom-soft: var(--coral-soft); --dom-ink: var(--coral-deep); }
.dom-문학 { --dom: var(--violet); --dom-soft: var(--violet-soft); --dom-ink: #55409a; }
.dom-매체 { --dom: #2a9db0; --dom-soft: #dcf2f5; --dom-ink: #19707e; }
.dom-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--dom-soft, var(--paper-2));
  color: var(--dom-ink, var(--ink-2));
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ───── 원고지 칸 ───── */
.wongoji {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
}
.wongoji .cell {
  width: 1.5em;
  height: 1.5em;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--grid);
  margin-left: -1.5px;
  background: var(--card);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
}
.wongoji .cell:first-child {
  margin-left: 0;
}

/* ───── 고양이 ───── */
.cat {
  width: 100%;
  height: auto;
  overflow: visible;
}
@keyframes cat-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95.5% {
    transform: scaleY(0.08);
  }
}
.cat-blink .cat-eye {
  animation: cat-blink 5.2s infinite;
}
@keyframes cat-tail {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(7deg);
  }
}
.cat .cat-tail {
  animation: cat-tail 3.6s ease-in-out infinite;
}

/* ───── 읽어 주기 버튼 ───── */
.say-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
  transition: background 0.15s, transform 0.15s;
  flex: none;
}
.say-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.say-btn:hover {
  background: #d3e2fb;
}
.say-btn.is-speaking,
.say-word.is-speaking {
  background: var(--blue);
  color: #fff;
}
.say-word {
  display: inline;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-weight: 700;
  font-family: inherit;
  line-height: inherit;
  border-bottom: 2px solid #b9d0f6;
}
.pron {
  font-weight: 700;
  color: var(--coral-deep);
  white-space: nowrap;
}
mark {
  background: linear-gradient(transparent 55%, #ffe08a 55%);
  color: inherit;
  padding: 0 2px;
}

/* ───── 머리글 ───── */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 247, 238, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  flex: none;
}
.logo .yarn {
  width: 28px;
  height: 28px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.site-nav a {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.site-nav a:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.site-head .btn {
  flex: none;
}
.site-nav a[aria-current='page'] {
  color: var(--ink);
  font-weight: 700;
  background: var(--paper-2);
}
@media (max-width: 1240px) {
  .site-nav a {
    padding: 8px 7px;
    font-size: 14px;
  }
}

/* ───── 휴대폰·태블릿 메뉴 ───── */
.nav-toggle {
  display: none;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--ink);
}
@media (max-width: 1080px) {
  .site-nav {
    display: none;
  }
  .site-head .btn {
    margin-left: auto;
  }
  .nav-toggle {
    display: inline-flex;
  }
}
@media (max-width: 420px) {
  .site-head .btn {
    display: none;
  }
  .nav-toggle {
    margin-left: auto;
  }
}
.nav-locked,
.nav-locked body {
  overflow: hidden;
}
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(44, 37, 33, 0);
  transition: background 0.2s;
}
.nav-drawer.is-open {
  background: rgba(44, 37, 33, 0.45);
}
.nav-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 88vw);
  overflow: auto;
  padding: 16px 16px 24px;
  background: var(--paper);
  box-shadow: -10px 0 40px rgba(44, 37, 33, 0.25);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.nav-drawer.is-open .nav-drawer-panel {
  transform: none;
}
.nav-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.nav-cat {
  display: inline-block;
  width: 34px;
}
.nav-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  font-size: 24px;
  line-height: 1;
}
.nav-drawer ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.nav-drawer li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
}
.nav-drawer li a[aria-current='page'] {
  border-color: var(--coral);
  background: var(--coral-soft);
}
.nav-drawer li a span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.nav-drawer small {
  font-size: 12.5px;
  color: var(--ink-3);
}
.nav-ico {
  font-size: 24px;
  width: 32px;
  text-align: center;
}
.nav-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

/* ───── 맨 위로 ───── */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.to-top.is-on {
  opacity: 0.85;
  transform: none;
  pointer-events: auto;
}
body.is-playing .to-top {
  display: none;
}

/* ───── 바닥글 ───── */
.site-foot {
  margin-top: 96px;
  padding: 36px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.8;
}
.site-foot .logo {
  font-size: 18px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.site-foot a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
