/*
Theme Name: NBM
Author: Big Boys Media LLC
Description: Custom theme for NBM baseball media.
Version: 1.0.0
Text Domain: nbm
*/

/* ==========================================================================
   NBM homepage stylesheet
   Breakpoints: 907px (tablet and below), 780px (mobile), 480px (small phones)
   ========================================================================== */

:root {
  --brand-blue: #0d4f9b;
  --text: #333;
  --card-border: 1px solid rgba(0, 0, 0, 0.125);
  --avatar: clamp(110px, 17vw, 200px);
  --avatar-border: 5px solid rgba(0, 0, 0, 0.6);
  --ad-gray: #8c8e93;
  --overlay: linear-gradient(
    to top,
    rgba(26, 26, 26, 0.95) 0,
    rgba(26, 26, 26, 0.7) 30%,
    transparent 50%
  );
}

/* ---------- Base ---------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Links: brand blue, never underlined (classes below override the color) */
a {
  color: var(--brand-blue);
  text-decoration: none;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 20px;
  background-color: var(--brand-blue);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 40px;
  flex: 1;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.logo img {
  display: block;
  height: 70px;
  width: auto;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 40px;
  list-style: none;
}

.nav-menu li a {
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.nav-menu li a:hover {
  opacity: 0.8;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.search-icon img {
  width: 100%;
  height: 100%;
}

.search-icon:hover {
  transform: scale(1.1);
}

.hamburger {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  gap: 5px;
  padding: 10px;
  cursor: pointer;
}

.hamburger span {
  width: 30px;
  height: 3px;
  background-color: #fff;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.logo-text {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.search-icon svg {
  width: 28px;
  height: 28px;
}

/* Search dropdown */

.search-dropdown {
  position: absolute;
  top: 80px;
  left: 0;
  right: 0;
  z-index: 99;
  max-height: 0;
  overflow: hidden;
  background-color: var(--brand-blue);
  transition: max-height 0.3s ease;
}

.search-dropdown.active {
  max-height: 100px;
  padding: 20px;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 10px 16px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

/* ==========================================================================
   Homepage layout
   ========================================================================== */

main#marquee-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* mobile/tablet: main column only */
  gap: 24px;
  align-content: start;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

.nbm-l-section-bg {
  min-width: 0;
}

/* Sidebars: desktop only */
.sidebar {
  display: none;
}

/* Sidebars show from 1200px up, with 100px between them and the content.
   (Narrower, the center column would be too slim, so only banner ads show.) */
@media (min-width: 1200px) {
  main#marquee-container {
    grid-template-columns: 220px minmax(0, 1fr) 220px;
    column-gap: 100px;
  }

  /* Sidebar = transparent vertical stack of widgets (links card, ads, etc.) */
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  /* Only the right-hand ad stays in view while scrolling: Google doesn't
     allow sticky ads on both sides of the content. The left ad scrolls normally. */
  .sidebar-right .ad {
    position: sticky;
    top: 16px;
  }
}

.card {
  width: 100%;
  margin: 16px 0;
}

/* ---------- Top story: hero card + headlines card ---------- */

.top-story {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;          /* safety net if the center column gets narrow */
  align-items: stretch;
  gap: 24px;
  margin-bottom: 16px;
}

.hero-card {
  position: relative;
  flex: 2 1 380px;
  min-width: 0;
  min-height: 200px;
  overflow: hidden;
  border-radius: 6px;
}

.hero-card img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hero-card-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  background: var(--overlay);
}

.hero-card h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
  color: #fff;
}

.headlines-card {
  flex: 1 1 240px;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  background: #fff;
  border: var(--card-border);
  border-radius: 6px;
}

.headlines-card h5 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 600;
}

.headlines-card a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.headlines-card a:hover span {
  color: var(--brand-blue);
}

.row-card h5 a {
  color: inherit;
  text-decoration: none;
}

.headlines-card span {
  display: block;
  padding: 10px 0;
  line-height: 1.4;
  color: var(--text);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* ---------- Sidebar widgets ---------- */

.widget-card {
  padding: 20px;
  background: #f5f5f5;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.widget-card h5 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 600;
}

.widget-card ul {
  list-style: none;
}

.widget-card li + li {
  margin-top: 10px;
}

.widget-card a {
  color: var(--brand-blue);
  text-decoration: none;
}

.widget-card a:hover {
  text-decoration: underline;
}

/* ---------- Ads ----------
   .ad is the gray container and holds the "Advertisement" label.
   .ad-slot is the fixed-size box AdSense fills; its sizes must match the
   data-size-* attributes in the HTML so the page never shifts. */

.ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  overflow: hidden;
  background: var(--ad-gray);
  border-radius: 6px;
}

.ad::before {
  content: "Advertisement";
  align-self: stretch;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
}

.ad-slot {
  max-width: 100%;
  overflow: hidden;
  line-height: 0;
  background: rgba(255, 255, 255, 0.12);
}

/* Banners span the full grid width */
.ad--banner {
  grid-column: 1 / -1;
}

.ad--banner .ad-slot {
  width: 320px;
  height: 100px;
}

