/* VITA compact layout, v1. Load AFTER styles.css. No JavaScript required.
   Shared template classes only; no course IDs, page numbers or content changes.
   All overrides are screen-only, leaving the original print layout intact. */
@media screen {
  :root {
    --compact-top-space: 24px;
    --compact-block-space: 1.2rem;
    --compact-card-padding: 1.2rem;
    --compact-footer-height: 60px;
    --compact-image-height: clamp(200px, 38vh, 400px);
    --compact-title-size: clamp(1.8rem, 2.5vw, 2.25rem);
    --compact-counter-width: 3.5rem;
  }

  html {
    scroll-padding-top: 160px;
    scroll-padding-bottom: calc(var(--compact-footer-height) + 1.5rem);
  }
  /* A solid canvas prevents the body gradient from repeating below short pages. */
  html, body { background: var(--canvas); }
  body { line-height: 1.55; }

  /* Approximately 140px header, with the progress row below the menu. */
  .brand-row { min-height: 62px; padding-block: .35rem; gap: 1rem; }
  .vita-brand .vita-mark { flex-basis: 44px; width: 44px; height: 44px; }
  .vita-title-local { font-size: clamp(.72rem, 1.3vw, .9rem); }
  .eu-brand img { width: min(240px, 32vw); }
  .course-bar { min-height: 0; padding-inline: 0; }
  .chapter-nav { width: min(1180px, calc(100% - 40px)); height: auto; min-height: 44px; gap: .4rem; padding: 4px 0; margin-inline: auto; }
  .chapter-nav button { min-height: 36px; padding: .2rem .6rem; }
  /* The track fills the row from the left; the counter occupies the right column.
     Keep both elements in normal flow, outside the horizontally scrolling menu. */
  .progress-shell {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--compact-counter-width);
    align-items: center;
    gap: .5rem;
    padding: 8px 0 5px;
  }
  .progress-track { grid-column: 1; grid-row: 1; }
  .progress-meta {
    width: auto;
    position: static;
    grid-column: 2;
    grid-row: 1;
    padding: .12rem 0;
    background: transparent;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .lesson-stage {
    min-height: 0;
    padding-top: var(--compact-top-space);
    padding-bottom: calc(var(--compact-footer-height) + 1.5rem + env(safe-area-inset-bottom, 0px));
  }
  .lesson-stage h1 { font-size: var(--compact-title-size); margin-bottom: .7rem; }
  .section-heading { margin-bottom: var(--compact-block-space); }
  .eyebrow, .section-kicker, .question-kicker { margin-bottom: .45rem; }
  .subtitle { font-size: clamp(1.1rem, 1.8vw, 1.3rem); margin-bottom: 1rem; }
  .lesson-page p { margin-bottom: .75rem; }

  .hero-grid, .reading-layout, .image-text-band, .credits-grid,
  .reinforcement-grid { gap: 1.4rem; }
  .content-card, .question-card, .fact-card, .reinforcement-text,
  .quiz-card, .three-cards article, .application-grid article {
    padding: var(--compact-card-padding);
  }
  .objective-card, .image-text-band, .three-cards,
  .application-grid, .icon-pair, .panorama { margin-top: var(--compact-block-space); }
  .objective-card h2 { margin-top: 1rem; }
  .contributors-inline { margin-top: 1rem; }
  .contributors-inline > div { min-height: 0; padding: .7rem .8rem; }
  .check-list li, .source-list li { margin-bottom: .35rem; }
  .timeline-card div { padding: .85rem 1rem; }
  .definition { padding: .85rem 1rem; }
  blockquote { margin: 1rem 0; padding: 1rem 1.2rem; font-size: 1.3rem; }
  .big-quote { font-size: 1.3rem; }
  .term-note { margin-top: 1rem; }
  .term-note-toggle { padding: .8rem 1rem; }
  .faq-grid .term-note-toggle { min-height: 80px; }
  .faq-grid .term-note.is-open { min-height: 0; }

  /* Strong enough to override the template's specialised image layouts.
     Keep object-fit from styles.css (contain for diagrams, cover for photos). */
  .lesson-stage .lesson-page .media-card img { max-height: var(--compact-image-height); }
  .media-card.contained img, .hero-media img, .wide-figure img { padding: .75rem; }
  .media-card figcaption { padding: .6rem .8rem; }
  .lesson-stage .reinforcement-grid .media-card img {
    height: min(280px, var(--compact-image-height));
  }
  /* Retain the existing JS height sync, but stop an unusually long title
     from making the hero image taller than the available image budget. */
  .page-home .hero-media { max-height: calc(var(--compact-image-height) + 4rem); }
  .lesson-stage .lesson-page .cost-illustration img { height: auto; flex: 0 0 auto; }
  .cost-illustration { align-self: start; }
  .icon-pair { gap: 1.4rem; }
  .icon-pair img { height: 72px; }

  .lesson-controls, .home-start-action {
    min-height: var(--compact-footer-height);
    padding-top: 7px;
    padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px));
  }
  .lesson-controls .primary-action, .lesson-controls .secondary-action,
  .home-start-action .primary-action {
    min-height: 44px;
    padding: .45rem .8rem;
  }
}

