/* ============================================================
   Permanent Solution Blog — Main Stylesheet
   Dark Gold Editorial Theme with 3D Effects
   ============================================================ */

:root {
  --bg: #0A0A0B;
  --surface: #111114;
  --card: #16161B;
  --card-hover: #1E1E25;
  --gold: #D4A853;
  --gold-light: #F0C060;
  --gold-dim: rgba(212, 168, 83, 0.12);
  --gold-glow: rgba(212, 168, 83, 0.3);
  --text: #F5F0E8;
  --text-muted: #8B8A95;
  --text-dim: #5A5965;
  --border: rgba(255, 255, 255, 0.06);
  --border-gold: rgba(212, 168, 83, 0.25);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 12px;
  --shadow-gold: 0 0 40px rgba(212, 168, 83, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Nav ─── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.nav.scrolled {
  background: rgba(10, 10, 11, 0.98);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--gold);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  transition: transform 0.3s;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  letter-spacing: 0.04em;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
}

.nav-search-btn,
.menu-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.menu-toggle {
  display: none;
}

.nav-search-btn:hover,
.menu-toggle:hover {
  color: var(--gold);
  border-color: var(--border-gold);
}

.search-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: none;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border);
}

.search-bar.open {
  display: flex;
}

.search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
}

/* ── Hero ─── */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 6rem 2rem 4rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.1;
  animation: orbFloat 8s ease-in-out infinite;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.hero-orb-1 {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--gold), transparent);
  top: -250px;
  left: -200px;
}

.hero-orb-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #8855CC, transparent);
  top: 40%;
  right: -150px;
  animation-delay: -3s;
}

.hero-orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--gold-light), transparent);
  bottom: -100px;
  left: 35%;
  animation-delay: -5s;
}

.hero-content {
  max-width: 860px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gold-dim);
  border: 1px solid var(--border-gold);
  border-radius: 100px;
  padding: 0.35rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
  animation: fadeInDown 0.8s ease forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1.5rem;
  perspective: 1200px;
}

.title-line {
  display: block;
  opacity: 0;
  transform: translateY(50px) translateZ(-60px);
  animation: titleReveal 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.75s forwards;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.95s forwards;
}

/* ── Posts ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
  will-change: transform;
}

.post-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-gold);
}

.card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface);
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.post-card:hover .card-img img {
  transform: scale(1.05);
}

.card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Responsive ─── */
@media (max-width: 800px) {
  .nav-inner {
    padding: 0 1rem;
  }

  .logo-text {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99;
    border-top: 1px solid var(--border);
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-link {
    font-size: 1.25rem;
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
  }

  .hero {
    padding: 6rem 1rem 4rem;
  }

  .hero-title {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

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

  .container {
    padding: 0 1rem;
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Utilities & Animations ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.25s;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border-gold);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(20px, 20px);
  }
}

@keyframes titleReveal {
  to {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

/* Footer */
.footer {
  background: var(--surface);
  padding: 4rem 1rem 2rem;
  border-top: 1px solid var(--border);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}