/*
 * School Main Page – com_schoolmainpage
 * (C) 2026 Wolkenberg Gymnasium – GNU GPL v2 or later
 *
 * Everything is scoped to .smp / .smp-*. Colours and fonts are inherited from the template.
 */

.smp {
  --smp-width-narrow: 960px;
  --smp-width-default: 1140px;
  --smp-width-wide: 1320px;
  --smp-gutter: clamp(1rem, 3vw, 1.5rem);
  --smp-space-small: 1.5rem;
  --smp-space-medium: clamp(2rem, 5vw, 3.5rem);
  --smp-space-large: clamp(3rem, 8vw, 6rem);
}

/* Section surfaces (menu item options): values below are defaults; only validated values are set inline. */
.smp {
  --smp-tint: #f2f6fc;
  --smp-surface: #fff;
  --smp-radius: 18px;
  --smp-shadow: 0 -4px 18px rgba(16, 38, 84, .08);
  --smp-edge: clamp(.5rem, 2.5vw, 1.25rem);
  --smp-overlap-max: 0px;
  --smp-overlap: var(--smp-overlap-max);
}

/* Smaller screens: the overlap shrinks, then disappears; the corners get smaller. */
@media (max-width: 767.98px) {
  .smp {
    --smp-overlap: min(var(--smp-overlap-max), 12px);
    --smp-radius: 14px;
  }
}

@media (max-width: 575.98px) {
  .smp {
    --smp-overlap: 0px;
    --smp-radius: 12px;
  }
}

/* ---------------------------------------------------------------- container */

.smp-container {
  box-sizing: border-box;
  margin-inline: auto;
  padding-inline: var(--smp-gutter);
  width: 100%;
}

.smp-container--narrow { max-width: var(--smp-width-narrow); }
.smp-container--default { max-width: var(--smp-width-default); }
.smp-container--wide { max-width: var(--smp-width-wide); }
.smp-container--full { max-width: none; }

.smp-page-heading { margin-block: 1rem; }

/* ---------------------------------------------------------------- hero */

.smp-hero {
  --smp-hero-height: auto;
  --smp-hero-height-mobile: var(--smp-hero-height);
  --smp-hero-position: 50% 50%;
  --smp-hero-background: transparent;
  background: var(--smp-hero-background);
  margin: 0 0 var(--smp-space-medium);
  overflow: hidden;
  position: relative;
}

/*
 * Breakout: spans the full viewport width even inside a centred template container. The page clips the
 * few pixels of a classic scrollbar (100vw includes it) on this page only, so no horizontal scroll appears.
 */
.smp-hero--breakout {
  margin-inline: calc(50% - 50vw);
  width: 100vw;
}

html:has(.smp-hero--breakout, .smp-section--surface-tinted),
body:has(.smp-hero--breakout, .smp-section--surface-tinted) {
  overflow-x: clip;
}

.smp-hero__picture { display: block; }

.smp-hero__image {
  display: block;
  height: auto;
  max-width: none;
  width: 100%;
}

.smp-hero--fixed .smp-hero__image {
  height: var(--smp-hero-height);
  object-fit: cover;
  object-position: var(--smp-hero-position);
}

.smp-hero--contain.smp-hero--fixed .smp-hero__image { object-fit: contain; }

@media (max-width: 767.98px) {
  .smp-hero--fixed-mobile .smp-hero__image {
    height: var(--smp-hero-height-mobile);
    object-fit: cover;
    object-position: var(--smp-hero-position);
  }

  .smp-hero--contain.smp-hero--fixed-mobile .smp-hero__image { object-fit: contain; }
}

.smp-hero__caption {
  box-sizing: border-box;
  font-size: .875rem;
  margin-inline: auto;
  max-width: var(--smp-width-default);
  padding: .5rem var(--smp-gutter);
}

/* ---------------------------------------------------------------- sections */

.smp-section { padding-block: var(--smp-space-medium); }
.smp-section--space-none { padding-block: 0; }
.smp-section--space-small { padding-block: var(--smp-space-small); }
.smp-section--space-large { padding-block: var(--smp-space-large); }

