/* ===== Variables ===== */
:root {
  --red-900: #1a0505;
  --red-800: #2d0a0a;
  --red-700: #4a0e0e;
  --red-600: #7f1d1d;
  --red-500: #dc2626;
  --red-400: #ef4444;
  --red-300: #f87171;
  --red-glow: rgba(220, 38, 38, 0.45);
  --black: #0a0a0a;
  --gray-900: #111111;
  --gray-800: #1a1a1a;
  --gray-700: #2a2a2a;
  --gray-500: #737373;
  --gray-400: #a3a3a3;
  --gray-200: #e5e5e5;
  --white: #fafafa;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --font-sans: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-h: 72px;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font-sans);
  background: var(--black);
  color: var(--gray-200);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img, video { max-width: 100%; display: block; }

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition);
}

.header.scrolled {
  background: rgba(10, 10, 10, 0.92);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
}

.logo-mark {
  color: var(--red-400);
  font-size: 1.2rem;
}

.logo-dot { color: var(--gray-500); }

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  transition: color var(--transition);
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--red-500);
  transition: width var(--transition);
}

.nav a:hover { color: var(--white); }
.nav a:hover::after { width: 100%; }

.btn-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--white);
  background: linear-gradient(135deg, var(--red-600), var(--red-500));
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.2);
}

.btn-auth:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--red-glow);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  transition: var(--transition);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-video-wrap {
  position: absolute;
  inset: 0;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.7) 0%, rgba(26, 5, 5, 0.85) 50%, var(--black) 100%),
    radial-gradient(ellipse at 30% 50%, rgba(220, 38, 38, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(127, 29, 29, 0.2) 0%, transparent 50%);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(220, 38, 38, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 38, 38, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: calc(var(--header-h) + 40px) 24px 80px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--red-300);
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 100px;
  margin-bottom: 32px;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--red-400);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--red-glow); }
  50% { opacity: 0.7; box-shadow: 0 0 0 8px transparent; }
}

.hero-title {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 24px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--red-400), var(--red-500), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-400);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--red-600), var(--red-500));
  box-shadow: 0 4px 24px var(--red-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--red-glow);
}

.btn-ghost {
  color: var(--gray-200);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(220, 38, 38, 0.3);
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--glass-border);
}

.scroll-hint {
  position: absolute;

  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.scroll-hint span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gray-500);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--red-500), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== Sections ===== */
.section {
  padding: 120px 0;
  position: relative;
}

.section-dark {
  background: linear-gradient(180deg, var(--black) 0%, var(--red-900) 50%, var(--black) 100%);
}

.section-header {
  margin-bottom: 64px;
}

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--white);
  margin-top: 12px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--red-400);
  letter-spacing: 0.05em;
}

.accent { color: var(--red-400); }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}

.glass.featured {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.about-card {
  padding: 32px;
  transition: transform var(--transition), border-color var(--transition);
}

.about-card:hover {
  transform: translateY(-4px);
  border-color: rgba(220, 38, 38, 0.2);
}

.about-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--red-400);
}

.about-icon svg { width: 100%; height: 100%; }

.about-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 12px;
}

.about-card p {
  font-size: 0.9375rem;
  color: var(--gray-400);
  line-height: 1.7;
}

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--red-300);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tags li {
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-200);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  transition: all var(--transition);
}

.skill-tags li:hover {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: var(--white);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--red-600), var(--red-500), var(--gray-700));
}

.timeline-item {
  position: relative;
  padding-bottom: 48px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gray-700);
  border: 2px solid var(--gray-500);
}

.timeline-marker.active {
  background: var(--red-500);
  border-color: var(--red-300);
  box-shadow: 0 0 16px var(--red-glow);
}

.timeline-content {
  padding: 28px 32px;
}

.timeline-era {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timeline-content h3 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--white);
  margin: 8px 0 12px;
}

.timeline-content p {
  color: var(--gray-400);
  line-height: 1.7;
}

/* ===== Articles ===== */
.articles-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.article-card {
  padding: 28px;
  transition: transform var(--transition);
}

.article-card:hover { transform: translateY(-2px); }

.article-meta {
  margin-bottom: 16px;
}

