/* ==========================================================================
   Mathe mit Bilal – components
   Badges, video cards, grade tiles, empty states, home hero.
   ========================================================================== */

/* --- Badge (grade) ------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--light-blue);
  color: var(--blue);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Play button (blue circle with white triangle) ------------------------ */
.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
}
.play svg { width: 40%; height: 40%; margin-left: 8%; }
.play--large { width: 76px; height: 76px; }

/* --- Thumbnail (16:9, light blue placeholder until a real image exists) ---- */
.thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: var(--light-blue);
  overflow: hidden;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Video card ---------------------------------------------------------- */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 600px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .video-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Cards in one row get the same height */
.video-grid > li { display: flex; }

.video-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--navy);
  text-decoration: none;
}
.video-card:hover { border-color: var(--blue); color: var(--navy); }
.video-card:hover .video-card__title { color: var(--blue); }
.video-card .thumb { border-bottom: 1px solid var(--border); }
.video-card__body { padding: 12px var(--s2) var(--s2); }
.video-card__title {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}
.video-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1);
  margin-top: var(--s1);
  font-size: var(--fs-small);
  line-height: 20px;
  color: var(--gray);
}

/* --- Grade tiles --------------------------------------------------------- */
.grade-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) {
  .grade-tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .grade-tiles { grid-template-columns: repeat(8, 1fr); }
}

.grade-tile {
  display: block;
  padding: 14px var(--s2);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--navy);
  text-decoration: none;
}
.grade-tile:hover { border-color: var(--blue); color: var(--blue); }
.grade-tile__name { display: block; font-weight: 600; line-height: 22px; }
.grade-tile__count { display: block; color: var(--gray); font-size: var(--fs-xsmall); line-height: 20px; }

/* --- Empty state / hint box ---------------------------------------------- */
.notice {
  padding: var(--s3);
  background: var(--light-blue);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.notice p + p { margin-top: var(--s1); }

/* --- Section header with "more" link ------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: var(--s3);
}
.section-head a { font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.section-head a:hover { text-decoration: underline; }

/* --- Home hero ----------------------------------------------------------- */
/* Mobile order: title, text, video, buttons (header search is used on mobile).
   Desktop: text column left, video right. */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "title"
    "intro"
    "video"
    "actions";
  gap: var(--s2);
  padding-top: var(--s4);
  padding-bottom: var(--s5);
}
.hero__title { grid-area: title; }
.hero__intro { grid-area: intro; color: var(--gray); }
.hero__video { grid-area: video; margin-top: var(--s1); }
.hero__search { grid-area: search; display: none; }
.hero__actions { grid-area: actions; display: grid; gap: 12px; margin-top: var(--s1); }

.welcome-video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-video);
  overflow: hidden;
  background: var(--light-blue);
  border: 1px solid var(--border);
}
.welcome-video video,
.welcome-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--navy);
}
.welcome-video__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  color: var(--gray);
  font-size: var(--fs-small);
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas:
      "title   video"
      "intro   video"
      "search  video"
      "actions video";
    column-gap: var(--s6);
    row-gap: var(--s2);
    align-items: start;
    padding-top: var(--s8);
    padding-bottom: var(--s8);
  }
  .hero__title { font-size: 38px; line-height: 46px; }
  .hero__video { margin-top: 0; align-self: center; }
  .hero__search { display: block; margin-top: var(--s1); }
  .hero__search .field { padding-top: 14px; padding-bottom: 14px; }
  .hero__actions { display: flex; flex-wrap: wrap; margin-top: 0; }
}

/* On phones, only the three newest videos are shown */
@media (max-width: 599px) {
  .video-grid--latest > :nth-child(n + 4) { display: none; }
}

/* ==========================================================================
   Inner pages
   ========================================================================== */

.page { padding-top: var(--s4); padding-bottom: var(--s6); }
@media (min-width: 768px) {
  .page { padding-top: var(--s5); padding-bottom: var(--s8); }
}
.page__head { margin-bottom: var(--s3); }
.page__head p { margin-top: var(--s1); }
.page__lead { max-width: 720px; }
.page__intro { margin-top: var(--s3); }

/* --- Notice / empty state ------------------------------------------------- */
.notice__title { font-weight: 600; }
.notice__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--s2); }
@media (max-width: 599px) {
  .notice__actions .btn { width: 100%; }
}

/* --- Breadcrumb ----------------------------------------------------------- */
.breadcrumb { margin-bottom: var(--s2); font-size: var(--fs-small); line-height: 20px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li { color: var(--gray); }
.breadcrumb li + li::before { content: "›"; margin-right: 4px; color: var(--gray); }
.breadcrumb a { color: var(--gray); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--navy); }

