/* ==========================================================================
   HAMCO Sports News - Layout System
   Container, grid, flexbox, content-sidebar, and responsive utilities
   ========================================================================== */

/* ---- Container ---- */
.hn-container {
  width: 100%;
  max-width: var(--hn-container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--hn-space-6);
  padding-right: var(--hn-space-6);
}

.hn-container--sm {
  max-width: var(--hn-container-sm);
}

.hn-container--md {
  max-width: var(--hn-container-md);
}

.hn-container--lg {
  max-width: var(--hn-container-lg);
}

.hn-container--full {
  max-width: var(--hn-container-max);
}

@media (max-width: 768px) {
  .hn-container {
    padding-left: var(--hn-space-4);
    padding-right: var(--hn-space-4);
  }
}

/* ---- CSS Grid System (12-Column) ---- */
.hn-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--hn-space-6);
}

.hn-grid--gap-sm { gap: var(--hn-space-4); }
.hn-grid--gap-lg { gap: var(--hn-space-8); }
.hn-grid--gap-xl { gap: var(--hn-space-10); }
.hn-grid--gap-0 { gap: 0; }

/* Column spans */
.hn-col-1  { grid-column: span 1; }
.hn-col-2  { grid-column: span 2; }
.hn-col-3  { grid-column: span 3; }
.hn-col-4  { grid-column: span 4; }
.hn-col-5  { grid-column: span 5; }
.hn-col-6  { grid-column: span 6; }
.hn-col-7  { grid-column: span 7; }
.hn-col-8  { grid-column: span 8; }
.hn-col-9  { grid-column: span 9; }
.hn-col-10 { grid-column: span 10; }
.hn-col-11 { grid-column: span 11; }
.hn-col-12 { grid-column: span 12; }

/* ---- Grid Shortcuts ---- */
.hn-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--hn-space-6);
}

.hn-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--hn-space-6);
}

.hn-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--hn-space-6);
}

/* ---- Grid Shortcut Responsive ---- */
@media (max-width: 1024px) {
  .hn-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .hn-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hn-grid-4,
  .hn-grid-3,
  .hn-grid-2 {
    grid-template-columns: 1fr;
  }

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

  .hn-col-1, .hn-col-2, .hn-col-3, .hn-col-4,
  .hn-col-5, .hn-col-6, .hn-col-7, .hn-col-8,
  .hn-col-9, .hn-col-10, .hn-col-11, .hn-col-12 {
    grid-column: span 1;
  }
}

