:root {
  color-scheme: light;
  --glass-bg: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-text: rgba(255, 255, 255, 0.92);
  --forest-green: #62701b;
  --ease-out: cubic-bezier(0.2, 0.75, 0.25, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #6f361d;
}

body {
  font-family: "Courier New", Courier, monospace;
  -webkit-font-smoothing: antialiased;
}

.forest {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.forest-image {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("/forest-sunlight-4k.webp") 50% 50% / cover no-repeat;
}

/* ---------------------------------------------------------------
   Wortmarke: eine Glasflaeche, die sich nach unten entfaltet.
   Der Rahmen gehoert der Flaeche, nicht mehr der Ueberschrift,
   damit Titel und Menue in derselben Scheibe liegen.
   --------------------------------------------------------------- */

.wordmark {
  position: absolute;
  top: max(clamp(24px, 4vh, 48px), calc(env(safe-area-inset-top) + 16px));
  left: 50%;
  translate: -50% 0;
  width: clamp(450px, 47.5vw, 650px);
  max-width: calc(100% - 36px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  box-shadow:
    0 5px 18px rgba(52, 24, 10, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(10px) saturate(108%);
  backdrop-filter: blur(10px) saturate(108%);
  animation: wordmark-in 1.4s var(--ease-out) both;
  transition:
    box-shadow 0.5s var(--ease-out),
    border-radius 0.5s var(--ease-out),
    background 0.5s var(--ease-out);
}

.wordmark.is-open {
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.17);
  box-shadow:
    0 12px 30px rgba(52, 24, 10, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

h1 {
  margin: 0;
  font-weight: 300;
  line-height: 1;
}

.wordmark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 1px 13px 3px;
  border: 0;
  background: none;
  color: var(--glass-text);
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(38px, 4.3vw, 62px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
  text-align: center;
  text-shadow:
    0 1px 2px rgba(39, 19, 9, 0.5),
    0 3px 12px rgba(39, 19, 9, 0.22);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wordmark-toggle:hover .wordmark-text,
.wordmark-toggle:focus-visible .wordmark-text,
.wordmark.is-open .wordmark-text {
  color: #fff;
  text-shadow:
    0 1px 2px rgba(39, 19, 9, 0.5),
    0 3px 12px rgba(39, 19, 9, 0.22),
    0 0 22px rgba(255, 255, 255, 0.28);
}

.wordmark-text {
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

.menu-chevron {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  opacity: 0.85;
  transform: rotate(45deg);
  filter: drop-shadow(0 1px 1px rgba(39, 19, 9, 0.4));
  transition: transform 0.3s var(--ease-out);
}

.wordmark.is-open .menu-chevron {
  transform: rotate(225deg);
}

.wordmark-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 3px;
  border-radius: 7px;
}

/* Die Flaeche waechst ueber grid-template-rows von 0fr auf 1fr.
   Das animiert die echte Inhaltshoehe, ohne sie zu kennen. */
.menu-shell {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.55s var(--ease-out);
}

.wordmark.is-open .menu-shell {
  grid-template-rows: 1fr;
}

.menu {
  overflow: hidden;
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu li {
  opacity: 0;
  transform: translateY(-7px);
  transition:
    opacity 0.4s ease,
    transform 0.45s var(--ease-out);
}

.wordmark.is-open .menu {
  max-height: calc(100svh - max(48px, calc(env(safe-area-inset-top) + 16px)) - 106px);
  overflow-y: auto;
}

/* Eintraege erscheinen nacheinander von oben nach unten */
.wordmark.is-open .menu li {
  opacity: 1;
  transform: translateY(0);
}

.wordmark.is-open .menu li:nth-child(1) { transition-delay: 0.12s; }
.wordmark.is-open .menu li:nth-child(2) { transition-delay: 0.18s; }
.wordmark.is-open .menu li:nth-child(3) { transition-delay: 0.24s; }
.wordmark.is-open .menu li:nth-child(4) { transition-delay: 0.30s; }
.wordmark.is-open .menu li:nth-child(5) { transition-delay: 0.36s; }
.wordmark.is-open .menu li:nth-child(6) { transition-delay: 0.42s; }

.menu li:first-child {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.menu li:last-child a {
  padding-bottom: 13px;
}

.menu a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 56px);
  row-gap: 6px;
  padding: 9px 24px;
  color: rgba(255, 255, 255, 0.94);
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(23px, 2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(39, 19, 9, 0.45);
  transition: background 0.25s ease, color 0.25s ease, text-shadow 0.25s ease;
}

.menu a:hover,
.menu a:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: var(--forest-green);
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.5),
    0 0 12px rgba(255, 255, 255, 0.18);
  outline: none;
}

.menu a:hover .menu-note,
.menu a:focus-visible .menu-note {
  opacity: 1;
}

.menu li:last-child a:hover,
.menu li:last-child a:focus-visible {
  border-radius: 0 0 12px 12px;
}

.menu-note {
  flex: none;
  margin-left: auto;
  text-align: right;
  opacity: 0.62;
  transition: opacity 0.25s ease;
  font-size: 0.68em;
  font-weight: 400;
  letter-spacing: -0.01em;
}

@keyframes wordmark-in {
  from {
    opacity: 0;
    filter: blur(7px);
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .forest-image {
    background-position: 58% 50%;
  }

  .wordmark {
    top: max(24px, calc(env(safe-area-inset-top) + 12px));
    width: calc(100vw - 32px);
    max-width: 430px;
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(29, 20, 15, 0.4);
    -webkit-backdrop-filter: blur(16px) saturate(118%);
    backdrop-filter: blur(16px) saturate(118%);
  }

  .wordmark.is-open {
    background: rgba(29, 20, 15, 0.46);
  }

  .wordmark-toggle {
    gap: 10px;
    padding: 6px 12px 8px;
    font-size: clamp(32px, 9.5vw, 40px);
  }

  .menu li:first-child {
    margin-top: 2px;
  }

  .menu a {
    flex-wrap: nowrap;
    gap: 16px;
    padding: 10px 16px;
    font-size: clamp(21px, 6vw, 24px);
    line-height: 1.1;
  }

  .menu-note {
    white-space: nowrap;
    font-size: 0.68em;
    letter-spacing: -0.01em;
  }

  .menu li:last-child a {
    padding-bottom: 14px;
  }
}

@media (max-width: 360px) {
  .wordmark {
    width: calc(100vw - 24px);
  }

  .menu a {
    gap: 12px;
    padding-inline: 13px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark {
    animation: none;
  }

  .wordmark,
  .menu-chevron,
  .menu-shell,
  .menu li,
  .menu a {
    transition-duration: 0.01ms;
  }

  .wordmark.is-open .menu li {
    transition-delay: 0s;
  }
}
