/* === CSS Variables - Blueprint Dark Theme === */
:root {
  --background: #0d0f12;
  --foreground: #ffffff;
  --card: #15191e;
  --card-foreground: #f8fafc;
  --primary: #60a5fa;
  --primary-foreground: #0f1115;
  --secondary: #1e293b;
  --secondary-foreground: #cbd5e1;
  --muted: #080a0d;
  --muted-foreground: #94a3b8;
  --accent: #fbbf24;
  --accent-foreground: #0f1115;
  --border: #334155;
  --ring: #4f83cc;
  --radius: 0px;

  --font-sans: "Arial Bold", sans-serif;
  --font-mono: "Monaco", monospace;
  --font-cursive: "Lucida Calligraphy", cursive;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.8);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --draw-speed: 1.2s;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--background);
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  background-attachment: fixed;
}

/* Deep radial vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 120% 100% at 50% 0%,
    transparent 30%,
    rgba(0, 0, 0, 0.55) 65%,
    rgba(29, 54, 165, 0.82) 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* === "Drawing" Entrance Animation === */
@keyframes drawReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

.draw-in {
  animation: drawReveal var(--draw-speed) var(--smooth) forwards;
}

/* === Navigation & Logo === */
.logo {
  position: relative;
  top: 2rem;
  left: 41.5%;
  transform: translateX(-50%);
  z-index: 100;
  font-family: var(--font-cursive);
  font-size: 2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--foreground);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

.logo span {
  color: var(--primary);
}

.back-link {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--foreground);
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--primary);
  background: var(--muted);
  transition: all 0.2s;
  font-weight: 700;
}

.back-link:hover {
  color: var(--background);
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* === Layout === */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
  position: relative;
  z-index: 1;
}

/* === Symmetrical Hero === */
.hero {
  text-align: center;
  margin-bottom: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  border: 1px solid var(--primary);
  padding: 0.4rem 1rem;
}

.hero-title {
  font-family: var(--font-cursive);
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1;
  margin-bottom: 2rem;
  max-width: 900px;
  padding-right: 0.08em;
}

.hero-title-span {
  font-family: var(--font-cursive);
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.5;
  margin-bottom: 2rem;
  max-width: 900px;
  padding-right: 0.08em;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--muted-foreground);
  max-width: 600px;
}

/* === Hero Buttons (About & Resume) — consistent with contact-link style === */
.hero-buttons {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
}

#about-btn,
#resume-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--foreground);
  background: transparent;
  border: 2px solid var(--primary);
  padding: 0.75rem 1.75rem;
  border-radius: 40%;
  cursor: pointer;
  transition:
    color 0.3s var(--smooth),
    border-color 0.3s var(--smooth),
    background 0.3s var(--smooth);
}

#about-btn:hover,
#resume-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

/* === Generic .btn (kept for any other uses) === */
.btn {
  font-family: var(--font-mono);
  background-color: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

/* === PDF Controls === */
.pdf-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#pdf-render {
  width: 100%;
  border: 1px solid var(--border);
}

/* === Section Headers === */
.sec-header {
  text-align: center;
  margin-bottom: 3rem;
}

.sec-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: block;
}

.sec-title {
  font-family: var(--font-cursive);
  font-size: 2.5rem;
  color: var(--foreground);
}

/* === Symmetrical Card Grid === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 566px));
  gap: 1px;
  border: 1px solid var(--border);
  margin-bottom: 5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 3rem;
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s var(--smooth);
  cursor: pointer;
  overflow: hidden;
}

.card::before,
.card::after {
  content: "COORD_X: " attr(data-key);
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.3s;
}

.card::before {
  top: 0.5rem;
  left: 0.5rem;
}

.card::after {
  bottom: 0.5rem;
  right: 0.5rem;
  content: "VER: 2026.1";
}

.card:active {
  transform: translateY(2px);
  background: var(--muted);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.5);
}

.card:hover {
  background: var(--secondary);
  border-color: var(--primary);
  z-index: 10;
}

.card:hover::before,
.card:hover::after {
  opacity: 0.6;
}

.card-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 2rem;
  opacity: 0.8;
}

.card-title {
  font-family: var(--font-cursive);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

/* === Bento Symmetrical === */
.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 900px;
  margin: 4rem auto;
}

.bento-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2.5rem;
  text-align: left;
}