/* ---- Responsive Column Overrides ---- */
@media (min-width: 768px) {
  .hn-col-md-3  { grid-column: span 3; }
  .hn-col-md-4  { grid-column: span 4; }
  .hn-col-md-6  { grid-column: span 6; }
  .hn-col-md-8  { grid-column: span 8; }
  .hn-col-md-9  { grid-column: span 9; }
  .hn-col-md-12 { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .hn-col-lg-3  { grid-column: span 3; }
  .hn-col-lg-4  { grid-column: span 4; }
  .hn-col-lg-6  { grid-column: span 6; }
  .hn-col-lg-8  { grid-column: span 8; }
  .hn-col-lg-9  { grid-column: span 9; }
  .hn-col-lg-12 { grid-column: span 12; }
}

/* ---- Content + Sidebar Layout ---- */
.hn-content-sidebar {
  display: grid;
  grid-template-columns: minmax(0, var(--hn-content-width)) var(--hn-sidebar-width);
  gap: var(--hn-content-gap);
  align-items: start;
}

.hn-content-sidebar__main {
  min-width: 0;
}

.hn-content-sidebar__sidebar {
  min-width: 0;
}

.hn-sidebar--sticky {
  position: sticky;
  top: calc(var(--hn-header-height-sticky) + var(--hn-space-6));
}

@media (max-width: 1024px) {
  .hn-content-sidebar {
    grid-template-columns: 1fr;
    gap: var(--hn-space-10);
  }

  .hn-sidebar--sticky {
    position: static;
  }
}

/* ---- Flexbox Utilities ---- */
.hn-flex {
  display: flex;
}

.hn-flex-col {
  display: flex;
  flex-direction: column;
}

.hn-flex-wrap {
  flex-wrap: wrap;
}

.hn-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hn-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hn-flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.hn-flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hn-items-start { align-items: flex-start; }
.hn-items-center { align-items: center; }
.hn-items-end { align-items: flex-end; }
.hn-items-stretch { align-items: stretch; }

.hn-justify-start { justify-content: flex-start; }
.hn-justify-center { justify-content: center; }
.hn-justify-end { justify-content: flex-end; }
.hn-justify-between { justify-content: space-between; }

.hn-flex-1 { flex: 1; }
.hn-flex-shrink-0 { flex-shrink: 0; }
.hn-flex-grow { flex-grow: 1; }

.hn-gap-1 { gap: var(--hn-space-1); }
.hn-gap-2 { gap: var(--hn-space-2); }
.hn-gap-3 { gap: var(--hn-space-3); }
.hn-gap-4 { gap: var(--hn-space-4); }
.hn-gap-6 { gap: var(--hn-space-6); }
.hn-gap-8 { gap: var(--hn-space-8); }

/* ---- Section Spacing ---- */
.hn-section {
  padding-top: var(--hn-space-12);
  padding-bottom: var(--hn-space-12);
}

.hn-section--sm {
  padding-top: var(--hn-space-8);
  padding-bottom: var(--hn-space-8);
}

.hn-section--lg {
  padding-top: var(--hn-space-16);
  padding-bottom: var(--hn-space-16);
}

@media (max-width: 768px) {
  .hn-section {
    padding-top: var(--hn-space-8);
    padding-bottom: var(--hn-space-8);
  }

  .hn-section--lg {
    padding-top: var(--hn-space-12);
    padding-bottom: var(--hn-space-12);
  }
}

/* ---- Display Utilities ---- */
.hn-block { display: block; }
.hn-inline-block { display: inline-block; }
.hn-inline { display: inline; }
.hn-hidden { display: none; }

.hn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Responsive Visibility ---- */
@media (max-width: 767px) {
  .hn-hide-mobile { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hn-hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
  .hn-hide-desktop { display: none !important; }
}

@media (max-width: 1023px) {
  .hn-show-desktop-only { display: none !important; }
}

@media (min-width: 768px) {
  .hn-show-mobile-only { display: none !important; }
}

/* ---- Spacing Utilities ---- */
.hn-mb-0 { margin-bottom: 0; }
.hn-mb-2 { margin-bottom: var(--hn-space-2); }
.hn-mb-4 { margin-bottom: var(--hn-space-4); }
.hn-mb-6 { margin-bottom: var(--hn-space-6); }
.hn-mb-8 { margin-bottom: var(--hn-space-8); }
.hn-mb-12 { margin-bottom: var(--hn-space-12); }

.hn-mt-0 { margin-top: 0; }
.hn-mt-2 { margin-top: var(--hn-space-2); }
.hn-mt-4 { margin-top: var(--hn-space-4); }
.hn-mt-6 { margin-top: var(--hn-space-6); }
.hn-mt-8 { margin-top: var(--hn-space-8); }

.hn-p-4 { padding: var(--hn-space-4); }
.hn-p-6 { padding: var(--hn-space-6); }
.hn-p-8 { padding: var(--hn-space-8); }

/* ---- Width Utilities ---- */
.hn-w-full { width: 100%; }
.hn-h-full { height: 100%; }
.hn-min-h-screen { min-height: 100vh; }

/* ---- Content + Sidebar Grid (used in single.php, category.php) ---- */
.hn-content-sidebar__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) var(--hn-sidebar-width);
  gap: var(--hn-content-gap);
  align-items: start;
}

@media (max-width: 1024px) {
  .hn-content-sidebar__grid {
    grid-template-columns: 1fr;
    gap: var(--hn-space-10);
  }
}

/* ---- Content Main Area ---- */
.hn-content-main {
  min-width: 0;
}

/* ---- Sidebar ---- */
.hn-sidebar {
  min-width: 0;
  position: sticky;
  top: calc(var(--hn-header-height-sticky) + var(--hn-space-6));
}

@media (max-width: 1024px) {
  .hn-sidebar {
    position: static;
  }
}

/* ---- News Grid ---- */
.hn-news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--hn-space-6);
}

@media (max-width: 1024px) {
  .hn-news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hn-news-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Section Title ---- */
.hn-section-title {
  font-family: var(--hn-font-headline);
  font-size: var(--hn-text-2xl);
  line-height: 1.15;
  color: var(--hn-text);
  margin: 0 0 var(--hn-space-6);
  padding-bottom: var(--hn-space-3);
  border-bottom: 3px solid var(--hn-red);
  display: inline-block;
}

/* ---- Load More Buttons ---- */
.hn-load-more-wrapper,
.hn-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: var(--hn-space-8) 0 var(--hn-space-4);
}

.hn-load-more-btn,
.hn-load-more {
  font-family: var(--hn-font-ui);
  font-size: var(--hn-text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hn-white);
  background-color: var(--hn-red);
  border: none;
  padding: var(--hn-space-3) var(--hn-space-8);
  border-radius: var(--hn-radius-full);
  cursor: pointer;
  transition: background-color var(--hn-transition-fast), transform var(--hn-transition-fast);
}

.hn-load-more-btn:hover,
.hn-load-more:hover {
  background-color: var(--hn-red-hover);
  transform: translateY(-1px);
}

.hn-load-more-btn:disabled,
.hn-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---- Skip Link (Accessibility) ---- */
.hn-skip-link:focus {
  clip: auto !important;
  clip-path: none !important;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  padding: var(--hn-space-3) var(--hn-space-6);
  background: var(--hn-red);
  color: var(--hn-white);
  font-family: var(--hn-font-ui);
  font-size: var(--hn-text-sm);
  font-weight: 700;
  text-decoration: none;
}

/* ---- Screen Reader Only (Accessibility) ---- */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}