/* The first section follows the hero directly; the hero already provides the gap. */
.smp-hero + .smp-section:not(.smp-section--surface-raised) { padding-top: 0; }

.smp-section__heading { margin: 0 0 1.25rem; }

.smp-section__body > .smp-section__module + .smp-section__module { margin-top: 1.5rem; }

.smp-section--grid-2 .smp-section__body,
.smp-section--grid-3 .smp-section__body,
.smp-section--grid-4 .smp-section__body {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

.smp-section--grid-2 .smp-section__body > .smp-section__module + .smp-section__module,
.smp-section--grid-3 .smp-section__body > .smp-section__module + .smp-section__module,
.smp-section--grid-4 .smp-section__body > .smp-section__module + .smp-section__module { margin-top: 0; }

@media (min-width: 768px) {
  .smp-section--grid-2 .smp-section__body,
  .smp-section--grid-3 .smp-section__body,
  .smp-section--grid-4 .smp-section__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .smp-section--grid-3 .smp-section__body { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .smp-section--grid-4 .smp-section__body { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/*
 * "cards": presentation of the core "Articles" module (mod_articles, grid layout) as in the reference –
 * 4 / 2 / 1 columns, equal image ratio, title above the image, readable excerpt.
 */
.smp-section--cards .mod-articles-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.smp-section--cards .mod-articles-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 576px) {
  .smp-section--cards .mod-articles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .smp-section--cards .mod-articles-grid.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .smp-section--cards .mod-articles-grid.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.smp-section--cards .mod-articles-item-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.smp-section--cards .mod-articles-title {
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0 0 .5rem;
}

.smp-section--cards .mod-articles-item figure,
.smp-section--cards .mod-articles-image {
  margin: 0 0 .75rem;
}

.smp-section--cards .mod-articles-item img {
  aspect-ratio: 4 / 3;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.smp-section--cards .mod-articles-item p {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 .5rem;
}

.smp-section--cards .readmore { margin-top: auto; }

@media (prefers-reduced-motion: no-preference) {
  .smp-section--cards .mod-articles-link { transition: color .15s ease-in-out; }
}

/* ---------------------------------------------------------------- surfaces */

/*
 * "raised": a white panel with rounded top corners and a subtle shadow. It stays in the normal document flow:
 * the panel is centred at its own width (content width + inner margin, never wider than the window minus the
 * edge distance, so the rounded corners stay visible). It sits above the hero only through z-index 1; the
 * sticky header and its dropdowns (z-index 99 and higher) stay above it.
 */
.smp-section--surface-raised {
  --smp-panel-max: var(--smp-width-default);
  --smp-panel-w: min(calc(100vw - 2 * var(--smp-edge)), calc(var(--smp-panel-max) + 2 * var(--smp-gutter)));
  background: var(--smp-surface);
  border-radius: var(--smp-radius) var(--smp-radius) 0 0;
  box-shadow: var(--smp-shadow);
  box-sizing: border-box;
  margin-inline: calc(50% - var(--smp-panel-w) / 2);
  position: relative;
  width: var(--smp-panel-w);
  z-index: 1;
}

.smp-section--surface-raised.smp-section--width-narrow { --smp-panel-max: var(--smp-width-narrow); }
.smp-section--surface-raised.smp-section--width-wide { --smp-panel-max: var(--smp-width-wide); }
.smp-section--surface-raised.smp-section--width-full { --smp-panel-max: 100vw; }

/* The first raised section covers the lower edge of the hero; the hero's own bottom gap is then not needed. */
.smp--overlap .smp-hero { margin-bottom: 0; }
.smp--overlap .smp-hero + .smp-section--surface-raised { margin-top: calc(-1 * var(--smp-overlap)); }

.smp-section--surface-raised.smp-section--cards .mod-articles-item img { border-radius: .625rem; }

/*
 * "tinted": a light background across the full window width (same technique as the hero breakout, the page
 * clips the few pixels of a classic scrollbar, see above); the content stays in the section's content width.
 */
.smp-section--surface-tinted {
  background: var(--smp-tint);
  box-sizing: border-box;
  margin-inline: calc(50% - 50vw);
  width: 100vw;
}
