/* ============================================================
   Alltags-Deutsch — style.css
   Design concept: German market-stall signage. Topics hang like
   painted shop signboards; vocabulary reads like torn ticket
   stubs; dialogues sit on pinned index cards. Pine green +
   chalk cream + mustard + brick, printed-signage typography.
   ============================================================ */

:root {
  --pine: #1F3A2E;
  --pine-deep: #142720;
  --chalk: #F6F1E2;
  --mustard: #E3A72F;
  --brick: #B5482A;
  --sage: #7C9885;
  --ink: #24291F;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Karla", "Segoe UI", sans-serif;
  --font-hand: "Caveat", cursive;

  --radius: 10px;
  --shadow-lift: 0 14px 30px rgba(20, 39, 32, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 3px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Site header (both pages) ---------- */

.site-header {
  background: var(--pine);
  color: var(--chalk);
  padding: 22px 0;
  border-bottom: 6px solid var(--mustard);
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand span {
  font-family: var(--font-hand);
  color: var(--mustard);
  font-size: 1.2rem;
  margin-left: 8px;
}

.back-link {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--chalk);
  border-bottom: 2px solid var(--mustard);
  padding-bottom: 2px;
}

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

.hero {
  background: var(--pine);
  color: var(--chalk);
  padding: 64px 0 96px;
  position: relative;
}

.hero .wrap { position: relative; }

.hero-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.hero-text { flex: 1 1 auto; min-width: 0; }

.hero-eyebrow {
  font-family: var(--font-hand);
  color: var(--mustard);
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 600;
  margin: 0 0 18px;
  max-width: 14ch;
}

.hero p {
  font-size: 1.1rem;
  max-width: 52ch;
  color: #DCE6DE;
}

/* ---------- Hero illustration: little swinging signboards ---------- */

.hero-art {
  flex: 0 0 auto;
  display: none;
  align-items: flex-end;
  gap: 30px;
  padding-right: 12px;
}

@media (min-width: 860px) {
  .hero-art { display: flex; }
}

.hero-tag {
  transform-origin: top center;
  animation: hero-swing 4.5s ease-in-out infinite;
}

.hero-tag--1 { animation-delay: 0s; }
.hero-tag--2 { animation-delay: 0.6s; margin-bottom: 22px; }
.hero-tag--3 { animation-delay: 1.2s; margin-bottom: -14px; }

.hero-tag-string {
  width: 2px;
  height: 26px;
  margin: 0 auto;
  background: var(--sage);
  opacity: 0.7;
}

.hero-tag-card {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--chalk);
  border-radius: 8px;
  padding: 14px 20px;
  box-shadow: var(--shadow-lift);
  transform: rotate(-3deg);
}

.hero-tag--2 .hero-tag-card { transform: rotate(2.5deg); }
.hero-tag--3 .hero-tag-card { transform: rotate(-2deg); }

.hero-tag-card--mustard { background: var(--mustard); color: var(--pine-deep); }
.hero-tag-card--brick { background: var(--brick); color: var(--chalk); }

@keyframes hero-swing {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-tag { animation: none; }
}

/* ---------- Signboard grid ---------- */

.signboard-section {
  padding: 48px 0 90px;
}

.signboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 40px 28px;
}

.signboard {
  text-decoration: none;
  color: var(--ink);
  display: block;
  padding-top: 26px;
  position: relative;
  animation: settle 0.5s ease backwards;
}

.signboard:nth-child(2) { animation-delay: 0.06s; }
.signboard:nth-child(3) { animation-delay: 0.12s; }
.signboard:nth-child(4) { animation-delay: 0.18s; }
.signboard:nth-child(5) { animation-delay: 0.24s; }

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.signboard-peg {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pine-deep);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.signboard-string {
  width: 2px;
  height: 22px;
  background: var(--pine-deep);
  margin: 0 auto;
}

.signboard-card {
  background: var(--pine);
  color: var(--chalk);
  border-radius: var(--radius);
  padding: 30px 22px 26px;
  text-align: center;
  box-shadow: var(--shadow-lift);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid rgba(246, 241, 226, 0.12);
}

.signboard:nth-child(even) .signboard-card { --tilt: 1.5deg; }

.signboard:hover .signboard-card,
.signboard:focus-visible .signboard-card {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 0 20px 36px rgba(20, 39, 32, 0.26);
}

.signboard-number {
  font-family: var(--font-hand);
  color: var(--mustard);
  font-size: 1.1rem;
  display: block;
  margin-bottom: 4px;
}

.signboard-icon {
  font-size: 2.6rem;
  margin: 4px 0 12px;
}

.signboard-card h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 4px;
}

