/* ===== 메인 홈 전용 스타일 (토큰·리셋은 base.css, 상단바·사이드바는 shell.css) ===== */

.main.main--home {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
  padding: 6px 16px 6px;
  gap: 6px;
  overflow: hidden;
}

/* ===== 히어로 ===== */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex: none;
}

.hero__copy { min-width: 0; }

.hero__title {
  font-size: clamp(16px, 1.5vw, 19px);
  font-weight: 800;
  letter-spacing: -.7px;
  color: #1e3a8a;
  line-height: 1.35;
}
.hero__sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.hero__mascot {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  width: auto;
  height: auto;
  flex: none;
  margin-left: auto;
}
.robot {
  width: 50px;
  height: auto;
  flex: none;
  stroke: none;
  animation: float 4.2s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.bubble {
  position: relative;
  z-index: 1;
  margin-left: -10px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}
.bubble::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-right-color: #fff;
  transform: translateY(-50%);
}

/* ===== 섹션 ===== */
.block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
}
.block--subjects {
  flex: 1 1 auto;
  min-height: 0;
}
.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.block__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 1.35;
}
.block__more {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
}
.block__more:hover { color: var(--primary); }

.grid { display: grid; gap: 6px; }
.grid--board {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  align-content: stretch;
  gap: 6px;
}

/* ===== 과목 카드 ===== */
a.card {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 7px 10px 6px;
  border: 1px solid #cfe0ff;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-lg);
}

