:root {
  color-scheme: light;
  --ink: #1d252c;
  --muted: #5c6672;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --line: #dbe2ea;
  --accent: #0b7285;
  --accent-2: #b07a00;
  --accent-3: #8f3d56;
  --shadow: 0 18px 45px rgba(29, 37, 44, 0.08);
  --sticky-detail-top: 74px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-nav a,
.back-link,
.section-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}

.top-nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--accent);
}

.home-shell,
.detail-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 52px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.2;
}

.hero h1 {
  max-width: 780px;
  font-size: clamp(18px, 3vw, 34px);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.hero-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
}

.hero-stats strong {
  color: var(--accent-3);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 680px;
  margin: 24px 0;
}

.filter-select {
  display: grid;
  flex: 1 1 220px;
  gap: 8px;
  max-width: 320px;
  color: var(--muted);
  font-weight: 700;
}

.filter-select select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.filter-select select:focus {
  outline: 3px solid rgba(11, 114, 133, 0.18);
  border-color: var(--accent);
}

.hero h1 + .filter-row,
.hero h1 + .search-box {
  margin-top: 24px;
}

.filter-row + .search-box {
  margin-top: 18px;
}

.search-box {
  display: grid;
  gap: 8px;
  max-width: 560px;
  color: var(--muted);
  font-weight: 700;
}

.search-box input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.search-box input:focus {
  outline: 3px solid rgba(11, 114, 133, 0.18);
  border-color: var(--accent);
}

.result-count {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 700;
}

.categories {
  display: grid;
  gap: 18px;
  padding-bottom: 72px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  padding-bottom: 72px;
}

.category-section,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.category-section {
  padding: clamp(16px, 3vw, 26px);
}

.category-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.category-head p {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.category-head h2 {
  font-size: clamp(22px, 3vw, 32px);
}

.category-head > span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.course-card,
.info-card,
.portal-card {
  min-height: 116px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.portal-card {
  min-height: 156px;
  align-content: center;
}

.course-card:hover,
.course-card:focus-visible,
.info-card:hover,
.info-card:focus-visible,
.portal-card:hover,
.portal-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(11, 114, 133, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.card-index {
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 900;
}

.course-card strong,
.info-card strong,
.portal-card strong {
  font-size: 18px;
  line-height: 1.3;
  word-break: keep-all;
}

.portal-card strong {
  font-size: clamp(24px, 3vw, 34px);
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.detail-shell {
  padding: 28px 0 72px;
}

.detail-card {
  padding: clamp(18px, 4vw, 44px);
  overflow: visible;
}

.detail-toolbar {
  position: sticky;
  top: var(--sticky-detail-top);
  z-index: 8;
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  padding: 0 0 18px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 76%, rgba(255, 255, 255, 0));
}

.detail-toolbar .back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(29, 37, 44, 0.08);
}

.detail-card h1 {
  margin-top: 8px;
  font-size: clamp(16px, 2.5vw, 28px);
  word-break: keep-all;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.detail-meta span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0;
}

.pager a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #fbfcfe;
  font-weight: 700;
}

.pager a:last-child {
  text-align: right;
}

.course-layout {
  display: grid;
  gap: 26px;
}

.info-panel,
.quote-panel,
.content-section {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.info-panel h2,
.quote-panel h2,
.content-section h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
}

.info-table th,
.info-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.info-table tr:last-child th,
.info-table tr:last-child td {
  border-bottom: 0;
}

.info-table th {
  width: 168px;
  background: #f3f7f9;
  color: var(--muted);
  font-weight: 800;
}

.info-table td p,
.info-table td .content-list {
  margin-top: 0;
  margin-bottom: 0;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

a.pill-link:hover,
a.pill-link:focus-visible {
  border-color: var(--accent);
  color: var(--ink);
  outline: none;
}

.quote-panel blockquote {
  margin: 0;
  border-left: 4px solid var(--accent);
  padding: 8px 0 8px 18px;
  color: #24323b;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.7;
  word-break: keep-all;
}

.section-stack {
  display: grid;
  gap: 20px;
}

.section-body {
  display: grid;
  gap: 12px;
}

.section-body h3 {
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 17px;
  line-height: 1.45;
}

.section-body h3:first-child {
  margin-top: 0;
}

.section-body p {
  margin: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.content-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.content-list li {
  padding-left: 2px;
}

.source-text {
  margin: 22px 0 0;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  color: var(--ink);
  font: 16px/1.75 "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

.source-attribution {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.source-attribution p {
  margin: 0 0 8px;
}

.source-attribution p:last-child {
  margin-bottom: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  :root {
    --sticky-detail-top: 128px;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  .category-head,
  .pager {
    grid-template-columns: 1fr;
  }

  .category-head {
    align-items: start;
    flex-direction: column;
  }

  .pager a:last-child {
    text-align: left;
  }

  .info-table {
    table-layout: auto;
  }

  .info-table th,
  .info-table td {
    display: block;
    width: 100%;
  }

  .info-table th {
    border-bottom: 0;
    padding-bottom: 4px;
  }

  .info-table td {
    padding-top: 4px;
  }
}