.signboard-de {
  font-family: var(--font-hand);
  color: var(--mustard);
  font-size: 1.15rem;
  display: block;
  margin-bottom: 10px;
}

.signboard-tagline {
  font-size: 0.9rem;
  color: #CFDACF;
  margin: 0;
}

/* ---------- Footer note ---------- */

.footer-note {
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--sage);
  padding: 0 0 60px;
}

/* ============================================================
   Topic page
   ============================================================ */

.topic-hero {
  background: var(--pine);
  color: var(--chalk);
  padding: 40px 0 64px;
  border-bottom: 6px solid var(--mustard);
}

.topic-hero .wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.topic-icon {
  font-size: 3.4rem;
  line-height: 1;
}

.topic-heading-group { flex: 1; min-width: 220px; }

.topic-eyebrow {
  font-family: var(--font-hand);
  color: var(--mustard);
  font-size: 1.15rem;
  margin: 0 0 2px;
}

.topic-h1-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topic-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 600;
  margin: 0;
  cursor: pointer;
  border-bottom: 2px dashed var(--mustard);
  padding-bottom: 2px;
}

.topic-tagline {
  margin: 8px 0 0;
  color: #DCE6DE;
}

.speaker-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: var(--mustard);
  color: var(--pine-deep);
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.speaker-btn:hover,
.speaker-btn:focus-visible { background: #F0C265; transform: scale(1.08); }

.speaker-btn:active { transform: scale(0.94); }

.speaker-btn.playing { animation: pulse 0.8s ease infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227, 167, 47, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(227, 167, 47, 0); }
}

/* ---------- Home page topic groups ---------- */

.topic-group + .topic-group {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid #E4DCC6;
}

/* ---------- Section shells ---------- */

.section {
  padding: 56px 0;
}

.section + .section { border-top: 1px solid #E4DCC6; }

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}

.section-heading .num {
  font-family: var(--font-hand);
  color: var(--brick);
  font-size: 1.3rem;
}

.section-heading h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0;
}

.section-hint {
  font-size: 0.9rem;
  color: #5C6355;
  margin: -18px 0 26px;
}

/* ---------- Vocabulary tickets ---------- */

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.ticket {
  background: #FFFDF7;
  border: 1.5px dashed var(--sage);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ticket:hover { border-color: var(--brick); transform: translateY(-2px); }

.ticket-text { flex: 1; min-width: 0; }

.ticket-de {
  font-weight: 700;
  color: var(--pine-deep);
  display: block;
  font-size: 1.02rem;
}

.ticket-en {
  color: #5C6355;
  font-size: 0.9rem;
  display: block;
  margin-top: 2px;
}

.ticket .speaker-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  font-size: 1rem;
  background: var(--sage);
  color: var(--pine-deep);
}

.ticket .speaker-btn:hover,
.ticket .speaker-btn:focus-visible { background: var(--mustard); }

/* ---------- Dialogue cards ---------- */

.dialogue-card {
  background: #FFFDF7;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(20, 39, 32, 0.08);
  padding: 26px 24px;
  margin-bottom: 26px;
  border-top: 4px solid var(--brick);
}

.dialogue-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.dialogue-card-head h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
}

.play-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brick);
  color: var(--chalk);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.15s ease, transform 0.15s ease;
}

.play-all-btn:hover, .play-all-btn:focus-visible { background: #9c3c22; transform: translateY(-1px); }

.dialogue-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
}

.dialogue-line + .dialogue-line { border-top: 1px dashed #E4DCC6; }

.dialogue-speaker {
  font-family: var(--font-hand);
  color: var(--brick);
  font-size: 1.05rem;
  min-width: 78px;
  padding-top: 6px;
}

.dialogue-text { flex: 1; min-width: 0; }

.dialogue-de {
  font-weight: 700;
  color: var(--pine-deep);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dialogue-de:hover .dialogue-de-label { border-color: var(--brick); }

.dialogue-de-label { border-bottom: 2px dashed var(--sage); }

.dialogue-en {
  color: #5C6355;
  font-size: 0.92rem;
  margin-top: 3px;
}

.dialogue-line .speaker-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 0.85rem;
  background: transparent;
  color: var(--brick);
}

.dialogue-line .speaker-btn:hover,
.dialogue-line .speaker-btn:focus-visible { background: var(--mustard); color: var(--pine-deep); }

/* ---------- Empty / not-found state ---------- */

.empty-state {
  padding: 100px 0;
  text-align: center;
}

.empty-state h1 { font-family: var(--font-display); }

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .topic-hero .wrap { flex-direction: column; align-items: flex-start; }
  .dialogue-line { flex-wrap: wrap; }
  .dialogue-speaker { min-width: 100%; padding-top: 0; }
}
