@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: rgb(35, 44, 56);
  --muted: rgb(118, 126, 136);
  --line: rgb(216, 223, 230);
  --accent: rgb(22, 59, 96);
  --accent-soft: rgb(243, 247, 250);
  --radius: 10px;
  --shadow: 0 8px 20px rgba(16, 42, 65, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "IBM Plex Sans", "Arial Unicode MS", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.page {
  width: min(1040px, 92vw);
  margin: 0 auto;
}

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.hero {
  text-align: center;
  margin-bottom: 34px;
}

.kicker {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

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

h1 {
  margin-top: 16px;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  color: var(--accent);
  font-weight: 700;
}

.subtitle {
  margin: 12px auto 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero::after {
  content: "";
  display: block;
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 65%, white);
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 12px 24px rgba(16, 42, 65, 0.1);
}

.card h3 {
  margin-top: 10px;
  font-size: 1.24rem;
  color: var(--accent);
}

.card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.topic-body {
  padding: 32px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.back {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.topic-title {
  font-size: clamp(1.5rem, 2.4vw, 2.4rem);
}

.topic-tag {
  color: var(--muted);
  font-size: 0.9rem;
}

.sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 20px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px 22px 24px;
  min-width: 0;
}

.panel h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel p,
.panel li {
  color: var(--text);
  line-height: 1.56;
}

.panel > p,
.panel > ul,
.panel > ol {
  max-width: 78ch;
}

.teaser {
  color: var(--text);
  margin: 2px 0 14px;
}

.panel ul li,
.panel ol li {
  margin-bottom: 0.36em;
}

.panel ul,
.panel ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

.panel ol {
  padding-left: 28px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.actions-centered {
  justify-content: center;
  margin-top: 6px;
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, white);
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  background: white;
  font-family: "IBM Plex Sans", "Arial Unicode MS", sans-serif;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.btn.small {
  padding: 6px 9px;
  font-size: 0.86rem;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.muted {
  color: var(--muted);
}

.pdf-wrap {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.pdf-preview-hidden {
  display: none;
}

.pdf-controls {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgb(249, 252, 255);
}

.pdf-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-page,
.pdf-zoom {
  min-width: 92px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.pdf-canvas-wrap {
  overflow: auto;
  height: 72vh;
  max-height: 72vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: rgb(244, 248, 252);
}

.pdf-wrap.pdf-zoomed .pdf-canvas-wrap {
  justify-content: flex-start;
  align-items: flex-start;
}

.pdf-canvas-wrap canvas {
  box-shadow: 0 8px 26px rgba(17, 34, 51, 0.2);
  background: white;
  width: auto;
  height: auto;
  max-width: none;
  flex: 0 0 auto;
}

.pdf-wrap iframe {
  width: 100%;
  min-height: 72vh;
  border: 0;
}

.plan-table-wrap {
  overflow-x: visible;
  border: none;
  border-radius: 8px;
  background: white;
  max-width: 100%;
}

.plan-cards {
  display: none;
  gap: 10px;
}

.plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.plan-card h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: var(--accent);
}

.plan-card p {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.plan-card p:last-child {
  margin-bottom: 0;
}

.collapsible {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 360ms ease, opacity 260ms ease, margin-top 360ms ease;
}

.collapsible.is-open {
  max-height: 10000px;
  opacity: 1;
  margin-top: 14px;
}

.btn.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

/* Column sizing: AP stays narrow (2-digit), content columns get space */
.plan-table col.plan-col-ap {
  width: 64px;
}

.plan-table th:nth-child(1),
.plan-table td:nth-child(1) {
  width: 64px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Note: we only fix AP width; remaining columns split automatically (better iOS/Safari behavior). */

.plan-table th,
.plan-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 0.94rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.plan-table tr > *:first-child {
  border-left: none;
}

.plan-table tr > *:last-child {
  border-right: none;
}

.plan-table thead tr:first-child > * {
  border-top: none;
}

.plan-table tbody tr:last-child > * {
  border-bottom: none;
}

.plan-table thead th {
  background: rgb(243, 247, 250);
  color: var(--accent);
  font-weight: 700;
}

.plan-table tbody tr:nth-child(even) {
  background: rgb(250, 252, 253);
}

.theme-smart {
  --accent: rgb(22, 59, 96);
  --accent-soft: rgb(232, 240, 248);
}

.theme-pv {
  --accent: rgb(136, 78, 18);
  --accent-soft: rgb(248, 239, 226);
}

.theme-wp {
  --accent: rgb(18, 82, 76);
  --accent-soft: rgb(228, 244, 242);
}

.theme-lade {
  --accent: rgb(66, 40, 112);
  --accent-soft: rgb(239, 235, 249);
}
.theme-uv {
  --accent: rgb(120, 34, 46);
  --accent-soft: rgb(248, 233, 236);
}

.theme-etuv {
  --accent: rgb(64, 72, 36);
  --accent-soft: rgb(237, 242, 229);
}

@media (min-width: 701px) and (max-width: 1100px) {
  .page {
    width: min(920px, 86vw);
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .sections {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
  }

  .panel {
    padding: 18px 18px 20px;
  }

  .actions,
  .actions-centered {
    justify-content: center;
  }

  .pdf-canvas-wrap {
    height: 64vh;
    max-height: 64vh;
  }

  .plan-table th,
  .plan-table td {
    padding: 7px 8px;
    font-size: 0.9rem;
  }
}

@media (max-width: 700px) {
  .page {
    width: min(1040px, 94vw);
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .landing {
    align-items: start;
    padding-top: 18px;
  }

  .hero {
    margin-bottom: 22px;
  }

  .topic-body {
    padding: 22px 0 52px;
  }

  .panel {
    padding: 16px 16px 18px;
  }

  .sections {
    gap: 14px;
    margin-top: 14px;
  }

  .actions {
    gap: 8px;
  }

  .actions-centered {
    justify-content: flex-start;
  }

  .pdf-wrap iframe {
    min-height: 58vh;
  }

  .pdf-controls {
    gap: 12px;
    padding: 8px;
  }

  .pdf-page,
  .pdf-zoom { min-width: 86px; font-size: 0.84rem; }

  .pdf-canvas-wrap {
    height: 58vh;
    max-height: 58vh;
    padding: 8px;
  }

  .plan-table-wrap {
    display: none;
  }

  .plan-cards {
    display: grid;
  }
}

@media (max-width: 640px) {
  .page {
    width: 95vw;
  }

  h1 {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
    margin-top: 12px;
  }

  .subtitle {
    font-size: 0.94rem;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 1.08rem;
  }

  .topic-title {
    font-size: clamp(1.3rem, 6.2vw, 1.65rem);
  }

  .panel h2 {
    font-size: 1.05rem;
  }

  .panel p,
  .panel li {
    font-size: 0.95rem;
  }

  .actions,
  .actions-centered {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  .btn.small {
    width: 100%;
    text-align: center;
  }

  .pdf-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pdf-group {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .pdf-canvas-wrap {
    height: min(62vh, calc(100dvh - 260px));
    max-height: min(62vh, calc(100dvh - 260px));
    padding: 6px;
  }

}

@media (max-width: 420px) {
  .kicker {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  .panel {
    padding: 14px;
  }

}