.card__title {
  flex: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__cta {
  display: flex;
  align-items: center;
  flex: none;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__cta svg { width: 13px; height: 13px; stroke-width: 2.2; transition: transform .16s; }
.card:hover .card__cta svg { transform: translateX(3px); }

.card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex: none;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}
.card__meta {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}
.card__emoji {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 7px;
  background: var(--primary-soft);
  font-size: 13px;
  line-height: 1;
}

.card--ai {
  background: linear-gradient(160deg, #dbeafe, #ffffff);
}
.card--ai .card__cta { color: var(--primary); }
.card--ai .card__emoji { background: #bfdbfe; }
.card--ai:hover { box-shadow: 0 16px 40px rgba(37, 99, 235, .16); }
.card.is-locked { opacity: .55; }

.card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}
.card--ai .card__title { padding-right: 36px; }

/* ===== 기능 카드 ===== */
.feature {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 7px 10px 6px;
  border: 1px solid #cfe0ff;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.feature:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-lg);
}
.feature.is-locked {
  opacity: .55;
}
.feature__title {
  flex: none;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature__desc {
  flex: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature__cta {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
  margin-top: auto;
  padding-top: 0;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 18px;
}
.feature__cta svg { width: 13px; height: 13px; stroke-width: 2.2; transition: transform .16s; }
.feature:hover .feature__cta svg { transform: translateX(3px); }

/* ===== 하단 배너 ===== */
.promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
  padding: 5px 12px;
  border-radius: var(--radius);
  background: #1e3a8a;
  color: #fff;
  box-shadow: 0 10px 24px rgba(30, 58, 138, .28);
  flex: none;
}
.promo__eyebrow {
  color: #bfdbfe;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
}
.promo__title {
  margin-top: 1px;
  font-size: clamp(13px, 1.3vw, 15px);
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.3;
  color: #fff;
}
.promo__sub {
  margin-top: 1px;
  color: #dbeafe;
  font-size: 11px;
  line-height: 1.3;
}
.promo__cta {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .14s, box-shadow .14s, background .14s;
}
.promo__cta:hover {
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .16);
}

/* ===== 푸터 ===== */
.footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 2px;
  padding-top: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  flex: none;
}
.footer > p {
  margin: 0;
  white-space: nowrap;
}
.footer__links {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  justify-self: end;
}
.footer__links a,
.footer__links button { color: var(--text-muted); font-size: 11.5px; font-weight: 600; text-decoration: none; }
.footer__links a:hover,
.footer__links button:hover { color: var(--primary); text-decoration: underline; }
.footer__biz {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-muted);
}
.footer__biz-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.footer__biz span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.footer__biz a {
  color: inherit;
  text-decoration: none;
}
.footer__biz a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ===== 이용약관 ===== */
.legal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(16, 21, 31, .52);
}
.legal[hidden] { display: none !important; }
.legal__panel {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(86vh, 880px);
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.legal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.legal__title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.legal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
}
.legal__close:hover { background: #f3f6fb; color: var(--text); }
.legal__body {
  padding: 18px 22px 24px;
  overflow: auto;
  color: #243044;
  font-size: 14px;
  line-height: 1.7;
}
.legal__lead {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.legal__body h3 {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 800;
}
.legal__body h3:first-of-type { margin-top: 0; }
.legal__body p { margin: 0 0 8px; }
.legal__body ul {
  margin: 0 0 10px;
  padding-left: 18px;
}
.legal__body li { margin: 0 0 6px; }
.legal__date {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}
body.is-legal-open { overflow: hidden; }

/* ===== 반응형 ===== */
@media (max-height: 820px) and (max-width: 860px) {
  .hero__title { font-size: 16px; }
  .hero__sub { display: none; }
  .promo__sub { display: none; }
  .promo { padding: 5px 12px; }
}

/* 노트북·PC: 카드를 화면에 억지로 늘리지 않고 글자·여백을 키운다 */
@media (min-width: 861px) {
  .main.main--home {
    justify-content: flex-start;
    height: 100%;
    padding: 20px 28px 18px;
    gap: 14px;
    overflow: auto;
  }
  .main.main--home .hero,
  .main.main--home .block,
  .main.main--home .promo,
  .main.main--home .footer {
    width: 100%;
    max-width: 1180px;
  }
  .hero { gap: 20px; }
  .hero__title {
    font-size: 24px;
    letter-spacing: -.6px;
    line-height: 1.4;
  }
  .hero__sub {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
  }
  .robot { width: 72px; }
  .bubble {
    margin-left: -6px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.45;
  }
  .block { gap: 8px; overflow: visible; }
  .block--subjects { flex: 0 0 auto; }
  .block__title { font-size: 16px; }
  .block__more { font-size: 13.5px; }
  .grid { gap: 12px; }
  .grid--board {
    height: auto;
    grid-template-rows: auto;
    gap: 12px;
  }
  .card,
  .feature {
    height: auto;
    min-height: 108px;
    padding: 16px 18px 14px;
    gap: 6px;
  }
  .card__title {
    font-size: 18px;
    line-height: 1.35;
  }
  .card__cta {
    font-size: 14px;
    line-height: 1.35;
  }
  .card__meta {
    font-size: 13.5px;
    line-height: 1.35;
  }
  .card__emoji {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }
  .feature__title {
    font-size: 16px;
    line-height: 1.35;
  }
  .feature__desc {
    font-size: 13.5px;
    line-height: 1.45;
    white-space: normal;
  }
  .feature__cta { font-size: 14px; }
  .promo { padding: 14px 20px; }
  .promo__eyebrow { font-size: 12px; }
  .promo__title {
    font-size: 18px;
    line-height: 1.4;
  }
  .promo__sub {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
  }
  .promo__cta {
    padding: 9px 16px;
    font-size: 14px;
  }
  .footer {
    font-size: 12.5px;
    line-height: 1.5;
    padding-top: 4px;
  }
  .footer > p { white-space: normal; }
  .footer__links a,
  .footer__links button { font-size: 13px; }
  .footer__biz { font-size: 12px; line-height: 1.5; }
}

@media (max-width: 860px) {
  .main.main--home { padding: 10px 12px 10px; overflow: auto; }
  .grid--board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    height: auto;
  }
  .card, .feature { min-height: 76px; height: auto; }
}

@media (max-width: 660px) {
  .promo { flex-direction: column; align-items: flex-start; }
  .footer { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .grid--board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
