/* BriefBerlin Custom Styles */

/* ==========================================================================
   Full Width Layout Override
   ========================================================================== */

/* Override Minimal Mistakes theme's content width constraints */
.page {
  width: 100%;
  max-width: 100%;
}

.page__inner-wrap {
  max-width: 100%;
  padding: 0 1.5em;
}

@media (min-width: 80em) {
  .page__inner-wrap {
    padding: 0 3em;
  }
}

/* Force full-width layout - remove sidebar completely */
.layout--home .sidebar {
  display: none !important;
}

.layout--home .page {
  width: 100% !important;
  float: none !important;
}

.layout--home .archive {
  width: 100% !important;
  float: none !important;
  padding: 0 !important;
}

/* Hide theme's default Recent Posts block on the homepage. */
.layout--home .archive__subtitle,
.layout--home .entries-list {
  display: none !important;
}

/* Remove any left margins/padding that create empty space */
@media (min-width: 64em) {
  .page {
    width: 100% !important;
    padding-right: 0 !important;
  }

  .page__content {
    width: 100% !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
  }
}

/* Hide page title on home layout to avoid duplicate site heading */
.layout--home .page__title {
  display: none;
}

/* Hide unused “Toggle Menu” button when there is no navigation */
.layout--single .greedy-nav__toggle {
  display: none;
}

/* Center content with reasonable max-width for readability */
.home-overview,
.filter-section,
.articles-grid,
.pagination {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ==========================================================================
   Site Title
   ========================================================================== */

.site-title::before {
  content: "🐻 ";
  font-size: 1.2em;
  margin-right: 0.3em;
}

.site-title::after {
  content: " – Deutsch lernen mit aktuellen Artikeln";
  font-size: 0.85em;
  font-weight: 500;
  color: #6c757d;
  margin-left: 0.5em;
}

/* ==========================================================================
   Level Badges
   ========================================================================== */

.level-badge {
  display: inline-block;
  padding: 0.25em 0.75em;
  font-size: 0.875em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.375em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5em;
}

.level-badge.level-a2 {
  background-color: #28a745;
  color: #ffffff;
}

.level-badge.level-b1 {
  background-color: #007bff;
  color: #ffffff;
}

/* ==========================================================================
   Homepage Sections
   ========================================================================== */

.home-overview {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(520px, 1.35fr);
  align-items: center;
  gap: 1.4rem;
  margin-top: 0.85rem;
  margin-bottom: 1.15rem;
  padding: 1.15rem 1.25rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 1em;
  box-shadow: 0 16px 42px rgba(102, 126, 234, 0.18);
  color: #ffffff;
}

.home-overview__intro h1 {
  margin: 0 0 0.45rem;
  color: #ffffff;
  font-size: 1.9rem;
  line-height: 1.12;
}

.home-overview__intro p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.45;
}

.home-overview__learning {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.level-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.level-box {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 5.1rem;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.85rem;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.level-box:hover,
.level-box:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 28px rgba(39, 24, 92, 0.18);
  outline: none;
  transform: translateY(-2px);
}

.level-box .level-badge {
  flex: 0 0 auto;
  margin-top: 0.2rem;
  margin-right: 0;
}

.level-box__text {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.level-box__text strong {
  color: #ffffff;
  font-size: 1.05rem;
  line-height: 1.2;
}

.level-box__text span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.35;
}

.welcome-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(245, 87, 108, 0.28);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.welcome-link:hover,
.welcome-link:focus-visible {
  box-shadow: 0 16px 36px rgba(245, 87, 108, 0.36);
  color: #ffffff;
  outline: none;
  transform: translateY(-2px);
}

.welcome-link span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

.welcome-link strong {
  color: #ffffff;
  font-size: 0.95rem;
}

.welcome-link i {
  color: #ffffff;
  transition: transform 0.2s ease;
}

.welcome-link:hover i,
.welcome-link:focus-visible i {
  transform: translateX(3px);
}

@media (max-width: 1100px) {
  .home-overview {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 768px) {
  .site-title::after {
    content: "";
  }

  .home-overview {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 1rem;
  }

  .home-overview__intro h1 {
    font-size: 1.45rem;
  }

  .level-info {
    grid-template-columns: 1fr;
  }

  .level-box {
    min-height: 0;
  }

  .welcome-link {
    justify-self: stretch;
    justify-content: space-between;
    white-space: normal;
  }
}

/* ==========================================================================
   Featured Section
   ========================================================================== */

.featured-section {
  margin: 3em auto;
  max-width: 1400px;
}

.featured-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #ffffff;
  padding: 0.5em 1.5em;
  border-radius: 2em 2em 0 0;
  font-weight: 700;
  font-size: 0.875em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: -1px;
}

.featured-badge i {
  margin-right: 0.5em;
}

.featured-card {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  border: 3px solid #f5576c;
  border-radius: 0 1em 1em 1em;
  padding: 2em;
  box-shadow: 0 10px 40px rgba(245, 87, 108, 0.2);
  transition: all 0.3s ease;
}

.featured-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 50px rgba(245, 87, 108, 0.3);
}