/* --- Nach Klasse: grade list + topics -------------------------------------- */
.split { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 900px) {
  .split { grid-template-columns: 240px 1fr; gap: var(--s5); align-items: start; }
}
.split__main > h2 { margin-bottom: 4px; }
.split__empty { margin-top: var(--s2); }

/* Mobile: horizontally scrollable chip row; desktop: vertical list */
.grade-nav { margin: 0 calc(-1 * var(--gutter)); }
.grade-nav ul {
  display: flex;
  gap: var(--s1);
  overflow-x: auto;
  padding: 2px var(--gutter) 6px;
  scrollbar-width: thin;
}
.grade-nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--navy);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
}
.grade-nav__count { color: var(--gray); font-size: 13px; }
.grade-nav a[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: var(--white); font-weight: 600; }
.grade-nav a[aria-current="page"] .grade-nav__count { color: var(--light-blue); }

@media (min-width: 900px) {
  .grade-nav { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .grade-nav ul { display: block; padding: 0; overflow: visible; }
  .grade-nav li + li { border-top: 1px solid var(--border); }
  .grade-nav a {
    display: flex;
    justify-content: space-between;
    padding: 12px var(--s2);
    border: 0;
    border-radius: 0;
    font-size: 16px;
  }
  .grade-nav a:hover { color: var(--blue); }
  .grade-nav a[aria-current="page"] { background: var(--light-blue); color: var(--blue); }
  .grade-nav a[aria-current="page"] .grade-nav__count { color: var(--gray); }
}

.topic-block { margin-top: var(--s4); }
.topic-block h3 { margin-bottom: var(--s1); }
.topic-block h3 a { color: var(--navy); text-decoration: none; }
.topic-block h3 a:hover { color: var(--blue); text-decoration: underline; }

/* Video rows: play icon, title, duration, 1px divider */
.video-rows { border-top: 1px solid var(--border); }
.video-rows--narrow { max-width: 820px; }
.video-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
  text-decoration: none;
}
.video-row:hover .video-row__title { color: var(--blue); }
.video-row__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--light-blue);
  color: var(--blue);
}
.video-row__icon svg { width: 13px; height: 13px; margin-left: 2px; }
.video-row__title { flex: 1; min-width: 0; font-weight: 500; line-height: 22px; }
.video-row__grades { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.video-row__duration { flex: none; color: var(--gray); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
@media (max-width: 599px) {
  .video-row { flex-wrap: wrap; }
  .video-row__grades { order: 3; width: 100%; justify-content: flex-start; padding-left: 44px; }
}

/* --- Nach Thema: group cards ---------------------------------------------- */
.topic-cards { display: grid; grid-template-columns: 1fr; gap: var(--s3); align-items: start; }
@media (min-width: 700px) {
  .topic-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .topic-cards { grid-template-columns: repeat(3, 1fr); }
}
.topic-card { padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.topic-card__title { margin-bottom: var(--s1); font-size: 20px; line-height: 28px; }
.topic-card__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  padding: 10px 0;
  border-top: 1px solid var(--border);
  color: var(--navy);
  text-decoration: none;
}
.topic-card li:first-child .topic-card__row { border-top: 0; }
.topic-card__row:hover { color: var(--blue); }
.topic-card__count { flex: none; color: var(--gray); font-size: var(--fs-small); }

/* --- Player ---------------------------------------------------------------- */
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-video);
  background: var(--light-blue);
}
.welcome-video .player { border-radius: 0; height: 100%; }
.player video,
.player iframe { width: 100%; height: 100%; border: 0; background: var(--navy); }
.player__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player__consent {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: var(--s2);
  text-align: center;
}
.player__poster + .player__consent { background: rgba(15, 27, 61, 0.55); color: var(--white); }
.player__button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 600;
  cursor: pointer;
}
.player__button:hover .play { background: var(--navy); }
.player__note { max-width: 420px; color: var(--gray); font-size: 12px; line-height: 18px; }
.player__poster + .player__consent .player__note { color: var(--white); }
.player__poster + .player__consent a { color: var(--white); }
.player__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--gray);
  font-size: var(--fs-small);
}
@media (max-width: 599px) {
  .player__note { font-size: 11px; line-height: 16px; }
  .player .play--large { width: 56px; height: 56px; }
}
/* TikTok and Instagram are portrait: after loading, the frame switches to 9:16 */
.player--vertical { aspect-ratio: 9 / 16; max-width: 340px; max-height: 80vh; margin: 0 auto; background: var(--white); border: 1px solid var(--border); }
.welcome-video .player--vertical { aspect-ratio: auto; max-width: none; border: 0; }

