/* ========================================
   Pavel Nechitaev — Author Website
   Mobile-first, dark theme
   ======================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0b1a;
  --bg-secondary: #0f1029;
  --bg-card: rgba(15, 16, 41, 0.7);
  --bg-card-hover: rgba(20, 22, 55, 0.8);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-gold: #c9a84c;
  --accent-gold-dim: rgba(201, 168, 76, 0.6);
  --accent-gold-glow: rgba(201, 168, 76, 0.15);
  --accent-blue: #6366f1;
  --accent-blue-dim: rgba(99, 102, 241, 0.6);
  --accent-purple: #8b5cf6;
  --border-subtle: rgba(201, 168, 76, 0.12);
  --border-card: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --radius-sm: 8px;
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --container: 1100px;
  --gutter: 1.25rem;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- Typography --- */
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 3rem;
  letter-spacing: 0.02em;
}

.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  background: var(--accent-gold);
  margin: 0.75rem auto 0;
}

.section-title--left {
  text-align: left;
}

.section-title--left::after {
  margin-left: 0;
}

/* --- Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* --- Tags --- */
.tag {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--accent-gold-dim);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tag--small {
  padding: 0.2rem 0.65rem;
  font-size: 0.7rem;
}

/* ========================================
   Navigation
   ======================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background 0.4s, box-shadow 0.4s;
}

.nav.scrolled {
  background: rgba(10, 11, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border-card);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  transition: opacity 0.3s;
}

.nav-logo:hover {
  opacity: 0.8;
}

.nav-links {
  display: none;
  gap: 2rem;
}

.nav-link {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  transition: color 0.3s;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-gold);
  transition: width 0.3s;
}

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

.nav-link:hover::after {
  width: 100%;
}

/* Hamburger */
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

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

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(10, 11, 26, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-link {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  transition: color 0.3s;
  letter-spacing: 0.02em;
}

.mobile-menu-link:hover {
  color: var(--accent-gold);
}

/* ========================================
   Hero
   ======================================== */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(160deg, #0a0b1a 0%, #12103a 40%, #1a0f2e 60%, #0a0b1a 100%);
  background-size: 300% 300%;
  animation: heroGradient 20s ease infinite;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(201, 168, 76, 0.04), transparent);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, var(--bg-primary), transparent);
  pointer-events: none;
}

.hero-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--gutter);
}

.hero-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-gold-dim);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-shadow: 0 0 80px rgba(201, 168, 76, 0.15);
}

.hero-divider {
  width: 48px;
  height: 2px;
  background: var(--accent-gold);
  margin: 1.5rem auto;
  opacity: 0.7;
}

.hero-tagline {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}

.hide-mobile {
  display: none;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.3s;
  animation: scrollBounce 2.5s ease-in-out infinite;
}

.scroll-indicator:hover {
  opacity: 0.8;
}

.scroll-text {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ========================================
   Sections
   ======================================== */
.section {
  padding: 5rem 0;
}

.section--books {
  background: var(--bg-secondary);
}

.section--worlds {
  padding-bottom: 3rem;
}

.section--links {
  padding-bottom: 5rem;
}

/* ========================================
   About
   ======================================== */
.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.about-avatar {
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.1), rgba(99, 102, 241, 0.1));
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--accent-gold-dim);
}

.avatar-placeholder img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.about-text {
  text-align: center;
}

.about-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-secondary);
  border-left: 2px solid var(--accent-gold);
  padding-left: 1.25rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.about-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

/* ========================================
   Books
   ======================================== */
.book-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.book-card:hover {
  border-color: var(--border-subtle);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.book-card:last-child {
  margin-bottom: 0;
}

.book-card--soon {
  border-style: dashed;
  border-color: var(--border-subtle);
}

.book-cover-wrap {
  flex-shrink: 0;
  align-self: center;
}

.book-cover {
  width: 200px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s, box-shadow 0.4s;
}

.book-card:hover .book-cover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-gold-glow);
}

.book-cover-wrap--soon {
  align-self: center;
}