/* === Contact & Footer === */
.contact {
  text-align: center;
  padding: 5rem 0;
  border-top: 1px solid var(--border);
  margin-top: -7px;
}

.contact-title {
  font-family: var(--font-cursive);
  font-size: 2.5rem;
  color: var(--foreground);
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 4rem;
  margin-top: 3rem;
}

.contact-link {
  font-family: var(--font-mono);
  text-decoration: none;
  color: var(--foreground);
  transition:
    color 0.3s var(--smooth),
    border-color 0.3s var(--smooth);
  border: 2px solid var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 40%;
}

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

.footer {
  text-align: center;
  padding: 4rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

/* ============================================================
   MODAL
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s var(--smooth),
    visibility 0.5s var(--smooth);
  pointer-events: none;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* === Symmetrical Modal Grid === */
.modal-grid {
    display: block;
}

.modal-header {
    padding-bottom: 2rem;
}

.modal-body {
    overflow: visible;
}

.modal-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Custom Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: var(--muted);
}
.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
    border: 2px solid var(--muted);
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--primary);

  width: 94vw;
  height: 80vh;
  max-width: 960px;
  max-height: 800px;

  position: relative;
  padding: 4rem;
  overflow-y: auto;
  overflow-x: hidden;

  transform: translateY(20px) scale(0.98);
  transition:
    transform 0.6s var(--smooth),
    clip-path 0.8s var(--smooth);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.9);

  display: flex;
  flex-direction: column;
  clip-path: inset(0 100% 0 0);
}

.modal.active .modal-content {
  transform: translateY(0) scale(1);
  clip-path: inset(0 0 0 0);
}

.modal.modal-resume .modal-content {
  width: 96vw;
  max-width: 1120px;
  height: 88vh;
  max-height: 920px;
}

.modal-close {
  position: sticky;
  top: 0;
  align-self: flex-end;
  flex-shrink: 0;
  margin-bottom: 1.25rem;

  background: var(--muted);
  border: 1px solid var(--primary);
  color: var(--primary);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--primary);
  color: var(--background);
  transform: rotate(90deg);
}

.modal-title {
  font-family: var(--font-cursive);
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--primary);
  padding-bottom: 1rem;
}

.modal-rating {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.modal-desc {
  font-size: 1.1rem;
  color: var(--muted-foreground);
  margin-bottom: 3rem;
}

.modal-sec h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--primary);
  margin: 3rem 0 1rem;
}

.modal-sec ul {
  list-style: none;
  padding-left: 2rem;
  border-left: 1px solid var(--border);
}

.modal-sec li {
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
  color: var(--muted-foreground);
  position: relative;
}

.modal-sec li::before {
  content: "→";
  position: absolute;
  left: -1.5rem;
  color: var(--primary);
}

.modal-links {
  padding-top: 4rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 2rem;
}

.modal-btn {
  padding: 1rem 2.5rem;
  background: var(--primary);
  color: var(--background);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: 2px solid var(--primary);
  cursor: pointer;
  transition:
    background 0.2s var(--smooth),
    color 0.2s var(--smooth);
}

.modal-btn:hover {
  background: transparent;
  color: var(--primary);
}

/* === Page Transitions === */
.page-exit .main {
  animation: slideOut 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

.page-enter .main {
  animation: slideIn 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes slideIn {
  0% {
    transform: translateX(100vw);
  }
  100% {
    transform: none;
  }
}

@keyframes slideOut {
  0% {
    transform: none;
  }
  100% {
    transform: translateX(-100vw);
  }
}

/* === Timeline Scroller === */
.timeline {
  position: fixed;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  height: 75vh;
  width: 2px;
  display: flex;
  justify-content: center;
  z-index: 200;
}

.timeline-line {
  width: 100%;
  height: 100%;
  background-color: var(--border);
}

.timeline-dot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--background);
  transition: top 0.2s ease-out;
}

/* === Responsive === */
@media (max-width: 768px) {
  .timeline {
    display: none;
  }

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

  .contact-links {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  .logo {
    position: relative;
    left: auto;
    transform: none;
    margin-bottom: 2rem;
    display: block;
    text-align: center;
  }

  .modal-content {
    width: 95vw;
    height: 90vh;
    padding: 2.5rem;
  }

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

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  #about-btn,
  #resume-btn {
    width: 100%;
    max-width: 240px;
    text-align: center;
  }

  .modal-links {
    flex-direction: column;
    gap: 1rem;
  }
}
