/* 첫 화면(index.html) 모양 — 2026-10-24 새 모양(시안 tools/portal-preview.html).
   style.css는 수업 세션 페이지와 같이 쓰고 관리자 칸(명예의 전당·통계)도 그대로 그것으로 그리므로 함께 읽는다.
   style.css와 겹치는 건 body뿐이라 body.home으로 덮는다. */
:root {
  --ink: #1b2440;
  --ink-2: #4a5470;
  --ink-3: #7a8299;
  --blue: #1a68e6;
  --blue-dark: #1456c2;
  --orange: #f28c28;
  --cream: #fbf7f0;
  --cream-2: #f4ede1;
  --line: #e7e0d3;
  --radius: 18px;
}

html { scroll-behavior: smooth; }
body.home {
  display: block;
  min-height: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Pretendard, -apple-system, 'Malgun Gothic', sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.home a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* 머리줄. 로고 칸(#logo-badge)은 7번 누르면 관리자 로그인이 열린다(portal.js) */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251, 247, 240, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.nav-logo { display: block; cursor: default; -webkit-tap-highlight-color: transparent; }
.nav-logo img { display: block; height: 38px; width: auto; }
.nav-links { display: flex; gap: 22px; margin-left: auto; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px;
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
body.home .btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(26, 104, 230, 0.25); }
body.home .btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
body.home .btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
body.home .btn-ghost:hover { border-color: #cfc5b3; }
.nav .btn { padding: 9px 16px; font-size: 14px; }

/* 첫머리 */
.hero { padding: 72px 0 64px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: #fff1e2; color: #c2620c; font-size: 13px; font-weight: 700; letter-spacing: 0.2px;
}
.hero h1 {
  margin: 18px 0;
  font-size: clamp(34px, 4.6vw, 52px); line-height: 1.22; font-weight: 800; letter-spacing: -1.2px;
}
.hero h1 em { font-style: normal; color: var(--blue); }
.hero p.lead { font-size: 18px; line-height: 1.65; color: var(--ink-2); max-width: 30em; }
.hero-actions { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }
.hero-notes { display: flex; gap: 18px; margin-top: 22px; font-size: 14px; color: var(--ink-3); flex-wrap: wrap; }
.hero-notes span::before { content: '✓'; color: var(--orange); font-weight: 800; margin-right: 6px; }

.collage { position: relative; aspect-ratio: 5 / 4; }
.collage img {
  position: absolute; width: 66%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 16px; border: 4px solid #fff;
  box-shadow: 0 18px 40px rgba(27, 36, 64, 0.18);
}
.collage .c1 { left: 0; top: 4%; transform: rotate(-5deg); }
.collage .c2 { right: 0; top: 18%; transform: rotate(4deg); }
.collage .c3 { left: 16%; bottom: 2%; width: 72%; transform: rotate(-1deg); z-index: 1; }

/* 숫자 띠(portal-home.js가 채운다, 못 읽으면 숨김) */
.stats { padding: 0 0 56px; }
.stats[hidden] { display: none; }
.stats .wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.stat { text-align: center; padding: 6px 12px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font-size: clamp(30px, 3.6vw, 42px); line-height: 1.2; font-weight: 800; letter-spacing: -1px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat > span { display: block; margin-top: 4px; font-size: 15px; color: var(--ink-2); }
.stats-note { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-3); }

/* 숫자 촤르륵: 자리마다 0~9 띠(.strip)를 굴려 멈춘다(portal-home.js). 띠 한 칸 높이 1.2em은 스크립트와 맞춘다 */
.roll { display: inline-block; white-space: nowrap; }
.roll .digit {
  display: inline-block; vertical-align: top;
  height: 1.2em; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.roll .digit.done { -webkit-mask-image: none; mask-image: none; }
.roll .strip { display: block; will-change: transform; }
.roll .strip span { display: block; height: 1.2em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 스크롤 등장. js-motion은 portal-home.js가 붙인다(동작 줄이기를 켠 기기나 스크립트가 안 돌면 처음부터 다 보인다) */
.js-motion .reveal { opacity: 0; translate: 0 28px; }
.js-motion .reveal.in {
  opacity: 1; translate: 0 0;
  transition: opacity 0.7s ease var(--d, 0s), translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s);
}
/* 카드는 마우스 올림 효과(transform·box-shadow)를 지키며 더한다 */
.js-motion .card.reveal.in {
  transition: transform 0.2s, box-shadow 0.2s,
    opacity 0.7s ease var(--d, 0s), translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s);
}
/* 동작 줄이기(motion-reduce, portal-home.js가 붙인다): 위아래 움직임 없이 0.3초 흐려졌다 나타나기만. 숫자도 굴리지 않고 흐려졌다 나타난다 */
.js-motion.motion-reduce .reveal, .js-motion.motion-reduce .collage img.reveal { translate: none; scale: none; }
.js-motion.motion-reduce .reveal.in, .js-motion.motion-reduce .collage img.reveal.in { transition: opacity 0.3s ease var(--d, 0s); }
.js-motion.motion-reduce .card.reveal.in, .js-motion.motion-reduce .tool-card.reveal.in {
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s ease var(--d, 0s);
}
.num-fade { opacity: 0; }
.num-fade.in { opacity: 1; transition: opacity 0.3s ease; }
/* 콜라주 그림은 기울기(transform: rotate)를 그대로 두고 툭 떨어지듯 */
.js-motion .collage img.reveal { translate: 0 40px; scale: 0.94; }
.js-motion .collage img.reveal.in {
  scale: 1;
  transition: opacity 0.6s ease var(--d, 0s), translate 0.9s cubic-bezier(0.18, 1.25, 0.4, 1) var(--d, 0s),
    scale 0.9s cubic-bezier(0.18, 1.25, 0.4, 1) var(--d, 0s);
}

/* 구역 공통 */
section.block { padding: 72px 0; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.kicker { font-size: 13px; font-weight: 800; color: var(--orange); letter-spacing: 1px; }
.block h2 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -0.8px; margin-top: 6px; }
.block-sub { color: var(--ink-2); margin-top: 8px; font-size: 16px; }

/* 게임 */
.games { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 6px; background: var(--cream); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.filters button {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2);
  border: 0; background: none; padding: 8px 16px; border-radius: 9px; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(27, 36, 64, 0.12); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(27, 36, 64, 0.12); }
/* hidden은 portal.js(관리자 전용 카드)가, filtered-out은 학년 거르기가 쓴다 */
.card[hidden], .card.filtered-out { display: none; }
.cover { aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(135deg, #e6f0ff, #fdeedd); position: relative; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.card:hover .cover img { transform: scale(1.04); }
.cover-emoji { display: flex; align-items: center; justify-content: center; font-size: 64px; }
.badge-new {
  position: absolute; left: 12px; top: 12px; z-index: 1;
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px;
}
.badge-admin { background: var(--ink); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips span { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--cream-2); color: var(--ink-2); }
.chips .grade { background: #e6efff; color: var(--blue); }
.card h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.35; }
.card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin-top: 8px; }
.card .go {
  margin-top: auto; padding-top: 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 15px; color: var(--blue);
}
.card .go::after { content: '→'; transition: transform 0.2s; }
.card:hover .go::after { transform: translateX(4px); }

/* 수업 진행 */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: step; }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; }
.step::before {
  counter-increment: step; content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 800; margin-bottom: 16px;
}
.step h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.step p { font-size: 15px; color: var(--ink-2); line-height: 1.6; margin-top: 8px; }

/* 선생님 도구: 그림 칸 + 설명의 가로 카드(폰에서는 세로) */
section.block.tools-block { padding-top: 0; }
.tool-list { display: grid; gap: 22px; }
.tool-card {
  display: grid; grid-template-columns: 300px 1fr;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(27, 36, 64, 0.12); }
.js-motion .tool-card.reveal.in {
  transition: transform 0.2s, box-shadow 0.2s,
    opacity 0.7s ease var(--d, 0s), translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s);
}
.tool-visual {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e6f0ff, #fdeedd); min-height: 190px;
}
.tool-visual svg { width: 70%; max-width: 220px; height: auto; transition: transform 0.4s; }
.tool-card:hover .tool-visual svg { transform: scale(1.05); }
.tool-body { padding: 24px 28px; display: flex; flex-direction: column; }
.tool-card h3 { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.35; }
.tool-card p { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin-top: 8px; max-width: 40em; }
.tool-card .go {
  margin-top: auto; padding-top: 18px;
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; color: var(--blue);
}
.tool-card .go::after { content: '→'; transition: transform 0.2s; }
.tool-card:hover .go::after { transform: translateX(4px); }

/* 만든 사람 */
section.block.maker-block { padding-top: 0; }
.maker {
  display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 32px 36px;
}
.maker-logo { width: 200px; height: auto; }
.maker h2 { margin-top: 4px; }
.maker p { color: var(--ink-2); line-height: 1.7; margin-top: 10px; font-size: 16px; }
.maker .maker-role { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--orange); }

