/* ==========================================================================
   Sternenfreunde Riesa – stylesheet

   Contents
     1. Fonts
     2. Colours and variables (light + dark)
     3. Base
     4. Hero (top bar, logo, "next event" card)
     5. Sections and headings
     6. Event plan (toggle, month groups, event rows)
     7. Two-column blocks, fee list, buttons
     8. Directions, contact
     9. Legal pages (impressum.html, datenschutz.html)
    10. Footer
    11. Small screens

   To change colours, edit section 2. Everything else uses those variables.
   ========================================================================== */


/* 1. Fonts ---------------------------------------------------------------
   Self-hosted (no connection to Google). Subsets: Latin + German characters. */

@font-face {
  font-family: "Alfa Slab One";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/AlfaSlabOne-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2");
}


/* 2. Colours and variables ----------------------------------------------- */

:root {
  /* light theme (default) */
  --bg: #f3f4fa;            /* page background */
  --surface: #ffffff;       /* cards and boxes */
  --ink: #14163d;           /* main text */
  --ink-2: #4a4d78;         /* secondary text */
  --line: #d5d8ec;          /* borders and dividers */
  --gold: #f7bd00;          /* logo gold: fills, borders */
  --gold-ink: #7a5a00;      /* gold used as TEXT on the light background (bright gold would be unreadable) */
  --on-gold: #0a0b2e;       /* text on a gold background */
  --focus: #2b3cff;         /* keyboard focus ring */

  /* the hero is always "night", in both themes */
  --night-0: #070824;
  --night-1: #14173f;
  --night-ink: #eceaf6;
  --night-ink-2: #b3b6d9;

  /* fonts */
  --display: "Alfa Slab One", "Rockwell", "Roboto Slab", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;

  color-scheme: light;
}

/* dark theme: follows the visitor's system setting.
   The two blocks below hold the same values on purpose: the first reacts to the
   system setting, the second allows forcing it with <html data-theme="dark">. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b2e;
    --surface: #12154a;
    --ink: #eceaf6;
    --ink-2: #a9acd0;
    --line: #2a2e66;
    --gold-ink: #f7bd00;
    --focus: #ffd34d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b2e;
  --surface: #12154a;
  --ink: #eceaf6;
  --ink-2: #a9acd0;
  --line: #2a2e66;
  --gold-ink: #f7bd00;
  --focus: #ffd34d;
  color-scheme: dark;
}


/* 3. Base ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* keep content clear of the notch / system bars on phones */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* centred content column */
.wrap { width: min(100% - 2.5rem, 62rem); margin-inline: auto; }

/* text for screen readers only */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* "skip to content" link: only visible while it has keyboard focus */
.skip-link {
  position: absolute; left: .75rem; top: -4rem; z-index: 10;
  padding: .6rem 1rem; border-radius: 6px;
  background: var(--gold); color: var(--on-gold); font-weight: 700;
}
.skip-link:focus { top: .75rem; }

/* inline SVG icons (see the sprite at the top of index.html) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: block; flex: none; width: 1.5rem; height: 1.5rem; }


/* 4. Hero ----------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 90% at 70% 0%, var(--night-1) 0%, var(--night-0) 70%);
  color: var(--night-ink);
  padding-bottom: 4.5rem;
}
.hero .wrap { position: relative; }
.hero :focus-visible { outline-color: var(--gold); }

/* animated star field (js/sterne.js draws into this canvas) */
#stars { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* top bar: navigation on the left, social icons on the right */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .25rem 1.5rem; padding: .75rem 0;
}
.topnav { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; font-size: 1rem; }
.topnav a {
  padding: .25rem 0; border-bottom: 2px solid transparent;
  color: var(--night-ink-2); text-decoration: none;
}
.topnav a:hover { color: var(--night-ink); border-bottom-color: var(--gold); }

.social { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: .25rem; }
.social a {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  color: var(--night-ink-2); transition: color .15s, background .15s;
}
.social a:hover { color: var(--gold); background: rgba(247, 189, 0, .12); }

/* logo + intro text on the left, "next event" card on the right */
.hero-grid { display: grid; gap: 2.5rem; margin-top: 1.5rem; align-items: center; }
.logo { display: block; width: 100%; max-width: 40rem; height: auto; }
.lede { max-width: 34rem; margin: 1.5rem 0 0; font-size: 1.25rem; line-height: 1.5; color: var(--night-ink); }
.access { max-width: 34rem; margin: 1rem 0 0; color: var(--night-ink-2); }