/* Height matters as well as width: 768px laptop screens and embedded lessons. */
@media screen and (max-height: 900px) {
  :root {
    --compact-card-padding: 1rem;
    --compact-title-size: clamp(1.8rem, 2.5vw, 2rem);
  }
  body { line-height: 1.5; }
}

@media screen and (max-width: 900px) {
  /* Leave the template's single-column grids and natural reading order intact. */
  .faq-grid .term-note-toggle { min-height: 0; }
}

@media screen and (max-width: 640px) {
  :root {
    --compact-top-space: 20px;
    --compact-title-size: clamp(1.7rem, 7vw, 2rem);
  }
  .brand-row { gap: .6rem; }
  .chapter-nav { width: min(1180px, calc(100% - 24px)); }
  /* Shared wrapping rules for longer translated headings and attachment names. */
  .lesson-stage h1, .lesson-stage h2 { overflow-wrap: break-word; }
  .credits-grid { grid-template-columns: minmax(0, 1fr); }
  .credits-grid > * { min-width: 0; }
  .credits-list dd, .download-link small { overflow-wrap: anywhere; }
  .license-row { grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }
  .lesson-controls { gap: .35rem; }
  .lesson-controls .primary-action, .lesson-controls .secondary-action {
    padding-inline: .5rem;
    font-size: .85rem;
  }
}

/* At narrow widths keep the dots on a separate row, without covering content. */
@media screen and (max-width: 400px) {
  :root { --compact-footer-height: 82px; }
  .lesson-controls { flex-wrap: wrap; }
  .lesson-controls .dot-nav { order: 1; flex-basis: 100%; min-height: 16px; }
}

/* Let the header scroll away on very short windows and landscape phones. */
@media screen and (max-height: 500px) {
  :root { --compact-top-space: 16px; }
  .course-header { position: relative; }
  html { scroll-padding-top: 16px; }
}

/* Keep page focus invisible and the fixed navigation edge flat. */
@media screen {
  .lesson-stage:focus { outline: none; }
  .lesson-controls, .home-start-action {
    border-top: 1px solid var(--line);
    box-shadow: none;
    background: var(--canvas);
    backdrop-filter: none;
  }
}

/* Active learning course: override the specialised menu and method layouts. */
@media screen {
  .course-bar .chapter-nav {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
    padding: 4px 0;
  }
  .progress-meta { min-width: 0; }
  .hero-grid h1 { font-size: var(--compact-title-size); }
  .two-cards, .skill-grid, .project-phases {
    gap: 1rem;
    margin-top: var(--compact-block-space);
  }
  .skill-grid + .objective-card, .prompt-card + .question-card,
  .prompt-card, .skills-band, .attachment-hint, .editable-download {
    margin-top: var(--compact-block-space);
  }
  .two-cards .prompt-card { margin-top: 0; }
  .skills-band { padding: .85rem 1rem; }
  .process-list li { padding: var(--compact-card-padding); gap: .8rem; }
  .prompt-text { line-height: 1.55; }
}
@media screen and (max-width: 640px) {
  .course-bar .chapter-nav { width: min(1180px, calc(100% - 24px)); }
}
@media screen and (max-width: 400px) {
  .lesson-controls { display: flex; }
}

