/*
Theme Name: Night Grid
Theme URI: https://example.com/night-grid
Author: Codex
Author URI: https://example.com
Description: A modern dark WordPress block theme with a sticky glass header, card-based layout, and responsive grid blog design.
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: night-grid
Tags: blog, dark, block-theme, full-site-editing, responsive, grid-layout
*/

:root {
  --ng-bg: #09090b;
  --ng-bg-soft: #0f1117;
  --ng-surface: rgba(15, 18, 26, 0.82);
  --ng-surface-strong: #171b24;
  --ng-surface-muted: #202634;
  --ng-border: rgba(255, 255, 255, 0.08);
  --ng-border-strong: rgba(255, 255, 255, 0.14);
  --ng-text: #f6f7fb;
  --ng-text-soft: #cdd4e3;
  --ng-text-muted: #93a0b8;
  --ng-accent: #7dd3fc;
  --ng-accent-2: #f59e0b;
  --ng-accent-3: #8b5cf6;
  --ng-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --ng-radius: 28px;
  --ng-radius-sm: 18px;
  --ng-grid-gap: clamp(1rem, 2vw, 1.5rem);
  --ng-max: 1520px;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 0% 0%, rgba(125, 211, 252, 0.16), transparent 24%),
    radial-gradient(circle at 100% 8%, rgba(245, 158, 11, 0.12), transparent 20%),
    radial-gradient(circle at 70% 30%, rgba(139, 92, 246, 0.12), transparent 22%),
    linear-gradient(180deg, #090a0f 0%, #09090b 55%, #0a0b10 100%);
  color: var(--ng-text);
}

.wp-site-blocks {
  min-height: 100vh;
  overflow: visible;
}

.site-shell {
  position: relative;
}

.site-shell > .alignfull,
.glass-header.alignfull,
.footer-card.alignfull {
  max-width: 100%;
}

.site-shell > .alignwide,
.glass-header.alignwide,
.footer-card.alignwide {
  max-width: min(var(--ng-max), calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

.site-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 75%);
  opacity: 0.2;
}

.glass-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 11, 16, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ng-border);
}

.glass-header .wp-block-group__inner-container,
.glass-header.is-layout-constrained {
  min-height: 78px;
}

.site-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.28), transparent 45%),
    linear-gradient(135deg, var(--ng-accent) 0%, var(--ng-accent-3) 55%, var(--ng-accent-2) 100%);
  color: #0b0d12;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(125, 211, 252, 0.2);
}

.header-branding {
  gap: 0.875rem;
}

.header-brand-stack {
  gap: 0.4rem;
}

.header-branding .wp-block-site-title {
  margin: 0;
}

.header-branding .wp-block-site-title a {
  color: var(--ng-text);
}

.header-brand-stack .wp-block-site-tagline,
.footer-brand .wp-block-site-tagline {
  margin: 0;
}

.header-nav {
  width: 100%;
}

.wp-block-navigation .wp-block-navigation-item__content {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 0;
  color: var(--ng-text-soft);
  transition: color 0.2s ease, opacity 0.2s ease;
}

.wp-block-navigation .wp-block-navigation-item__content::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0.15rem;
  width: 100%;
  height: 1px;
  transform: scaleX(0);
  transform-origin: right;
  background: linear-gradient(90deg, var(--ng-accent), var(--ng-accent-2));
  transition: transform 0.2s ease;
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
.wp-block-navigation .current-menu-ancestor > .wp-block-navigation-item__content {
  color: var(--ng-text);
}

.wp-block-navigation .wp-block-navigation-item__content:hover::after,
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content::after,
.wp-block-navigation .current-menu-ancestor > .wp-block-navigation-item__content::after {
  transform: scaleX(1);
  transform-origin: left;
}

.card-surface,
.post-card,
.hero-panel,
.footer-card,
.section-shell,
.category-list-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(15, 18, 26, 0.7);
  border: 1px solid var(--ng-border);
  border-radius: var(--ng-radius);
  box-shadow: var(--ng-shadow);
}

.front-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr);
  gap: var(--ng-grid-gap);
  align-items: stretch;
}

.featured-category-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: clamp(2rem, 5vw, 4rem);
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.featured-category {
  padding: clamp(1.5rem, 3vw, 2.25rem);
}

.featured-category .wp-block-query {
  margin-top: 1.5rem;
}

.category-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.category-kicker {
  margin: 0;
  color: var(--ng-text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.category-title {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 0.98;
}

.category-description {
  margin: 0;
  max-width: 30ch;
  color: var(--ng-text-soft);
}

.featured-posts-query .wp-block-post-template,
.featured-posts-query ul.wp-block-post-template.is-layout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.featured-posts-query .wp-block-post-template > li,
.featured-posts-query .wp-block-post-template > .wp-block-post {
  margin: 0;
  width: auto;
}

.featured-posts-query ul.wp-block-post-template.is-layout-grid > li {
  margin: 0 !important;
}

.featured-posts-query .post-card .wp-block-post-title {
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  line-height: 1.08;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2rem);
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: auto -2rem -2rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.22), transparent 68%);
}