.featured-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2em;
}

.featured-text h2 {
  color: #2c3e50;
  margin: 0 0 0.5em 0;
  font-size: 1.75em;
}

.featured-text p {
  color: #34495e;
  margin: 0;
  font-size: 1.1em;
  line-height: 1.6;
}

.featured-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  padding: 1em 2em;
  border-radius: 2em;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.featured-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  color: #ffffff;
}

.featured-btn i {
  margin-left: 0.5em;
  transition: transform 0.3s ease;
}

.featured-btn:hover i {
  transform: translateX(5px);
}

@media (max-width: 768px) {
  .featured-content {
    flex-direction: column;
    align-items: stretch;
  }

  .featured-btn {
    text-align: center;
  }

  .featured-text h2 {
    font-size: 1.5em;
  }
}

/* ==========================================================================
   Filter Section
   ========================================================================== */

.filter-section {
  margin-bottom: 2em;
}

.filter-section h2 {
  margin-bottom: 1em;
}

.filter-buttons {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5em 1.5em;
  border: 2px solid #dee2e6;
  background: #ffffff;
  color: #495057;
  border-radius: 2em;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: #007bff;
  color: #007bff;
}

.filter-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: #ffffff;
}

.level-explainer {
  margin-top: 1em;
  font-weight: 600;
  color: #495057;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.level-explainer.active {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Articles Grid
   ========================================================================== */

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2em;
  margin-bottom: 3em;
  max-width: 100%;
}

