:root {
  --page: #f7f8fa;
  --card: #ffffff;
  --ink: #171b24;
  --text: #2f3542;
  --muted: #6b7280;
  --line: #e6ded3;
  --green: #004289;
  --green-dark: #004289b3;
  --gold: #b88d4d;
  --dark: #111827;
  --footer: #162338;
  --shadow: 0 18px 45px rgba(25, 32, 45, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--page);
  font-size: 16px;
  line-height: 1.55;
}
a { color: inherit; }

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo-img {
  display: block;
  width: 74px;
  height: auto;
}
.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  font-size: 15px;
  font-weight: 700;
}
.top-nav a {
  text-decoration: none;
  color: #374151;
}
.top-nav a:hover { color: var(--green-dark); }
.login-link {
  background: var(--green);
  color: #fff !important;
  padding: 10px 17px;
  border-radius: 2px;
}

.page-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 24px 64px;
}
.course-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 34px;
  align-items: start;
}
.course-content,
.purchase-card,
.login-section,
.access-status,
.player-shell {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.course-content { padding: 42px 46px 48px; }
.kicker {
  margin: 0 0 8px;
  color: #ffd203;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
h1, h2, h3 { color: var(--ink); line-height: 1.15; margin: 0; }
h1 {
  max-width: 760px;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.045em;
}
h2 {
  margin-bottom: 18px;
  font-size: 28px;
  font-weight: 800;
}
h3 {
  font-size: 20px;
  font-weight: 800;
}
.authors {
  max-width: 900px;
  margin: 18px 0 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin: 0 0 30px;
  border-bottom: 1px solid var(--line);
}
.section-tabs a {
  display: inline-flex;
  padding: 0 0 15px;
  text-decoration: none;
  color: #737b89;
  font-weight: 800;
}
.section-tabs a:first-child {
  color: var(--ink);
  border-bottom: 3px solid var(--green);
  margin-bottom: -1px;
}
.text-section p {
  margin: 0 0 17px;
  color: #4b5563;
  font-size: 17px;
}
.content-list {
  list-style: none;
  padding: 0;
  margin: 22px 0 28px;
  border-top: 1px solid var(--line);
}
.content-list li {
  padding: 17px 0 17px 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
  font-weight: 700;
  color: #263241;
}
.content-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  position: absolute;
  top: 25px;
  left: 2px;
}
.note {
  padding: 15px 18px;
  background: #fbf7ef;
  border: 1px solid #eadfca;
  color: #72572d !important;
  font-size: 15px !important;
}

.purchase-card {
  padding: 28px;
  position: sticky;
  top: 92px;
}
.modules-count {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.count-number {
  color: var(--ink);
  font-size: 54px;
  line-height: 1;
  font-weight: 800;
}
.count-label {
  color: var(--muted);
  font-weight: 800;
}
.access-price {
  display: grid;
  gap: 6px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.access-price span { color: var(--muted); }
.primary-button,
.module-action,
.access-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  min-height: 46px;
  padding: 12px 20px;
  background: var(--green);
  color: #fff;
  border-radius: 2px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}
.primary-button {
  width: 100%;
  margin-top: 22px;
}
.primary-button:hover,
.module-action:hover,
.access-form button:hover { background: var(--green-dark); }
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.tags span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f1ede7;
  color: #72572d;
  font-size: 13px;
  font-weight: 800;
}

.login-section {
  margin-top: 34px;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 30px;
  align-items: center;
}
.login-copy p { margin: 10px 0 0; color: var(--muted); }
.access-form { display: grid; gap: 10px; }
.access-form label { font-weight: 800; color: var(--ink); }
.access-form input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #cfd6df;
  border-radius: 2px;
  font-size: 16px;
}
.form-error {
  margin: 0;
  color: #b42318;
  font-weight: 800;
}
.access-status {
  margin-top: 28px;
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  background: #fbf7ef;
  color: #72572d;
}