.eyebrow {
  margin: 0;
  color: var(--ng-text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.hero-title {
  max-width: 9.5ch;
  margin: 0;
  font-size: clamp(3.8rem, 7vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.hero-subtitle {
  max-width: 54ch;
  margin: 0;
  color: var(--ng-text-soft);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
}

.hero-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.mini-stat {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.1rem;
  border: 1px solid var(--ng-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-stat strong,
.mini-stat span {
  display: block;
}

.mini-stat strong {
  margin-bottom: 0.2rem;
  color: var(--ng-text);
  font-size: 1.05rem;
}

.mini-stat span {
  color: var(--ng-text-muted);
  font-size: 0.88rem;
}

.hero-highlight {
  position: relative;
  overflow: hidden;
  padding: clamp(1.3rem, 2.6vw, 1.8rem);
  min-height: 100%;
}

.hero-highlight::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.08), transparent 32%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 35%);
}

.orbital-line {
  position: absolute;
  inset: 14% 12% auto auto;
  width: 10rem;
  height: 10rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  box-shadow:
    0 0 0 24px rgba(255, 255, 255, 0.015),
    0 0 0 52px rgba(255, 255, 255, 0.01);
}

.orbital-line::after {
  content: "";
  position: absolute;
  top: 0.7rem;
  right: 1.2rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--ng-accent);
  box-shadow: 0 0 16px rgba(125, 211, 252, 0.6);
}

.hero-card-label,
.section-label {
  margin: 0;
  color: var(--ng-text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.hero-card-title {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(2.2rem, 3.2vw, 3.5rem);
  line-height: 1;
}

.hero-card-copy {
  margin: 0;
  max-width: 28ch;
  color: var(--ng-text-soft);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ng-grid-gap);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  padding: clamp(1.3rem, 2.6vw, 1.8rem);
}

.wp-block-query.latest-posts-query .wp-block-post-template,
.wp-block-query.latest-posts-query ul.wp-block-post-template.is-layout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ng-grid-gap);
}

.latest-posts-query .wp-block-post-template > *:first-child {
  grid-column: span 2;
}

.latest-posts-query .wp-block-post-template > *:first-child .post-card-content {
  padding: 1.55rem;
}

.latest-posts-query .wp-block-post-template > *:first-child .wp-block-post-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.02;
}

.post-card {
  height: 100%;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card .wp-block-post-featured-image img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
  transition: transform 0.35s ease;
}

.post-card .wp-block-post-featured-image {
  margin-bottom: 0;
}

.post-card-content {
  padding: 1.35rem;
}

.post-card .wp-block-post-title a {
  text-decoration: none;
}

.post-card .wp-block-post-title a:hover {
  color: var(--ng-accent);
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(125, 211, 252, 0.22);
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.48);
}

.post-card:hover .wp-block-post-featured-image img {
  transform: scale(1.03);
}

.post-card .wp-block-post-terms,
.post-card .wp-block-post-date,
.post-card .wp-block-post-author-name {
  color: var(--ng-text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-card .wp-block-read-more {
  display: inline-flex;
  margin-top: 0.5rem;
  color: var(--ng-text);
  font-weight: 600;
}

.wp-block-query-pagination-next,
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.15rem;
  border: 1px solid var(--ng-border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ng-text);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.wp-block-query-pagination-next:hover,
.wp-block-button__link:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.4);
  background: rgba(125, 211, 252, 0.08);
}

.wp-block-query-pagination {
  margin-top: 1rem;
  gap: 0.75rem;
}