.next {
  background: rgba(10, 11, 46, .72);
  border: 1px solid rgba(247, 189, 0, .55);
  border-radius: 10px;
  padding: 1.5rem 1.5rem 1.4rem;
  backdrop-filter: blur(3px);
}
.next-label { margin: 0; color: var(--night-ink-2); font-size: .95rem; }
.next-date  { margin: .35rem 0 0; font-family: var(--display); font-size: clamp(1.25rem, 2.6vw, 1.55rem); line-height: 1.2; color: var(--gold); }
.next-time  { margin: .35rem 0 0; color: var(--night-ink); }
.next-title { margin: .6rem 0 0; font-size: 1.15rem; font-weight: 700; }


/* 5. Sections and headings ------------------------------------------------ */

.block { padding: 4.5rem 0 0; }

h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.1; margin: 0 0 .75rem; letter-spacing: .005em; }
h3 { font-family: var(--display); font-weight: 400; font-size: 1.45rem; margin: 0 0 .5rem; }
h4 { font-size: 1.125rem; line-height: 1.3; margin: .1rem 0 .15rem; }

.intro { max-width: 40rem; margin: 0 0 1.75rem; color: var(--ink-2); }
.note  { margin-top: 1rem; color: var(--ink-2); font-size: .95rem; }


/* 6. Event plan ------------------------------------------------------------
   The rows are created by js/termine.js from termine.json. */

/* toolbar above the list: toggle on the left, PDF link on the right */
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; margin: 0 0 2rem; }
.pdf-link { text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: var(--gold); }
.pdf-link:hover { text-decoration-color: var(--ink); }

/* toggle switch ("show past events"): knob moves from left (off) to right (on) */
.switch { position: relative; display: inline-flex; align-items: center; gap: .75rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: relative; flex: none; width: 2.9rem; height: 1.6rem; border-radius: 999px;
  background: var(--line); border: 1.5px solid var(--ink-2);
  transition: background .2s, border-color .2s;
}
.switch-knob {
  position: absolute; top: 50%; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--ink-2); transform: translateY(-50%);
  transition: left .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .switch-track .switch-knob { left: calc(100% - 1.3rem); background: var(--on-gold); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 3px; }

/* message shown instead of the list (no upcoming events, or loading failed) */
.empty { padding: 1rem 0; color: var(--ink-2); }
.empty[hidden] { display: none; }

/* one block per month */
.month { margin: 0 0 2.25rem; }
.month[hidden] { display: none; }
.month > h3 { margin-bottom: 0; padding-bottom: .5rem; border-bottom: 2px solid var(--line); }
.event-list { list-style: none; margin: 0; padding: 0; }

/* one event: date on the left, text on the right */
.event {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem;
  padding: 1.1rem 0 1.1rem .75rem;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
}
.event[hidden] { display: none; }
.event.is-highlight {                 /* "highlight": true in termine.json */
  border-left-color: var(--gold);
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 14%, transparent), transparent 70%);
}
.event.is-past {                      /* past events: quieter colours, but still readable (contrast 4.5:1 or more) */
  --ink: var(--ink-2);
  color: var(--ink-2);
}
.event.is-next { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 6px; }

.event-date { display: flex; flex-direction: column; line-height: 1.1; }
.event-day  { font-family: var(--display); font-size: 1.55rem; }
.event-weekday { margin-top: .25rem; color: var(--ink-2); font-size: .95rem; }

.event-body { min-width: 0; overflow-wrap: anywhere; }
.event-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; margin: 0; color: var(--ink-2); font-size: .93rem; }
.event-category { color: var(--ink); }
.event-time { color: var(--ink); font-weight: 700; }
.event-detail { max-width: 44rem; margin: .15rem 0 0; color: var(--ink-2); }

/* category markers: shape AND text, never colour alone */
.marker { display: inline-block; flex: none; width: .7rem; height: .7rem; }
.marker-beob   { border-radius: 50%; background: var(--gold-ink); }
.marker-tipp   { border-radius: 50%; border: 2px solid var(--gold-ink); }
.marker-aktion { background: var(--gold-ink); transform: rotate(45deg) scale(.9); }


/* 7. Two-column blocks, fee list, buttons --------------------------------- */