.book-cover-placeholder {
  width: 200px;
  height: 280px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #111227 0%, #1a1040 50%, #0f0f1e 100%);
  border: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-placeholder-text {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  color: rgba(201, 168, 76, 0.2);
  letter-spacing: 0.1em;
}

.book-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.book-series {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-status {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.book-status--done {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.book-status--soon {
  background: var(--accent-gold-glow);
  color: var(--accent-gold);
}

.book-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  margin: 0.25rem 0 0.5rem;
  letter-spacing: 0.01em;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.book-annotation {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.book-annotation:last-of-type {
  margin-bottom: 1rem;
}

.book-annotation--accent {
  color: var(--text-primary);
  font-weight: 500;
  font-style: italic;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
  border: 1px solid transparent;
}

.btn--at {
  background: rgba(255, 120, 0, 0.1);
  color: #ff8c2e;
  border-color: rgba(255, 120, 0, 0.2);
}

.btn--at:hover {
  background: rgba(255, 120, 0, 0.2);
  border-color: rgba(255, 120, 0, 0.4);
  transform: translateY(-1px);
}

.btn--litnet {
  background: rgba(0, 140, 255, 0.1);
  color: #4dabf7;
  border-color: rgba(0, 140, 255, 0.2);
}

.btn--litnet:hover {
  background: rgba(0, 140, 255, 0.2);
  border-color: rgba(0, 140, 255, 0.4);
  transform: translateY(-1px);
}

/* ========================================
   Worlds
   ======================================== */
.worlds-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.world-block {
  position: relative;
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  overflow: hidden;
  border: 1px solid var(--border-card);
  transition: border-color 0.4s;
}

.world-block:hover {
  border-color: var(--border-subtle);
}

.world-block-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
}

.world-block--ring .world-block-bg {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.06) 50%, transparent 100%);
}

.world-block--xxv .world-block-bg {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.06) 0%, rgba(100, 116, 139, 0.06) 50%, transparent 100%);
}

.world-block-content {
  position: relative;
  z-index: 1;
}

.world-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.world-block--ring .world-title {
  color: #a5b4fc;
}

.world-block--xxv .world-title {
  color: var(--accent-gold);
}

.world-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.world-desc:last-of-type {
  margin-bottom: 1.25rem;
}

.world-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.world-tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ========================================
   Links Section
   ======================================== */
.links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  transition: all 0.3s;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.link-card--at {
  border-color: rgba(255, 120, 0, 0.1);
}

.link-card--at:hover {
  border-color: rgba(255, 120, 0, 0.3);
  background: rgba(255, 120, 0, 0.05);
}

.link-card--litnet {
  border-color: rgba(0, 140, 255, 0.1);
}

.link-card--litnet:hover {
  border-color: rgba(0, 140, 255, 0.3);
  background: rgba(0, 140, 255, 0.05);
}

.link-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card--at .link-card-icon {
  background: rgba(255, 120, 0, 0.1);
  color: #ff8c2e;
}

.link-card--litnet .link-card-icon {
  background: rgba(0, 140, 255, 0.1);
  color: #4dabf7;
}

.link-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.link-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.link-card-arrow {
  margin-left: auto;
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: transform 0.3s, color 0.3s;
}

.link-card:hover .link-card-arrow {
  transform: translateX(4px);
  color: var(--text-secondary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-card);
}

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

.footer-logo {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold-dim);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   Keyframes
   ======================================== */
@keyframes heroGradient {
  0% { background-position: 0% 0%; }
  25% { background-position: 100% 50%; }
  50% { background-position: 50% 100%; }
  75% { background-position: 0% 50%; }
  100% { background-position: 0% 0%; }
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

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

/* Tablet */
@media (min-width: 640px) {
  :root {
    --gutter: 2rem;
  }

  .hide-mobile {
    display: inline;
  }

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

  .worlds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .world-block {
    padding: 2.5rem 2rem;
  }
}

/* Desktop Nav */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }

  .mobile-menu {
    display: none;
  }

  .about-content {
    flex-direction: row;
    align-items: flex-start;
    gap: 3rem;
  }

  .about-text {
    text-align: left;
  }

  .about-genres {
    justify-content: flex-start;
  }

  .section {
    padding: 6rem 0;
  }

  .book-card {
    flex-direction: row;
    gap: 2.5rem;
    padding: 2rem;
  }

  .book-cover-wrap {
    align-self: flex-start;
  }

  .book-cover {
    width: 220px;
  }

  .book-cover-placeholder {
    width: 220px;
    height: 308px;
  }
}

/* Large Desktop */
@media (min-width: 1024px) {
  .section {
    padding: 7rem 0;
  }

  .book-card {
    padding: 2.5rem;
    gap: 3rem;
  }

  .book-cover {
    width: 240px;
  }

  .book-cover-placeholder {
    width: 240px;
    height: 336px;
  }

  .avatar-placeholder {
    width: 160px;
    height: 160px;
    font-size: 3rem;
  }
}

/* Accessibility: reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

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

  html {
    scroll-behavior: auto;
  }
}
