:root {
  --color-bg: #f4f7fb;
  --color-surface: #ffffff;
  --color-primary: #1f4ea3;
  --color-primary-dark: #173a7c;
  --color-text: #1c2a3a;
  --color-subtext: #5a6d84;
  --color-border: #d9e2ef;
  --color-chip: #e8effa;
  --color-footer: #0f1f35;
  --shadow-soft: 0 12px 30px rgba(18, 42, 76, 0.08);
  --shadow-card: 0 10px 24px rgba(18, 42, 76, 0.09);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--color-text);
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif;
  line-height: 1.6;
  background: linear-gradient(180deg, #f6f9ff 0%, #f3f7fc 60%, #f6f9ff 100%);
}

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

.section {
  padding: 4.5rem 0;
  scroll-margin-top: 88px;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 0 0 10px 10px;
}

.skip-link:focus {
  left: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(248, 251, 255, 0.95);
  border-bottom: 1px solid rgba(31, 78, 163, 0.12);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-primary-dark);
}

.logo-icon {
  flex-shrink: 0;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.2rem;
  font-size: 0.97rem;
  font-weight: 600;
  color: #2a3e57;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--color-primary);
  border-color: rgba(31, 78, 163, 0.5);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: #1d3557;
  border-radius: 99px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.hero {
  padding-top: 5.5rem;
  background: radial-gradient(circle at 15% 20%, rgba(71, 131, 255, 0.16), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(30, 89, 179, 0.12), transparent 38%);
}

.hero-inner {
  max-width: 840px;
}

.hero-badge {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: rgba(31, 78, 163, 0.1);
}

.hero h1 {
  margin: 0.9rem 0 0;
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  line-height: 1.22;
  letter-spacing: -0.03em;
  color: #10233d;
}

.hero-description {
  margin: 1rem 0 0;
  color: var(--color-subtext);
  max-width: 760px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.search-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--color-text);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.search-form input:focus {
  outline: 2px solid rgba(31, 78, 163, 0.32);
  border-color: var(--color-primary);
}

.search-form button {
  min-height: 52px;
  padding: 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-weight: 700;
  color: #29466e;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.search-form button:hover,
.search-form button:focus-visible {
  color: var(--color-primary);
  border-color: rgba(31, 78, 163, 0.48);
}

#search-submit {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

#search-submit:hover,
#search-submit:focus-visible {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.2rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #214e9f 0%, #1a3f81 100%);
  box-shadow: 0 10px 22px rgba(27, 65, 129, 0.26);
}

.btn-secondary {
  color: var(--color-primary-dark);
  border: 1px solid rgba(31, 78, 163, 0.28);
  background: rgba(255, 255, 255, 0.9);
}

.ad-wrap {
  padding: 0.5rem 0 0;
}

.ad-wrap-bottom {
  padding: 0 0 2rem;
}

.ad-placeholder {
  border: 1px dashed #9eb4cf;
  border-radius: 14px;
  min-height: 94px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #4f6b8d;
  background: rgba(223, 233, 247, 0.5);
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  letter-spacing: -0.02em;
  color: #132a48;
}

.section-head p {
  margin: 0.6rem 0 0;
  color: var(--color-subtext);
}

.category-shortcuts {
  padding-top: 3.4rem;
  padding-bottom: 2.3rem;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.chip {
  border: 1px solid transparent;
  background: var(--color-chip);
  color: #2f4e75;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover,
.chip:focus-visible {
  border-color: rgba(31, 78, 163, 0.4);
  color: var(--color-primary-dark);
}

.chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #1f4ea3 0%, #173b7c 100%);
}

.calculators {
  padding-top: 2.7rem;
}

.result-count {
  margin: 1rem 0 0;
  font-weight: 700;
  color: #2b4667;
}

.calculator-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.calculator-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.calculator-card:hover,
.calculator-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(31, 78, 163, 0.45);
}

.card-category {
  align-self: flex-start;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.24rem 0.58rem;
  border-radius: 999px;
  color: var(--color-primary-dark);
  background: #e8f0fd;
}

.calculator-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.calculator-card p {
  margin: 0;
  color: var(--color-subtext);
  font-size: 0.95rem;
}

.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  align-self: flex-start;
  min-height: 40px;
  padding: 0.2rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(31, 78, 163, 0.3);
  color: var(--color-primary-dark);
  font-weight: 700;
  transition: all 0.2s ease;
}