/* heading on top, text on the left, box on the right (stacked on phones) */
.columns { display: grid; gap: 2.5rem; }
.columns p { max-width: 38rem; margin: 0 0 1rem; }

.box { align-self: start; padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.box h3 { font-size: 1.2rem; }
.box p { margin: 0; color: var(--ink-2); }
.box .box-note { margin-top: .9rem; }

/* fee list in the "Mitglied werden" box */
.fees { list-style: none; margin: .5rem 0 0; padding: 0; }
.fees li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem 1rem; margin: 0; padding: .55rem 0; border-top: 1px solid var(--line); }
.fees li:first-child { border-top: 0; }
.fees-price { font-weight: 700; white-space: nowrap; }
.fees-sub { flex-basis: 100%; color: var(--ink-2); font-size: .95rem; }

/* buttons: outline at rest, gold fill + lift on hover */
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.btn {
  display: inline-block; padding: .55rem 1.1rem;
  border: 1.5px solid var(--ink-2); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .2s ease, box-shadow .25s ease;
}
.btn:hover {
  background: var(--gold); border-color: var(--gold); color: var(--on-gold);
  transform: translateY(-2px); box-shadow: 0 6px 18px rgba(247, 189, 0, .35);
}
.btn:active { transform: translateY(0); box-shadow: none; transition-duration: .08s; }

/* variant with gold text + border at rest (the membership form button) */
.btn-primary { border-color: var(--gold-ink); color: var(--gold-ink); font-weight: 700; }
.btn-primary:hover { border-color: var(--gold); color: var(--on-gold); }


/* 8. Directions, contact -------------------------------------------------- */

.address { display: block; margin: 0 0 1rem; font-size: 1.3rem; font-style: normal; line-height: 1.5; }

.contact { display: grid; gap: 1rem; max-width: 38rem; margin: 0; }
.contact dt { color: var(--ink-2); font-size: .95rem; }
.contact dd { margin: 0; font-size: 1.2rem; }
.contact a { text-underline-offset: 3px; }

.social-links { display: grid; justify-items: start; gap: .35rem; }
.icon-link { display: inline-flex; align-items: center; gap: .6rem; }
.icon-link .icon { width: 1.375rem; height: 1.375rem; }


/* 9. Legal pages (impressum.html, datenschutz.html) ------------------------ */

/* slim night-sky header with the logo (the logo is made for a dark background) */
.page-header {
  background: radial-gradient(120% 220% at 70% 0%, var(--night-1) 0%, var(--night-0) 70%);
  padding: 1rem 0;
}
.page-header :focus-visible { outline-color: var(--gold); }
.page-logo { display: block; width: min(100%, 15rem); }
.page-logo img { display: block; width: 100%; height: auto; }

.legal { padding: 2.5rem 0 0; }
.legal .back { margin: 0 0 2rem; }
.legal a { text-underline-offset: 3px; }
.legal h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.1; margin: 0 0 1.5rem; }
.legal h2 { font-family: var(--body); font-weight: 700; font-size: 1.3rem; line-height: 1.3; letter-spacing: 0; margin: 2.25rem 0 .5rem; }
.legal h3 { font-family: var(--body); font-weight: 700; font-size: 1.05rem; margin: 1.5rem 0 .25rem; }
.legal p, .legal address { max-width: 44rem; margin: 0 0 .9rem; font-style: normal; }
.legal ul, .legal ol { max-width: 44rem; margin: 0 0 .9rem; padding-left: 1.4rem; }
.legal li { margin-bottom: .5rem; }
.legal .source { margin-top: 2rem; }


/* 10. Footer --------------------------------------------------------------- */

.site-footer { margin-top: 5rem; padding: 2rem 0 3rem; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .95rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.footer-links a[aria-current="page"] { color: var(--ink); text-decoration: none; font-weight: 700; }


/* 11. Larger / smaller screens, reduced motion ----------------------------- */

@media (min-width: 52rem) {
  .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 3.5rem; }
  .columns   { grid-template-columns: 1.1fr 1fr; gap: 4rem; }
}

@media (max-width: 40rem) {
  /* social icons move to their own row above the navigation */
  .social { order: -1; width: 100%; margin-left: 0; justify-content: flex-end; }
}

@media (max-width: 34rem) {
  .event { grid-template-columns: 4.2rem 1fr; gap: .75rem; }
  .event-day { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: background-color .01s, color .01s, border-color .01s; }
  .btn:hover { transform: none; }
}