.section-shell {
  padding: clamp(1.5rem, 3vw, 2.1rem);
  margin-top: clamp(2rem, 5vw, 4rem);
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.section-shell.alignwide {
  width: min(var(--ng-max), calc(100% - 2rem));
}

.latest-posts-query .wp-block-query-pagination {
  justify-content: center;
}

.latest-posts-query .wp-block-post-template,
.latest-posts-query ul.wp-block-post-template.is-layout-grid {
  list-style: none;
  padding: 0;
  margin: 0;
}

.latest-posts-query .wp-block-post-template > li,
.latest-posts-query .wp-block-post-template > .wp-block-post {
  margin: 0;
  width: auto;
}

.latest-posts-query ul.wp-block-post-template.is-layout-grid > li {
  margin: 0 !important;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.section-title {
  margin: 0;
  font-size: clamp(1.7rem, 2.6vw, 2.6rem);
  line-height: 1.02;
}

.section-note {
  margin: 0;
  max-width: 34ch;
  color: var(--ng-text-soft);
}

.category-list-card .wp-block-categories-list,
.taxonomy-chip-list .wp-block-categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-list-card li,
.taxonomy-chip-list li {
  margin: 0;
}

.footer-card {
  border-top: 1px solid var(--ng-border);
}

.footer-links {
  gap: 1.25rem;
}

.footer-brand {
  gap: 0.35rem;
}

.footer-brand .wp-block-site-title,
.footer-brand .wp-block-site-tagline {
  margin: 0;
}

.footer-meta-links {
  gap: 1rem;
}

.footer-links a,
.footer-meta-links a,
.footer-card p {
  color: var(--ng-text-soft);
  text-decoration: none;
}

.footer-links a:hover,
.footer-meta-links a:hover {
  color: var(--ng-text);
}

.taxonomy-chip-list {
  gap: 0.75rem;
}

.taxonomy-chip-list a,
.category-list-card a {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--ng-border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ng-text-soft);
  text-decoration: none;
}

.taxonomy-chip-list a:hover,
.category-list-card a:hover {
  color: var(--ng-text);
  border-color: rgba(118, 228, 247, 0.45);
}

.category-list-card a {
  justify-content: space-between;
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 18px;
}

.category-list-card .count {
  color: var(--ng-text-muted);
}

.entry-panel {
  max-width: min(900px, calc(100% - 2rem));
  margin: clamp(2rem, 5vw, 4rem) auto;
  padding: clamp(1.4rem, 3vw, 2.4rem);
}

.entry-panel .wp-block-post-title {
  margin-bottom: 1rem;
}

.single-layout {
  align-items: start;
}

.single-sidebar-column {
  align-self: flex-start;
  position: relative;
}

.post-sidebar-stack {
  gap: 1rem;
  position: sticky;
  top: calc(78px + 2rem);
}

.sidebar-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018)),
    rgba(15, 18, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--ng-radius);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

.sidebar-label {
  margin: 0 0 0.8rem;
  color: var(--ng-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-taxonomy,
.sidebar-tags {
  color: var(--ng-text-soft);
}

.sidebar-taxonomy ul {
  margin: 0;
  padding-left: 1rem;
}

.article-hero {
  margin-bottom: 2rem;
}

.article-taxonomy {
  margin: 0;
}

.article-title {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.4rem, 4.4vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.article-meta {
  color: var(--ng-text-soft);
}

.article-meta > * {
  position: relative;
}

.article-meta > * + *::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 0.85rem;
  border-radius: 999px;
  background: var(--ng-accent);
  vertical-align: middle;
}

.article-deck {
  max-width: 62ch;
  margin: 0;
  font-size: 1rem;
}

.article-body-panel {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  margin-top: clamp(2rem, 5vw, 4rem);
  margin-bottom: clamp(3rem, 6vw, 5rem);
  padding-top: clamp(2rem, 4vw, 3rem) !important;
  padding-bottom: clamp(2.5rem, 5vw, 4rem) !important;
}

.sidebar-query .wp-block-post-template {
  display: grid;
  gap: 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-query .wp-block-post-template > li {
  margin: 0;
}

.sidebar-mini-post {
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--ng-border);
}

.sidebar-mini-post:first-child {
  padding-top: 0;
  border-top: 0;
}

.sidebar-mini-post .wp-block-post-title {
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.sidebar-mini-post .wp-block-post-title a {
  color: var(--ng-text);
  text-decoration: none;
}

.sidebar-mini-post .wp-block-post-title a:hover {
  color: var(--ng-accent);
}

.latest-posts-query {
  margin-top: clamp(1.75rem, 4vw, 3rem);
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

.latest-posts-query .wp-block-post-template,
.featured-posts-query .wp-block-post-template {
  row-gap: clamp(1.25rem, 3vw, 2rem);
}

.featured-posts-query .post-card,
.latest-posts-query .post-card {
  padding-bottom: 0.25rem;
}

@media (max-width: 960px) {
  .front-hero,
  .category-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .single-sidebar-column,
  .single-content-column {
    flex-basis: 100% !important;
  }

  .single-sidebar-column {
    order: 2;
  }

  .post-sidebar-stack {
    position: static;
  }

  .wp-block-query.latest-posts-query .wp-block-post-template {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-posts-query .wp-block-post-template,
  .featured-posts-query ul.wp-block-post-template.is-layout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latest-posts-query .wp-block-post-template > *:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .hero-title {
    font-size: clamp(2.4rem, 15vw, 4.1rem);
  }

  .hero-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .glass-header .wp-block-navigation {
    width: 100%;
    justify-content: center;
  }

  .wp-block-query.latest-posts-query .wp-block-post-template,
  .wp-block-query.latest-posts-query ul.wp-block-post-template.is-layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .featured-posts-query .wp-block-post-template,
  .featured-posts-query ul.wp-block-post-template.is-layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .latest-posts-query .wp-block-post-template > *:first-child {
    grid-column: span 1;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-meta-links {
    justify-content: center;
  }
}