.card-link:hover,
.card-link:focus-visible {
  color: #fff;
  border-color: transparent;
  background: var(--color-primary);
}

.calculator-ad {
  grid-column: 1 / -1;
  min-height: 100px;
  border-radius: 14px;
  border: 1px dashed #9eb4cf;
  display: grid;
  place-items: center;
  color: #4f6b8d;
  font-weight: 700;
  background: rgba(220, 230, 244, 0.55);
}

.no-result {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #eaf1fb;
  color: #2e4a6e;
}

.recommended {
  padding-top: 3rem;
}

.recommended-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.highlight-card {
  padding: 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid #cfdbed;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
  box-shadow: var(--shadow-card);
}

.highlight-card h3 {
  margin: 0;
  font-size: 1.04rem;
}

.highlight-card p {
  margin: 0.6rem 0 0;
  color: var(--color-subtext);
  font-size: 0.94rem;
}

.highlight-card a {
  display: inline-flex;
  margin-top: 0.75rem;
  color: var(--color-primary);
  font-weight: 700;
}

.guides {
  background: rgba(226, 236, 249, 0.32);
}

.guide-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.guide-card {
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid #d2ddec;
  background: #fff;
}

.guide-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2e4f7c;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  background: #ecf3ff;
}

.guide-card h3 {
  margin: 0.65rem 0 0;
  font-size: 1.04rem;
}

.guide-card p {
  margin: 0.6rem 0 0;
  color: var(--color-subtext);
  font-size: 0.94rem;
}

.guide-card a {
  display: inline-flex;
  margin-top: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

.faq {
  padding-top: 3.2rem;
}

.faq-list {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.7rem;
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.faq-item h3 {
  margin: 0;
}

.faq-question {
  width: 100%;
  padding: 1rem;
  border: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  color: #1f334d;
  cursor: pointer;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  color: #40699c;
  line-height: 1;
}

.faq-question[aria-expanded="true"]::after {
  content: "−";
}

.faq-answer {
  padding: 0 1rem 1rem;
}

.faq-answer p {
  margin: 0;
  color: var(--color-subtext);
}

.site-footer {
  background: var(--color-footer);
  color: #d8e3f4;
  padding-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.2rem;
}

.footer-about {
  max-width: 620px;
}

.footer-about strong {
  color: #fff;
  font-size: 1.05rem;
}

.footer-about p {
  margin: 0.7rem 0 0;
  color: #bdd0ea;
}

.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-content: flex-start;
}

.footer-links a {
  color: #d9e7fb;
  font-weight: 600;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: #fff;
}

.copyright {
  margin: 0;
  padding: 1rem 0 1.4rem;
  border-top: 1px solid rgba(196, 216, 241, 0.23);
  text-align: center;
  font-size: 0.92rem;
  color: #aac1de;
}

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

  .recommended-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .section {
    padding: 3.8rem 0;
  }

  .header-inner {
    position: relative;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    width: min(320px, 92vw);
    padding: 0.8rem;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: #fff;
    box-shadow: var(--shadow-soft);
    display: none;
  }

  .site-nav.open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .site-nav a {
    width: 100%;
    padding: 0.55rem 0.45rem;
    border-radius: 9px;
    border-bottom: 0;
  }

  .site-nav a:hover,
  .site-nav a:focus-visible {
    background: #eff4fc;
  }

  .hero {
    padding-top: 4.7rem;
  }
}

@media (max-width: 768px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 540px) {
  .calculator-grid,
  .recommended-grid {
    grid-template-columns: 1fr;
  }

  .chip {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }

  .hero-description,
  .section-head p {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