/* Stack longer cards when a full-width reading order is preferred. */
@media screen {
  .three-cards.stacked-layout { grid-template-columns: minmax(0, 1fr); }
}

/* M3-T2-MLC3: creativity course components (semantic classes, no page numbers). */
@media screen {
  .lead-in { margin: var(--compact-block-space) 0 0; font-weight: 700; }
  .lead-in + .two-cards { margin-top: .7rem; }
  .two-cards + .fact-card, .skill-grid + .question-card, .reading-layout + .fact-card,
  .two-cards + blockquote, .exercise-summary + .process-list { margin-top: var(--compact-block-space); }
  .project-phases > .fact-card, .project-phases > .question-card, .project-phases > .prompt-card { margin-top: 0; }
  .content-card h2 { margin-top: 0; }
  .numbered-cards .content-card { position: relative; }
  .card-number {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: .45rem;
    border-radius: 50%; background: var(--purple); color: white; font-weight: 700; font-size: .95rem;
  }
  .canvas-grid .prompt-text { color: var(--muted); font-style: italic; }
  .limit-card { border-left: 6px solid var(--red); }
  .exercise-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; color: var(--muted); }
  .exercise-meta span { min-width: 0; }
  .process-list { margin: 0; }
  .lesson-stage .lesson-page .reading-layout .media-card.contained img { width: 100%; height: auto; }
}
@media screen and (max-width: 900px) {
  .project-phases { grid-template-columns: minmax(0, 1fr); }
}
@media screen {
  .skill-grid h2, .project-phases h2, .two-cards h2 { font-size: clamp(1.05rem, 1.4vw, 1.2rem); margin-bottom: .4rem; }
  .skill-grid .content-card, .project-phases .content-card, .project-phases .fact-card,
  .project-phases .question-card, .two-cards .content-card { padding: 1rem 1.1rem; }
  .two-cards .objective-card { margin-top: 0; }
  .canvas-grid .content-card { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
  .canvas-grid .content-card h2 { margin: 0; }
  .canvas-grid .prompt-text { margin: 0; }
  .numbered-cards .card-number { float: left; margin: 0 .55rem 0 0; width: 1.7rem; height: 1.7rem; font-size: .85rem; }
  .numbered-cards h2 { line-height: 1.7rem; }
  .process-list li { padding: .85rem 1rem; }
  .process-list h2 { font-size: clamp(1.05rem, 1.4vw, 1.2rem); margin: .3rem 0 .3rem; }
}
/* M1-T3-MLC3: képes alkalmazási kártyák és költségkártyák */
.visual-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin-top: 1.4rem; align-items: stretch; }
.visual-cards > .content-card { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; }
.visual-cards img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; border-bottom: 1px solid var(--line); }
.visual-cards .card-copy { padding: 1rem 1.1rem 1.1rem; }
.visual-cards h2 { font-size: clamp(1.05rem, 1.4vw, 1.2rem); margin: 0 0 .4rem; }
.visual-cards p { margin: 0; }
.cost-card .section-kicker { color: var(--red); }
.reflection-questions { margin: .4rem 0 0; padding-left: 1.2rem; }
.reflection-questions li { margin-bottom: .3rem; }
.reflection-questions li::marker { color: var(--red); font-weight: 700; }
.reading-copy h2 { font-size: clamp(1.1rem, 1.6vw, 1.3rem); margin: 1rem 0 .4rem; }
.reading-copy h2:first-child { margin-top: 0; }
.image-credit { margin: .8rem 0 0; color: var(--muted); font-size: .86rem; }
@media screen and (max-width: 900px) {
  .visual-cards { grid-template-columns: minmax(0, 1fr); }
  .visual-cards img { aspect-ratio: 16 / 9; }
}
/* Egylapos fejezetben a rejtett pontjelző ne tolja középre a Következő gombot */
.lesson-controls > #previous-button { grid-column: 1; }
.lesson-controls > #dot-nav { grid-column: 2; }
.lesson-controls > #next-button { grid-column: 3; }
.two-cards + .term-note, .reading-copy .question-card { margin-top: var(--compact-block-space, 1.2rem); }
.reading-copy .question-card { margin-bottom: 0; }
@media screen and (min-width: 901px) {
  .process-list.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-list.two-column li { height: 100%; }
}
