/* ============================================
   DESIGN TOKENS — LIGHT MODE
   ============================================ */
:root {
  --bg: #f6efe4;
  --bg-soft: #fff7ec;
  --ink: #1c1b1a;
  --ink-soft: #4b4844;
  --accent: #ee5a2e;
  --accent-2: #087e8b;
  --card: rgba(255, 255, 255, 0.62);
  --card-border: rgba(255, 255, 255, 0.7);
  --line: rgba(28, 27, 26, 0.1);
  --shadow: 0 16px 40px rgba(34, 29, 24, 0.12);
  --shadow-hover: 0 22px 50px rgba(34, 29, 24, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --container: 1120px;
}

/* ============================================
   DESIGN TOKENS — DARK MODE
   ============================================ */
html[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-soft: #1a1a1a;
  --ink: #eae6e1;
  --ink-soft: #9f9b97;
  --accent: #ff6b3d;
  --accent-2: #3dd6e8;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 22px 50px rgba(0, 0, 0, 0.45);
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% -5%, #ffd8c4 0, transparent 45%),
    radial-gradient(circle at 100% 25%, #cceef2 0, transparent 45%),
    linear-gradient(160deg, var(--bg) 0%, #f4e8d7 100%);
  min-height: 100vh;
  position: relative;
  transition: color 0.35s ease;
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at 15% -5%, rgba(255, 100, 50, 0.06) 0, transparent 45%),
    radial-gradient(circle at 100% 25%, rgba(61, 214, 232, 0.04) 0, transparent 45%),
    linear-gradient(160deg, #0f0f0f 0%, #1a1510 100%);
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, 0.02) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
  opacity: 0.4;
  z-index: -1;
}

html[data-theme="dark"] .noise-layer {
  background-image: radial-gradient(rgba(255, 255, 255, 0.012) 0.6px, transparent 0.6px);
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  width: min(var(--container), 92%);
  margin: 0 auto;
}

.section {
  padding: 5rem 0;
}

/* ============================================
   HEADER & NAV
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(28, 27, 26, 0.08);
  background: rgba(250, 242, 231, 0.68);
  transition: background 0.35s ease, border-color 0.35s ease;
}

html[data-theme="dark"] .site-header {
  background: rgba(15, 15, 15, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================
   BRAND
   ============================================ */
.brand {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

.brand-dot {
  width: 11px;
  aspect-ratio: 1;
  background: linear-gradient(140deg, var(--accent), #ff9f68);
  border-radius: 999px;
  box-shadow: 0 0 0 6px rgba(238, 90, 46, 0.17);
}

/* ============================================
   NAV LINKS
   ============================================ */
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
  position: relative;
  transition: color 0.25s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ============================================
   MENU TOGGLE
   ============================================ */
.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.5rem;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}

html[data-theme="dark"] .menu-toggle {
  background: rgba(255, 255, 255, 0.06);
}

.menu-toggle .bar {
  display: block;
  height: 2px;
  background: var(--ink);
  margin: 5px 0;
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: scale(1.05);
}

html[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Show sun icon in dark mode, moon icon in light mode */
.theme-icon.sun {
  display: none;
}

html[data-theme="dark"] .theme-icon.moon {
  display: none;
}

html[data-theme="dark"] .theme-icon.sun {
  display: block;
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.8rem;
  margin: 0 0 1rem;
}

.headline {
  font-family: "Syne", sans-serif;
  font-size: clamp(2.1rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 11ch;
}

.headline span {
  color: var(--accent);
}

.subhead {
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.22rem);
  margin: 1.4rem 0 2rem;
  line-height: 1.75;
}

.section-heading h2 {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  margin: 0;
}

/* ============================================
   AVATAR / PHOTO PLACEHOLDER
   ============================================ */
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin-bottom: 1.2rem;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px rgba(238, 90, 46, 0.2);
  transition: box-shadow 0.35s ease;
}

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

/* ============================================
   TYPING ANIMATION
   ============================================ */
.typing-wrapper {
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--ink-soft);
  margin: 1rem 0 0;
  min-height: 1.6em;
}

.typing-prefix {
  color: var(--ink-soft);
}

.typing-text {
  color: var(--accent);
  font-weight: 500;
}

.typing-cursor {
  color: var(--accent);
  animation: blink 0.75s step-end infinite;
  margin-left: 1px;
  font-weight: 300;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ============================================
   HERO META & ACTIONS
   ============================================ */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1.6rem;
}

.hero-meta span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] .hero-meta span {
  background: rgba(255, 255, 255, 0.05);
}

.hero-actions,
.contact-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.82rem 1.25rem;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #fb7f44);
  color: #fff;
  box-shadow: 0 10px 22px rgba(238, 90, 46, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(238, 90, 46, 0.35);
}

.btn-ghost {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

html[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   HERO GRID
   ============================================ */
.hero-grid {
  margin-top: 2.4rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ============================================
   CARDS (shared base)
   ============================================ */
.hero-grid article,
.card,
.project-card,
.timeline-item,
.contact-panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.35s ease;
}

/* Card hover */
.hero-grid article:hover,
.card:hover,
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(238, 90, 46, 0.15);
}

html[data-theme="dark"] .hero-grid article:hover,
html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .project-card:hover {
  border-color: rgba(255, 107, 61, 0.2);
}

/* Card text */
.hero-grid h3,
.card h3,
.project-card h3,
.timeline-item h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.hero-grid p,
.card li,
.project-card p,
.timeline-item p,
.about-content p,
.contact-panel p {
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ============================================
   ABOUT
   ============================================ */
.about-content {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
  margin-top: 1.4rem;
}

/* ============================================
   SKILLS
   ============================================ */
.skills-grid {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.card ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

/* ============================================
   PROJECTS
   ============================================ */
.projects-grid {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project-card .tag,
.timeline-meta {
  margin: 0 0 0.65rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
  margin-top: 1.6rem;
  display: grid;
  gap: 1rem;
  position: relative;
  padding-left: 40px;
}

/* Vertical line */
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
}

/* Timeline dots */
.timeline-item::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  left: -40px;
  top: 1.25rem;
  z-index: 1;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* Active (first) dot — filled */
.timeline-item:first-child::after {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(238, 90, 46, 0.15);
}

.timeline-item:hover::after {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(8, 126, 139, 0.12);
}

/* ============================================
   CONTACT
   ============================================ */
.contact-panel {
  margin-top: 1rem;
  padding: 1.6rem;
}

.contact-meta {
  margin: 0.35rem 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid rgba(28, 27, 26, 0.08);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
  transition: border-color 0.35s ease;
}

html[data-theme="dark"] .site-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* ============================================
   BACK TO TOP
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================
   REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.reveal.visible {
  opacity: 1;
  transform: none;
  animation: reveal-in 0.6s ease backwards;
}

@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* ============================================
   RESPONSIVE — TABLET (980px)
   ============================================ */
@media (max-width: 980px) {
  .hero-grid,
  .about-content,
  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================================
   RESPONSIVE — MOBILE (760px)
   ============================================ */
@media (max-width: 760px) {
  .section {
    padding: 3.5rem 0;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    right: 4%;
    top: 80px;
    width: min(300px, 92vw);
    padding: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 247, 236, 0.96);
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.2rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  html[data-theme="dark"] .nav-links {
    background: rgba(22, 22, 22, 0.96);
  }

  .nav-links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-links a {
    display: block;
    padding: 0.6rem;
    border-radius: 8px;
    transition: background 0.2s ease;
  }

  .nav-links a:hover {
    background: rgba(238, 90, 46, 0.1);
  }

  .menu-toggle.open .bar:nth-child(3) {
    opacity: 0;
  }

  .menu-toggle.open .bar:nth-child(2) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-toggle.open .bar:nth-child(4) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero-grid,
  .about-content,
  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    padding-left: 32px;
  }

  .timeline::before {
    left: 5px;
  }

  .timeline-item::after {
    left: -32px;
    width: 12px;
    height: 12px;
  }

  .back-to-top {
    bottom: 1.2rem;
    right: 1.2rem;
    width: 42px;
    height: 42px;
  }

  .hero-actions {
    gap: 0.6rem;
  }

  .btn {
    padding: 0.72rem 1.1rem;
    font-size: 0.88rem;
  }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (480px)
   ============================================ */
@media (max-width: 480px) {
  .section {
    padding: 2.5rem 0;
  }

  .headline {
    font-size: clamp(1.8rem, 10vw, 2.8rem);
  }

  .section-heading h2 {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  .hero-meta span {
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
  }

  .avatar {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }

  .contact-panel {
    padding: 1.2rem;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }

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

  .reveal.visible {
    animation: none;
  }

  .typing-cursor {
    animation: none;
    opacity: 1;
  }
}