/* --- Video page ------------------------------------------------------------ */
.video-layout { display: grid; grid-template-columns: 1fr; gap: var(--s5); }
@media (min-width: 900px) {
  .video-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); align-items: start; }
}
.video-title { margin-top: var(--s3); font-size: 26px; line-height: 34px; }
@media (min-width: 768px) {
  .video-title { font-size: 30px; line-height: 38px; }
}
.video-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-top: var(--s1); color: var(--gray); font-size: 15px; }
.video-meta a { color: var(--gray); }
.video-meta a:hover { color: var(--blue); }
.video-description { margin-top: var(--s2); max-width: 720px; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.video-platform { margin-top: var(--s2); }

.related-title { margin-bottom: var(--s2); font-size: 18px; line-height: 26px; }
.related-list { display: grid; gap: 12px; }
.related-item { display: flex; gap: 12px; color: var(--navy); text-decoration: none; }
.related-item .thumb { flex: none; width: 128px; border-radius: 6px; }
.related-item .thumb .play { width: 32px; height: 32px; }
.related-item__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.related-item__title { font-size: 15px; font-weight: 600; line-height: 20px; }
.related-item:hover .related-item__title { color: var(--blue); }
.related-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--gray); font-size: 13px; }

/* --- Search ---------------------------------------------------------------- */
.search-large { display: flex; gap: var(--s1); max-width: 720px; }
.search-large .field { flex: 1; padding-top: 14px; padding-bottom: 14px; }
.search-large .live-results { right: auto; width: 100%; }
.chip-row { display: flex; gap: var(--s1); overflow-x: auto; margin: var(--s2) calc(-1 * var(--gutter)) var(--s3); padding: 2px var(--gutter) 6px; }
@media (min-width: 768px) {
  .chip-row { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}
.result-list { max-width: 820px; border-top: 1px solid var(--border); }
.result {
  display: flex;
  gap: var(--s2);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
  text-decoration: none;
}
.result__thumb { flex: none; width: 120px; }
.result__thumb .thumb { border-radius: 6px; }
.result__thumb .play { width: 36px; height: 36px; }
@media (min-width: 600px) {
  .result__thumb { width: 176px; }
  .result__thumb .play { width: 44px; height: 44px; }
}
.result__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.result__title { font-size: 18px; font-weight: 600; line-height: 24px; }
.result:hover .result__title { color: var(--blue); }
.result__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--gray); font-size: var(--fs-small); }
.result__desc { overflow: hidden; color: var(--gray); font-size: var(--fs-small); line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }

/* --- Links page (Linktree replacement) ------------------------------------- */
.links-page { background: var(--light-blue); }
.links {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: calc(420px + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s4);
  text-align: center;
}
.links__logo { width: 140px; height: auto; }
.links__handle { margin-top: var(--s2); font-size: 22px; line-height: 30px; }
.links__text { margin-top: 4px; color: var(--gray); }
.links__list { display: grid; gap: 12px; width: 100%; margin-top: var(--s3); }
.links__list .btn { padding-top: 15px; padding-bottom: 15px; }
.links__legal { margin-top: var(--s4); color: var(--gray); font-size: var(--fs-small); }
.links__legal a { color: var(--gray); }
.links__legal a:hover { color: var(--blue); }

/* --- Contact --------------------------------------------------------------- */
.contact-layout { display: grid; grid-template-columns: 1fr; gap: var(--s3); align-items: start; }
@media (min-width: 900px) {
  .contact-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s4); }
}
.contact-direct__title { margin-bottom: var(--s2); font-size: 20px; line-height: 28px; }
.contact-direct dt { color: var(--gray); font-size: 13px; line-height: 18px; }
.contact-direct dd { margin: 0 0 12px; font-weight: 500; overflow-wrap: anywhere; }
.contact-direct a { text-decoration: none; }
.contact-direct a:hover { text-decoration: underline; }
.form-hint { margin-bottom: var(--s2); }
/* Honeypot: off-screen for humans */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- Legal pages ----------------------------------------------------------- */
.legal { max-width: calc(720px + 2 * var(--gutter)); }
.legal h1 { margin-bottom: var(--s3); }
.legal h2 { margin: var(--s4) 0 var(--s1); font-size: 20px; line-height: 28px; }
.legal p + p { margin-top: var(--s1); }
.legal__note { margin-bottom: var(--s2); }
.legal__list { margin: var(--s1) 0; padding-left: 20px; list-style: disc; }
.legal__list li + li { margin-top: var(--s1); }
.placeholder { padding: 0 4px; border-radius: 4px; background: var(--light-blue); color: var(--blue); font-weight: 600; }