/* Sidebar ads: the label runs vertically down the left edge */
.ad--sidebar {
  flex-direction: row;
}

.ad--sidebar::before {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.ad--sidebar .ad-slot {
  width: 160px;
  height: 600px;
}

/* Banners on pages without the grid (single post) */
.site-main > .ad--banner:first-child {
  margin-bottom: 32px;
}

.site-main > .ad--banner:last-child {
  margin-top: 32px;
}

@media (min-width: 908px) {
  .ad--banner .ad-slot {
    width: 728px;
    height: 90px;
  }
}

/* ---------- Row cards ---------- */

.row-card {
  padding: 10px 0;
}

.row-card h5 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 600;
}

.row-card__items {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

.row-item {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.row-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.row-item span {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
  text-align: left;
  color: var(--text);
}

/* ==========================================================================
   Inner pages (archive, category, single post, 404)
   ========================================================================== */

.site-main {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 60px 40px;
}

/* 404: centered in the available height */
.site-main--center {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 780px) {
  .site-main {
    padding: 30px 20px;
  }
}

.no-results {
  padding: 40px 0;
  text-align: center;
  color: var(--text);
}

/* Clickable hero card (category page) */
a.hero-card {
  display: block;
  background: #1a1a1a;
  color: inherit;
  text-decoration: none;
}

/* ---------- Post card (archive + category grids) ---------- */

.post-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: var(--card-border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.post-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.post-card-body {
  padding: 12px;
}

.post-card-body h3,
.post-card-body h4 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.card-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  padding: 0;
  font-size: 0.85rem;
}

.pagination a,
.pagination span {
  color: #000;
  text-decoration: none;
}

.pagination .current {
  font-weight: 700;
}

/* ---------- Archive ---------- */

.archive-wrap {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.archive-wrap img {
  max-width: 100%;
}

/* Inside the sidebar grid the column already supplies the spacing */
.nbm-l-section-bg .archive-wrap {
  max-width: none;
  padding: 0 0 24px;
}

.profile {
  position: relative;
  margin-bottom: 32px;
  padding-top: calc(var(--avatar) * 0.12);
  min-height: var(--avatar);
}

.profile-avatar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: var(--avatar);
  height: var(--avatar);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
  border: var(--avatar-border);
  border-radius: 50%;
}

.profile-avatar img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;   /* e.g. "center top" to keep faces in frame */
  border-radius: 50%;
}

.profile-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  min-height: calc(var(--avatar) * 0.67);
  margin-left: calc(var(--avatar) / 2);
  padding: 16px 20px 16px calc(var(--avatar) / 2 + 24px);
  background: #fff;
  border-radius: 8px;
}

.profile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.profile-name {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
}

.profile-desc {
  font-size: clamp(0.85rem, 1.6vw, 1.1rem);
  line-height: 1.4;
}

.profile-links {
  display: flex;
  gap: 16px;
}

.profile-links a {
  display: flex;
  width: 26px;
  height: 26px;
  color: var(--brand-blue);
}

.profile-links svg {
  width: 100%;
  height: 100%;
}

/* ---------- Search results header ---------- */

.search-term {
  margin: 24px 0 32px;
}

.search-term-header {
  padding: 0;
}

.search-term-header h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* ---------- Category page ---------- */

.category-section {
  margin-top: 48px;
}

.section-heading {
  margin: 0 0 12px;
}

.section-heading a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Single post ---------- */

.sp-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  background-color: #fff;
}

.cena {
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  gap: 24px;
}

