/*
Theme Name: Nocturne Press
Theme URI: https://example.com/nocturne-press
Author: Codex
Description: A dark, animated, mobile-first editorial theme for WordPress.
Version: 1.0.4
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
Text Domain: nocturne-press
*/

:root {
  --bg: #07090d;
  --bg-soft: #0d1118;
  --surface: rgba(18, 23, 33, 0.76);
  --surface-solid: #121721;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --muted: #929bac;
  --accent: #7c5cff;
  --accent-2: #22d3b6;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --container: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(124, 92, 255, 0.14), transparent 27rem),
    radial-gradient(circle at 88% 16%, rgba(34, 211, 182, 0.08), transparent 24rem),
    var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-shell {
  width: min(calc(100% - 40px), var(--container));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 14px;
  color: #06080c;
  background: var(--accent-2);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 18px 0;
  transition: padding .3s ease, background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  padding: 11px 0;
  background: rgba(7, 9, 13, 0.82);
  border-color: var(--line);
  backdrop-filter: blur(20px);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 30px rgba(124, 92, 255, .32);
  transform: rotate(-8deg);
}

.brand-mark::after {
  position: absolute;
  inset: 7px;
  content: "";
  border: 2px solid rgba(7, 9, 13, .72);
  border-radius: 50%;
}

.main-nav {
  margin-left: auto;
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.main-nav a {
  color: var(--muted);
  font-size: 14px;
  transition: color .25s ease;
}

.main-nav a:hover,
.main-nav .current-menu-item > a {
  color: var(--text);
}

.header-action {
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

.header-action:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.28);
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.menu-toggle span,
.menu-toggle::before,
.menu-toggle::after {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 4px auto;
  content: "";
  background: var(--text);
  transition: transform .25s ease, opacity .25s ease;
}

.menu-toggle.is-active span {
  opacity: 0;
}

.menu-toggle.is-active::before {
  transform: translateY(5.5px) rotate(45deg);
}

.menu-toggle.is-active::after {
  transform: translateY(-5.5px) rotate(-45deg);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 64px;
  min-height: 680px;
  padding: 84px 0 110px;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 24px;
  height: 1px;
  content: "";
  background: currentColor;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(48px, 7vw, 88px);
  line-height: .98;
  letter-spacing: -.065em;
}

.gradient-text {
  color: transparent;
  background: linear-gradient(100deg, #fff 15%, #9887ff 55%, #52e7cc);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-description {
  max-width: 560px;
  margin: 28px 0 36px;
  color: var(--muted);
  font-size: 17px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.button-primary {
  color: #080a0f;
  background: var(--text);
  border-color: var(--text);
}

.button-secondary {
  background: rgba(255,255,255,.04);
}

.button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.button-arrow {
  transition: transform .25s ease;
}

.button:hover .button-arrow {
  transform: translateX(4px);
}

.hero-visual {
  position: relative;
  min-height: 470px;
  perspective: 1000px;
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 390px;
  aspect-ratio: 1;
  border: 1px solid rgba(124, 92, 255, .23);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: orbitSpin 22s linear infinite;
}

.orbit::before {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  content: "";
  background: var(--accent-2);
  border-radius: 50%;
  box-shadow: 0 0 22px var(--accent-2);
}

.hero-card {
  position: absolute;
  overflow: hidden;
  background: rgba(16, 20, 29, .74);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-card-main {
  top: 60px;
  left: 42px;
  width: min(350px, calc(100% - 42px));
  animation: float 6s ease-in-out infinite;
}

.hero-card-image,
.post-thumbnail {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(124,92,255,.8), rgba(34,211,182,.24)),
    #252a38;
}

.hero-card-image {
  height: 168px;
}

.hero-card-image img,
.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .65s cubic-bezier(.2,.7,.2,1);
}

.hero-card:hover img,
.post-card:hover .post-thumbnail img {
  transform: scale(1.06);
}

.hero-card-body {
  padding: 17px 18px 18px;
}

.hero-card-body h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 7px;
  font-size: 18px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.meta-dot {
  width: 3px;
  height: 3px;
  background: var(--muted);
  border-radius: 50%;
}

.category-pill {
  display: inline-flex;
  padding: 5px 9px;
  color: #bdfff3;
  background: rgba(34, 211, 182, .12);
  border: 1px solid rgba(34, 211, 182, .18);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-mini-card {
  right: -10px;
  bottom: 48px;
  width: 188px;
  padding: 18px;
  animation: float 6s 1.4s ease-in-out infinite;
}

.hero-mini-card strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.hero-mini-card span {
  color: var(--muted);
  font-size: 12px;
}

.section {
  padding: 88px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-heading h2,
.archive-header h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.section-heading p,
.archive-header p {
  max-width: 500px;
  margin: 10px 0 0;
  color: var(--muted);
}

.text-link {
  flex: 0 0 auto;
  padding-bottom: 4px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  font-size: 13px;
  transition: color .2s ease, border-color .2s ease;
}

.text-link:hover {
  color: var(--text);
  border-color: var(--text);
}

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

.post-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(20,25,35,.85), rgba(12,15,22,.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s ease, box-shadow .35s ease;
}

.post-card::after {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .35s ease;
}

.post-card:hover {
  border-color: rgba(124,92,255,.34);
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  transform: translateY(-7px);
}

.post-card:hover::after {
  opacity: 1;
}

.post-thumbnail {
  display: block;
  height: 158px;
}

.post-thumbnail::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(to top, rgba(7,9,13,.35), transparent 60%);
}

.post-card:nth-child(3n+2) .post-thumbnail {
  background: linear-gradient(135deg, #15283c, #7c5cff 130%);
}

.post-card:nth-child(3n+3) .post-thumbnail {
  background: linear-gradient(135deg, #302344, #147d70);
}

.post-card-content {
  padding: 17px 18px 18px;
}

.post-card h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 10px 0 13px;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -.02em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-card h2 a {
  transition: color .25s ease;
}

.post-card h2 a:hover {
  color: #b8adff;
}

.archive-main {
  min-height: 70vh;
  padding: 86px 0 110px;
}

.archive-header {
  padding: 34px 0 58px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 42px;
}

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

.archive-grid .post-card {
  display: grid;
  grid-template-columns: 178px 1fr;
  min-height: 158px;
}

.archive-grid .post-thumbnail {
  height: 100%;
  min-height: 158px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.pagination .page-numbers {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pagination .current,
.pagination a:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(124,92,255,.45);
}

.article-wrap {
  width: min(calc(100% - 40px), 820px);
  margin: 0 auto;
  padding: 80px 0 110px;
}

.article-header {
  margin-bottom: 40px;
  text-align: center;
}

.article-header h1 {
  margin: 18px 0;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.06;
  letter-spacing: -.05em;
}

.article-header .post-meta {
  justify-content: center;
}

.article-cover {
  overflow: hidden;
  margin: 42px 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.article-content {
  color: #ced3de;
  font-size: 17px;
}

.article-content h2,
.article-content h3 {
  color: var(--text);
  line-height: 1.25;
}

.article-content a {
  color: #9ceee0;
  border-bottom: 1px solid rgba(156,238,224,.35);
}

.article-content blockquote {
  padding: 10px 0 10px 24px;
  margin: 32px 0;
  color: var(--text);
  border-left: 3px solid var(--accent);
  font-size: 21px;
}

.article-content img {
  border-radius: 18px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 70px 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: center;
}

.site-footer {
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1);
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(0); }
  50% { transform: translateY(-14px) rotateX(1.5deg); }
}

@keyframes orbitSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 72px;
  }

  .hero-copy {
    max-width: 760px;
  }

  .hero-visual {
    width: min(100%, 580px);
    margin-inline: auto;
  }

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

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

@media (max-width: 720px) {
  .site-shell,
  .article-wrap {
    width: min(calc(100% - 28px), var(--container));
  }

  .site-header {
    padding: 12px 0;
  }

  .menu-toggle {
    display: block;
    cursor: pointer;
  }

  .header-action {
    display: none;
  }

  .main-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 14px;
    left: 14px;
    display: none;
    padding: 14px;
    background: rgba(12, 15, 22, .97);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }

  .main-nav.is-open {
    display: block;
    animation: menuIn .22s ease both;
  }

  .main-nav ul {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .main-nav a {
    display: block;
    padding: 11px 12px;
    border-radius: 8px;
  }

  .main-nav a:hover {
    background: rgba(255,255,255,.05);
  }

  .hero {
    min-height: auto;
    padding: 64px 0 70px;
  }

  .hero h1 {
    font-size: clamp(45px, 15vw, 68px);
  }

  .hero-description {
    font-size: 15px;
  }

  .hero-visual {
    min-height: 410px;
  }

  .orbit {
    width: 300px;
  }

  .hero-card-main {
    top: 35px;
    left: 0;
    width: calc(100% - 26px);
  }

  .hero-card-image {
    height: 150px;
  }

  .hero-mini-card {
    right: 0;
    bottom: 18px;
  }

  .section {
    padding: 64px 0;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

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

  .post-thumbnail {
    height: 154px;
  }

  .archive-main {
    padding-top: 48px;
  }

  .archive-grid .post-card {
    display: block;
  }

  .archive-grid .post-thumbnail {
    height: 154px;
    min-height: 0;
  }

  .article-wrap {
    padding-top: 54px;
  }

  .footer-wrap {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