/* 관리자 칸(로그인해야 보임): 예전 모양 그대로 흰 판 위에 */
.admin-area > section:not([hidden]) {
  margin-top: 32px; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 28px;
}
.admin-area:has(> section:not([hidden])) { padding-bottom: 40px; }

/* 맨 아래 줄: 이름 · 만든 사람 · 이메일 · 이용약관 · 개인정보처리방침(골목 오락실 형식) */
.site-footer { background: var(--ink); color: #c9cfdf; font-size: 14px; padding: 26px 0; margin-top: 24px; }
.site-footer .wrap { display: flex; gap: 8px 22px; align-items: center; flex-wrap: wrap; }
.foot-brand { font-size: 19px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
body.home .foot-mail { color: #c9cfdf; }
body.home .foot-mail:hover { color: #fff; text-decoration: underline; }
body.home .foot-terms, body.home .foot-privacy { color: #9aa3bb; }
body.home .foot-terms:hover, body.home .foot-privacy:hover { color: #fff; }
body.home .foot-terms { margin-left: auto; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .collage { max-width: 520px; width: 100%; margin: 0 auto; }
  .grid, .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .nav .wrap { justify-content: space-between; }
  .nav-logo img { height: 32px; }
  .hero { padding: 40px 0 44px; }
  .hero p.lead { font-size: 16px; }
  section.block { padding: 52px 0; }
  .grid, .steps { grid-template-columns: 1fr; }
  .stats { padding-bottom: 40px; }
  .stat { padding: 4px 6px; }
  .stat strong { font-size: 24px; }
  .stat > span { font-size: 12.5px; }
  .tool-card { grid-template-columns: 1fr; }
  .tool-visual { min-height: 150px; }
  .tool-body { padding: 18px 20px 20px; }
  .maker { grid-template-columns: 1fr; padding: 26px 22px; }
  .maker-logo { width: 160px; }
  .admin-area > section:not([hidden]) { padding: 18px 14px; }
}