.module-block {
  margin-top: 36px;
  padding-top: 31px;
  border-top: 1px solid var(--line);
}
.module-list {
  display: grid;
  border-top: 1px solid var(--line);
}
.module-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.module-copy p {
  margin: 7px 0 0;
  color: var(--muted);
}
.module-action.is-muted {
  background: #e8edf1;
  color: #737b89;
}
.module-action.is-muted:hover { background: #e4e8ee; }

.site-footer {
  background: var(--footer);
  color: #fff;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
.footer-inner h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #fff;
}
.footer-inner p {
  margin: 0;
  color: rgba(255,255,255,0.72);
}

.player-page {
  max-width: 1180px;
  margin: 0 auto;
}
.player-heading {
  margin-bottom: 22px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 30px 34px;
}
.player-heading h1 { font-size: clamp(32px, 4vw, 48px); }
.player-heading p:not(.kicker) { max-width: 780px; color: var(--muted); }
.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}
.player-shell {
  padding: 14px;
  overflow: visible;
}
.h5p-container {
  width: 100%;
  min-height: 0;
  background: #fff;
  overflow: visible;
}
.h5p-container iframe {
  display: block;
  width: 100% !important;
  max-width: 100%;
  min-height: 0;
  border: 0;
  overflow: hidden;
}

/* H5P Dialog Cards: keep previous whitespace fix only; do not reorder images. */
.h5p-dialogcards-card-text-inner-content {
  margin: 0 !important;
  padding: 0 !important;
}
.h5p-dialogcards-card-text-inner-content > *:first-child { margin-top: 0 !important; padding-top: 0 !important; }
.h5p-dialogcards-card-text-inner-content > *:last-child { margin-bottom: 0 !important; padding-bottom: 0 !important; }
.h5p-dialogcards-card-text-inner,
.h5p-dialogcards-card-text-wrapper,
.h5p-dialogcards-card-text,
.h5p-dialogcards-card-text-area { min-height: 0 !important; }
.h5p-dialogcards-card-text-inner { height: auto !important; }

.h5p-interactive-book-main,
.h5p-interactive-book-content,
.h5p-interactive-book-chapter {
  overflow: visible !important;
}

.h5p-dialogcards .h5p-dialogcards-cardwrap-set,
.h5p-dialogcards .h5p-dialogcards-cardholder {
  max-width: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}
.h5p-dialogcards-card-content,
.h5p-dialogcards-card,
.h5p-dialogcards-card-front,
.h5p-dialogcards-card-back {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}


@media (max-width: 980px) {
  .course-detail { grid-template-columns: 1fr; }
  .purchase-card { position: static; }
  .login-section { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .top-nav { flex-wrap: wrap; justify-content: flex-start; gap: 14px 18px; }
  .page-main { padding: 24px 16px 44px; }
  .course-content { padding: 28px 22px; }
  .purchase-card, .login-section, .player-heading { padding: 22px; }
  .module-item { grid-template-columns: 1fr; }
  .module-action { width: 100%; }
  h1 { font-size: 34px; }
}

/* Legal pages */
.legal-page {
  max-width: 920px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 42px 46px 48px;
}
.legal-page h1 {
  margin-bottom: 16px;
  font-size: clamp(36px, 5vw, 56px);
}
.legal-intro {
  max-width: 760px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 18px;
}
.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.legal-card {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  background: #fffaf3;
}
.legal-card h2 {
  margin-bottom: 10px;
  font-size: 22px;
}
.legal-card p {
  margin: 0 0 12px;
  color: #4b5563;
}
.legal-card p:last-child { margin-bottom: 0; }
.legal-card a,
.footer-inner a,
.cookie-notice a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-note {
  margin: 26px 0 0;
  padding: 15px 18px;
  border: 1px solid #eadfca;
  background: #fbf7ef;
  color: #72572d;
  font-weight: 700;
}

/* Cookie notice */
.cookie-notice {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  background: #162338;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}
.cookie-notice[hidden] { display: none; }
.cookie-notice strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
}
.cookie-notice p {
  margin: 0;
  color: rgba(255,255,255,0.78);
}
.cookie-notice__button {
  flex: 0 0 auto;
  border: 0;
  min-height: 42px;
  padding: 10px 18px;
  background: var(--green);
  color: #fff;
  border-radius: 2px;
  font-weight: 800;
  cursor: pointer;
}
.cookie-notice__button:hover { background: var(--green-dark); }

@media (max-width: 720px) {
  .legal-page { padding: 28px 22px; }
  .legal-grid { grid-template-columns: 1fr; }
  .cookie-notice {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-notice__button { width: 100%; }
}

/* Accessibility improvements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #0b6f69;
  outline-offset: 3px;
}

.primary-button:focus-visible,
.module-action:focus-visible,
.login-link:focus-visible,
.cookie-notice__button:focus-visible {
  box-shadow: 0 0 0 4px rgba(36, 173, 165, 0.28);
}

.access-form input:focus-visible {
  border-color: #0b6f69;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