/* Force grid to show multiple columns on larger screens */
@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .articles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.article-card {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 1em;
  padding: 1.25em 1.25em 1.1em;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.article-card:hover,
.article-card:focus-visible {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
  border-color: #007bff;
  color: inherit;
  text-decoration: none;
}

.article-card:focus-visible {
  outline: 3px solid rgba(0, 123, 255, 0.35);
  outline-offset: 3px;
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.article-date {
  color: #6c757d;
  font-size: 0.875em;
}

.article-title {
  margin: 0 0 0.75em 0;
  font-size: 1.25em;
  color: #212529;
}

.article-card:hover .article-title,
.article-card:focus-visible .article-title {
  color: #007bff;
}

.article-excerpt {
  color: #6c757d;
  line-height: 1.6;
  margin-bottom: 0.75em;
}

.article-card .article-meta {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 1em;
  font-size: 0.875em;
  color: #6c757d;
}

.article-meta i {
  margin-right: 0.25em;
}

.topics {
  display: flex;
  gap: 0.5em;
}

.topic-tag {
  background: #e9ecef;
  padding: 0.25em 0.5em;
  border-radius: 0.25em;
  font-size: 0.875em;
}

.read-more {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  align-self: flex-start;
}

.read-more:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* ==========================================================================
   Article Content
   ========================================================================== */

.layout--post .page {
  float: none !important;
  width: 100% !important;
  padding-right: 0 !important;
}

.layout--post .page__inner-wrap {
  float: none !important;
  display: block;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5em;
  padding-right: 1.5em;
  box-sizing: border-box;
}

.layout--post .page__content {
  font-size: 1.05rem;
  line-height: 1.65;
}

.layout--post .page__content p {
  margin-bottom: 1.35em;
}

.page__inner-wrap > header .article-meta {
  display: flex;
  gap: 1.5em;
  flex-wrap: wrap;
  margin: 1.5em 0;
  padding: 1em;
  background: #f8f9fa;
  border-radius: 0.5em;
  font-size: 0.875em;
  color: #6c757d;
}

.page__sources {
  margin-top: 1em;
  padding: 1em;
  background: #f8f9fa;
  border-left: 4px solid #007bff;
  border-radius: 0.25em;
}

/* Vocabulary Section Styling */
.page__content h2 {
  color: #007bff;
  border-bottom: 2px solid #007bff;
  padding-bottom: 0.5em;
  margin-top: 2em;
}

.page__content ul li strong {
  color: #212529;
  font-weight: 700;
}

/* ==========================================================================
   Related Posts ("You May Also Enjoy")
   ========================================================================== */

/* Override Minimal Mistakes' sidebar-based layout for related posts.
   Keep same container width as main text (via .page__inner-wrap),
   but control layout inside the section. */
.page__related {
  float: none;
  width: 100%;
  margin-top: 3em;
  padding-top: 1em;
  padding-left: 1.5em;
  border-top: 1px solid #dee2e6;
}

/* Ensure the related posts heading aligns with other section headings. */
.page__related-title {
  margin-bottom: 1.5em;
  font-size: 0.9rem;
  text-transform: uppercase;
}

/* Layout for related-post cards: two flexible columns with gaps. */
.page__related .grid__wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.page__related .grid__item {
  flex: 1 1 calc(50% - 2rem); /* two columns on desktop */
  min-width: 320px;           /* avoid overly narrow text */
  margin-left: 0;
}

@media (max-width: 768px) {
  .page__related .grid__item {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* ==========================================================================
   Article Audio Player
   ========================================================================== */

.article-audio {
  margin: 1.25rem 0 1.5rem;
  width: 100%;
  max-width: 920px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.article-audio__native {
  width: 100%;
}

.article-audio__player {
  display: none;
}

.article-audio.is-enhanced .article-audio__native {
  display: none;
}

.article-audio.is-enhanced .article-audio__player {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "timeline timeline"
    "transport speed";
  align-items: center;
  column-gap: 1.25rem;
  row-gap: 0.7rem;
  padding: 0.85rem;
  background: rgba(248, 248, 250, 0.92);
  border: 1px solid rgba(60, 60, 67, 0.14);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
}

.article-audio__transport {
  grid-area: transport;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: start;
}

.article-audio__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.12);
  cursor: pointer;
  appearance: none;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.article-audio__button:hover,
.article-audio__button:focus-visible {
  background: #f2f2f7;
  color: #007bff;
  outline: none;
  transform: translateY(-1px);
}

.article-audio__button span {
  margin-left: 0.14rem;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.article-audio__skip-back,
.article-audio__skip-forward {
  width: 58px;
}

.article-audio__play {
  width: 56px;
  height: 56px;
  background: #111111;
  color: #ffffff;
  box-shadow: none;
}

.article-audio__play:hover,
.article-audio__play:focus-visible {
  background: #007bff;
  color: #ffffff;
}

.article-audio__timeline {
  grid-area: timeline;
  min-width: 0;
  width: 100%;
}

.article-audio__time {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 0.15rem;
  color: #6e6e73;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.article-audio__waveform {
  --audio-progress: 0%;
  display: grid;
  grid-template-columns: repeat(96, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0.15rem 0;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
}

.article-audio__waveform:focus-visible {
  outline: 3px solid rgba(0, 123, 255, 0.25);
  outline-offset: 3px;
}

.article-audio__waveform-bar {
  height: var(--bar-height);
  min-width: 0;
  min-height: 12px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.26);
  transition: background 0.12s ease;
}

.article-audio__waveform-bar.is-played {
  background: #007bff;
}

.article-audio__speed {
  grid-area: speed;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 360px;
  min-width: 0;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.08);
  overflow: hidden;
}

.article-audio__speed button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.8rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1d1d1f;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
}

.article-audio__speed button:hover,
.article-audio__speed button:focus-visible {
  color: #007bff;
  outline: none;
}

.article-audio__speed button.is-active {
  background: #ffffff;
  color: #007bff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

@media (max-width: 760px) {
  .article-audio.is-enhanced .article-audio__player {
    column-gap: 0.65rem;
  }

  .article-audio__transport {
    gap: 0.35rem;
  }

  .article-audio__skip-back,
  .article-audio__skip-forward {
    width: 50px;
  }

  .article-audio__play {
    width: 48px;
    height: 48px;
  }

  .article-audio__speed {
    max-width: 280px;
  }

  .article-audio__speed button {
    padding: 0 0.35rem;
    font-size: 0.84rem;
  }
}

@media (max-width: 400px) {
  .article-audio.is-enhanced .article-audio__player {
    grid-template-columns: 1fr;
    grid-template-areas:
      "transport"
      "timeline"
      "speed";
  }

  .article-audio__transport {
    justify-content: center;
  }

  .article-audio__speed {
    justify-self: center;
    width: min(100%, 360px);
    max-width: 100%;
  }
}

@media (max-width: 400px) {
  .article-audio {
    max-width: 100%;
  }

  .article-audio.is-enhanced .article-audio__player {
    grid-template-columns: 1fr;
    grid-template-areas:
      "transport"
      "timeline"
      "speed";
    gap: 0.55rem;
    padding: 0.65rem;
    border-radius: 16px;
  }

  .article-audio__play {
    width: 48px;
    height: 48px;
  }

  .article-audio__waveform {
    min-height: 38px;
  }
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2em;
  padding: 2em 0;
}

.pagination-btn {
  padding: 0.75em 1.5em;
  background: #007bff;
  color: #ffffff;
  text-decoration: none;
  border-radius: 0.5em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pagination-btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.pagination-info {
  color: #6c757d;
  font-weight: 600;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  .site-title::after {
    content: "";
  }

  .level-info {
    grid-template-columns: 1fr;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .filter-buttons {
    justify-content: center;
  }

  .pagination {
    flex-direction: column;
    gap: 1em;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .filter-section,
  .pagination,
  .article-meta,
  .article-card .article-meta,
  .page__inner-wrap > header .article-meta,
  .page__share {
    display: none;
  }

  .article-card {
    border: 1px solid #000;
    page-break-inside: avoid;
  }
}
