/* =====================================================================
   WebNoah+ – home.css: die Startseite
   ---------------------------------------------------------------------
   Wird zusammen mit base.css + pages.css geladen. JS: home.js, search.js

   Aufbau (auch die Reihenfolge am Handy):
     1. Logo + Suche über alles
     2. Mein Plan / zuletzt angesehen
     3. Stundenpläne: Klassen-Leiste (D oben, A unten) + Lehrer-/Raumpläne
     4. alles andere: Werbefenster, Specials, Listen, Links
   ===================================================================== */

/* ------------------------------------------------------- Startseite */
.home {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 0;
  text-align: left;
}

.home-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

:root .home-top .home-logo {
  width: 72px;
  margin: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

/* ===================================================== 1. Suche über alles */
.wn-search {
  position: relative;
  width: 100%;
  max-width: 640px;
  z-index: 20;
  scroll-margin-top: 12px;
}

.wn-search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.wn-search-box svg {
  position: absolute;
  left: 18px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

:root .wn-search-box input {
  width: 100%;
  min-height: 56px;
  padding: 0 52px 0 50px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 500 16px/1 var(--font);
  box-shadow: var(--shadow);
}

:root .wn-search-box input::placeholder {
  color: var(--muted);
  opacity: .8;
}

:root .wn-search-box input::-webkit-search-cancel-button {
  cursor: pointer;
}

.wn-search.is-open .wn-search-box input {
  border-color: var(--accent);
}

.wn-search-key {
  position: absolute;
  right: 18px;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 12px/1 var(--font);
  pointer-events: none;
}

.wn-search-box input:focus ~ .wn-search-key,
.wn-search-box input:not(:placeholder-shown) ~ .wn-search-key {
  display: none;
}

.wn-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(430px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(16, 24, 40, .18);
}

.wn-search-results[hidden] {
  display: none;
}

:root a.wn-hit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}

:root a.wn-hit.is-active,
:root a.wn-hit:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.wn-hit-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.wn-hit-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wn-hit-icon.class svg,
.wn-hit.is-active .wn-hit-icon svg {
  stroke: var(--accent);
}

.wn-hit-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.wn-hit-text b {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wn-hit-text mark {
  background: none;
  color: var(--accent);
}

.wn-hit-text small {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wn-hit-type {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

:root .wn-search-empty,
:root .wn-search-hint {
  margin: 0;
  padding: 14px 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.wn-search-hint button {
  margin: 4px 2px 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: 600 13px/1.2 var(--font);
  cursor: pointer;
}

.wn-search-hint button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================ 3. Stundenpläne (Klassen-Leiste) */
.plan-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px 14px;
  box-shadow: var(--shadow);
}

:root .plan-bar h2 {
  margin: 0 0 12px;
  padding: 0;
  font-size: 1.05rem;
}

.plan-bar-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px 14px;
}

.class-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.class-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

:root a.class-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 54px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: 700 17px/1 var(--font);
  letter-spacing: .01em;
  text-decoration: none;
}

:root a.class-tile:hover,
:root a.class-tile:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}

:root a.class-tile.is-mine {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.class-tile span {
  color: var(--accent);
  font-size: 14px;
}

.plan-bar-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

:root a.side-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--hero);
  color: var(--hero-text);
  font: 600 15px/1.2 var(--font);
  text-decoration: none;
}

:root a.side-btn svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}

:root a.side-btn::after {
  content: "→";
  margin-left: auto;
  opacity: .7;
  transition: transform .18s ease;
}

:root a.side-btn:hover,
:root a.side-btn:focus-visible {
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

:root a.side-btn:hover::after {
  transform: translateX(4px);
}

/* ======================================================= 4. Werbefenster
   Sitzt als ganz normale Karte im Raster (wo früher "Weitere
   Stundenpläne" war) und ist so hoch wie die Karten daneben.
     PC (ab 760 px): Karte steht hochkant -> poster.jpg       1080 × 1350 (4:5)
     Handy/kleines Tablet: eher breit     -> poster-handy.jpg 1600 × 900  (16:9)
   Anleitung in index.html beim Kommentar "WERBEFENSTER". */
:root a.promo {
  position: relative;
  display: block;
  min-height: 210px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.promo-pic {
  position: absolute;
  inset: 0;
}

.promo-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bild da -> Platzhalter weg (fehlen alle Bilder, entfernt onerror das <picture>) */
.promo-pic ~ .promo-placeholder {
  display: none;
}

.promo-placeholder .for-phone {
  display: none;
}

/* Handy: volle Breite im Querformat. Gibt es kein Handy-Bild, zeigt es das
   PC-Poster -- dann hochkant (is-fallback, gesetzt in index.html) */
@media (max-width: 759px) {
  :root a.promo {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  :root a.promo.is-fallback {
    aspect-ratio: 4 / 5;
  }

  .promo-placeholder .for-wide {
    display: none;
  }

  .promo-placeholder .for-phone {
    display: inline;
  }
}

.promo-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 20, 30, .55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.promo-placeholder {
  position: absolute;
  inset: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--surface-2);
}

.promo-placeholder svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.promo-placeholder b {
  font-size: 15px;
}

.promo-placeholder span {
  font-size: 12.5px;
  color: var(--muted);
}

:root a.promo:hover {
  border-color: var(--accent);
  text-decoration: none;
}


/* ------------------------------------------------------------ Handy */
@media (max-width: 760px) {
  .home {
    padding-top: 16px;
  }

  .home-top {
    gap: 14px;
    margin-bottom: 16px;
  }

  :root .home-top .home-logo {
    width: 52px;
  }

  .wn-search-key {
    display: none;
  }

  .wn-search-results {
    max-height: 55vh;
  }

  .plan-bar {
    padding: 16px 14px 12px;
  }

  .plan-bar-body {
    grid-template-columns: 1fr;
  }

  .class-row {
    gap: 6px;
  }

  :root a.class-tile {
    min-height: 48px;
    border-radius: 12px;
    font-size: 15px;
  }

  .plan-bar-side {
    flex-direction: row;
  }

  :root a.side-btn {
    min-height: 48px;
    padding: 0 12px;
    font-size: 14px;
  }

  :root a.side-btn::after {
    display: none;
  }

}

@media (max-width: 360px) {
  :root a.class-tile {
    font-size: 13px;
  }
}

/* ------------------------------------------------------------ Mein Plan */
.my-plan {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 20px;
}

.my-plan[hidden] {
  display: none;
}

:root a.my-plan-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}

:root a.my-plan-main:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.my-plan-main small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .85;
}

.my-plan-main b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.my-plan-star {
  font-size: 26px;
}

.my-plan-go {
  margin-left: auto;
  font-size: 22px;
}

.my-plan-recent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.my-plan-recent > span {
  margin-right: 4px;
  font-weight: 500;
}

:root .my-plan-recent .pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

:root .my-plan-recent .pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

:root .my-plan-hint {
  margin: -6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------- Interaktion (Hover) */
.my-plan-go,
.my-plan-star {
  transition: transform .2s ease;
}

:root a.my-plan-main:hover .my-plan-go {
  transform: translateX(5px);
}

:root a.my-plan-main:hover .my-plan-star {
  transform: rotate(-12deg) scale(1.12);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  :root a.class-tile:hover,
  :root a.side-btn:hover,
  :root a.promo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 24, 40, .12);
  }

  :root a.my-plan-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent);
  }

  :root .my-plan-recent .pill:hover {
    transform: translateY(-1px);
  }
}