.cena-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: var(--card-border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.cena-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.cena-card-body {
  padding: 16px;
}

.cena-card h3 {
  margin: 0;
  padding: 12px 0 16px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}

.cena-col {
  flex: 1 1 640px;
  min-width: 0;
}

.cena-title,
.page-title {
  margin: 0 0 20px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.cena-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cena-category {
  padding: 6px;
  background: #1a5fc4;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-transform: uppercase;
}

.cena-date,
.cena-author {
  font-size: 15px;
  color: var(--text);
}

.cena-author {
  margin: 0 0 20px;
}

.cena-author a {
  color: inherit;
}

.cena-hero {
  display: block;
  width: 85%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 30px;
}

.article-body {
  font-size: 16px;
  line-height: 1.7;
  color: #222;
}

.article-body p {
  margin: 0 0 1.2em;
}

.article-body img,
.article-body video {
  max-width: 100%;
  height: auto;
}

.article-body iframe {
  max-width: 100%;
}

.article-body h2,
.article-body h3 {
  margin: 1.5em 0 0.6em;
}

/* Embedded video fills the column at 16:9 (fallback when WordPress's own
   responsive-embed CSS isn't active; WordPress's rules win when they are). */
.wp-block-embed {
  margin: 0 0 1.2em;
}

.wp-block-embed.is-type-video iframe,
.article-body iframe[src*="youtube"],
.article-body iframe[src*="youtu.be"],
.article-body iframe[src*="vimeo"] {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.content-cards-sp {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 24px;
  margin-top: 40px;
}

.content-card-sp {
  display: block;
  width: 320px;
  max-width: 100%;
  background: #ccd2d9;
  color: inherit;
  text-decoration: none;
}

.content-card-sp img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.content-card-sp h2 {
  margin: 0;
  padding: 14px 16px 0;
  font-size: 20px;
  font-weight: 400;
}

.content-card-sp .card-date {
  display: block;
  padding: 4px 16px 14px;
  font-size: 14px;
  color: var(--text);
}

/* ---------- Site pages (page.php) ----------
   Uses the same grid as the homepage (main#marquee-container). */

.page-content {
  min-width: 0;
}

/* ---------- 404 ---------- */

.error-message-for-404 {
  padding: 20px;
  text-align: center;
}

/* ---------- Inner pages: card grids next to the sidebars ---------- */

/* Category: 2-up cards stack into one column at tablet width and below */
@media (max-width: 907px) {
  .card-grid--2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Archive and search: 3-up becomes 2-up while the sidebars squeeze the center column */
@media (min-width: 1200px) and (max-width: 1399px) {
  .nbm-l-section-bg .card-grid:not(.card-grid--2) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Inner pages: mobile ---------- */

@media (max-width: 780px) {
  .card-grid:not(.card-grid--2) {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Profile: avatar overlaps the left of the bar */
  .profile {
    display: flex;
    align-items: center;
    padding-top: 0;
  }

  .profile-avatar {
    position: relative;
    top: auto;
    left: auto;
    flex-shrink: 0;
    margin-right: calc(var(--avatar) / -2);
  }

  .profile-bar {
    flex: 1;
    justify-content: center;
    min-width: 0;
    margin-left: 0;
    padding: 14px 14px 14px calc(var(--avatar) / 2 + 14px);
  }

  .profile-top {
    flex-direction: column;
    gap: 8px;
  }

  .profile-links {
    gap: 12px;
  }

  .profile-links a {
    width: 22px;
    height: 22px;
  }

  .profile-name,
  .profile-desc {
    overflow-wrap: anywhere;
  }

  /* Single post */
  .cena {
    display: none;
  }

  .cena-title,
  .page-title {
    font-size: 32px;
    text-align: center;
  }

  .cena-meta {
    justify-content: center;
  }

  .cena-author {
    text-align: center;
  }

  .cena-hero {
    margin: 0 auto 30px;
  }

  .content-cards-sp {
    flex-direction: column;
    align-items: center;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  padding: 60px 20px 20px;
  background-color: var(--brand-blue);
  color: #fff;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 60px;
  max-width: 1200px;
  margin: 0 auto 40px;
}

.footer-left {
  flex-shrink: 0;
}

.footer-logo {
  height: 120px;
  width: auto;
}

.footer-links {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 60px;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 140px;
  max-width: 280px;
}

.footer-column h3 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 1px;
}

.footer-column a {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  transition: opacity 0.3s ease;
}

.footer-column a:hover {
  opacity: 0.7;
}

.footer-social-icons {
  display: flex;
  gap: 16px;
}

.footer-social-icons a {
  display: flex;
  width: 24px;
  height: 24px;
}

.footer-social-icons svg {
  width: 100%;
  height: 100%;
}

/* Blocks and widgets inside a footer column stack vertically */
.footer-column .widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-column h2,
.footer-column h4 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 1px;
}

.footer-column p {
  margin: 0;
  color: #fff;
}

.footer-column .wp-block-navigation__container {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* Footer widgets: menu lists and text widgets stack like the default links */
.footer-column ul,
.footer-column .textwidget {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}

.footer-bottom p {
  font-size: 14px;
  opacity: 0.8;
}

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

/* ---------- Tablet and below ---------- */
@media (max-width: 907px) {
  /* Navbar becomes hamburger menu */
  .navbar {
    padding: 0 15px;
  }

  .logo img {
    height: 60px;
  }

  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    z-index: 100;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    background-color: var(--brand-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: max-height 0.3s ease;
  }

  .nav-menu.active {
    max-height: 400px;
  }

  .nav-menu li {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  /* Top story stacks: hero first, headlines below */
  .top-story {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .hero-card,
  .headlines-card {
    flex: 0 0 auto;
  }

  /* Row cards stack */
  .row-card__items {
    flex-direction: column;
  }

  .row-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .row-item img {
    width: 80%;
    max-width: 320px;
  }

  .row-item span {
    text-align: center;
  }
}

/* ---------- Footer stacks ---------- */
@media (max-width: 907px) {
  .footer {
    padding: 40px 20px 20px;
  }

  .footer-content {
    flex-direction: column;
    align-items: center;
    gap: 40px;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: 30px;
    width: 100%;
  }

  .footer-logo {
    height: 100px;
  }

  .footer-social-icons {
    justify-content: center;
  }

  .footer-column {
    max-width: none;
  }

  .footer-column .wp-block-navigation__container {
    align-items: center;
  }
}

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
  .logo img {
    height: 59px;
  }

  .search-icon {
    width: 35px;
    height: 35px;
  }

  .footer-logo {
    height: 80px;
  }

  .footer-links {
    gap: 25px;
  }
}