.article-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 12px;
  background: rgba(220, 38, 38, 0.15);
  color: var(--red-300);
  border-radius: 100px;
}

.article-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gray-500);
}

.article-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 12px;
}

.article-card p {
  font-size: 0.875rem;
  color: var(--gray-400);
  line-height: 1.6;
}

.article-card.placeholder { opacity: 0.6; }

.articles-note {
  text-align: center;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.articles-note a {
  color: var(--red-400);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.articles-note a:hover { color: var(--red-300); }

/* ===== Contact ===== */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 48px;
  align-items: center;
}

.contact-content h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--white);
  margin: 12px 0 16px;
}

.contact-content > p {
  color: var(--gray-400);
  margin-bottom: 32px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--gray-200);
  transition: color var(--transition);
}

.contact-link svg {
  width: 20px;
  height: 20px;
  color: var(--red-400);
}

.contact-link:hover { color: var(--white); }

.terminal {
  background: var(--gray-900);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.terminal-bar {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: var(--gray-800);
}

.terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-bar span:nth-child(1) { background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }

.terminal-body {
  padding: 20px;
  line-height: 1.8;
}

.t-green { color: #28c840; }
.t-dim { color: var(--gray-500); }

.cursor-blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.footer-motto {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red-600);
}

/* ===== Auth & Admin pages ===== */
.page-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(220, 38, 38, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(127, 29, 29, 0.15) 0%, transparent 50%),
    var(--black);
  padding: 24px;
}

.auth-card, .admin-panel {
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

.auth-card h1, .admin-panel h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}

.auth-card p, .admin-subtitle {
  color: var(--gray-400);
  font-size: 0.9375rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
  border-color: rgba(220, 38, 38, 0.5);
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
}

.form-error {
  color: var(--red-400);
  font-size: 0.8125rem;
  margin-top: 12px;
  display: none;
}

.form-error.visible { display: block; }

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 24px;
  transition: color var(--transition);
}

.back-link:hover { color: var(--red-400); }

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.admin-sidebar {
  background: var(--gray-900);
  border-right: 1px solid var(--glass-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.admin-sidebar .logo { margin-bottom: 40px; }

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.admin-nav a {
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--gray-400);
  border-radius: 8px;
  transition: all var(--transition);
}

.admin-nav a:hover, .admin-nav a.active {
  color: var(--white);
  background: rgba(220, 38, 38, 0.1);
}

.admin-nav a.active { color: var(--red-300); }

.admin-logout {
  margin-top: auto;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--gray-500);
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.admin-logout:hover {
  color: var(--red-400);
  border-color: rgba(220, 38, 38, 0.3);
}

.admin-main {
  padding: 40px;
  overflow-y: auto;
}

.admin-header {
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--white);
}

.admin-header p {
  color: var(--gray-400);
  margin-top: 4px;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.admin-stat-card {
  padding: 24px;
}

.admin-stat-card .label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.admin-stat-card .value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--white);
}

.content-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 16px;
}

.content-item-info h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--white);
}

.content-item-info span {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.content-item-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--gray-400);
  transition: all var(--transition);
}

.btn-sm:hover {
  color: var(--white);
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-sm.danger:hover {
  color: var(--red-400);
  border-color: rgba(220, 38, 38, 0.4);
}

.editor-section {
  max-width: 720px;
}

.editor-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 24px;
}

.hidden { display: none !important; }

/* ===== Animations on scroll ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .about-grid, .skills-grid, .articles-preview {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-wrap {
    grid-template-columns: 1fr;
  }

  .contact-visual { display: none; }
}

@media (max-width: 768px) {
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transform: translateY(-120%);
    opacity: 0;
    transition: all var(--transition);
  }

  .nav.open {
    transform: translateY(0);
    opacity: 1;
  }

  .menu-toggle { display: flex; }

  .btn-auth {
    position: fixed;
    top: 16px;
    right: 64px;
    z-index: 101;
    padding: 6px 12px;
    font-size: 0.8125rem;
  }

  .about-grid, .skills-grid, .articles-preview {
    grid-template-columns: 1fr;
  }

  .hero-stats { gap: 20px; }
  .stat-divider { display: none; }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
}

@media (max-width: 480px) {
  .header { padding: 0 16px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
