/* ==========================================================================
   style.css — black & white theme.
   The whole color scheme lives in the variables below. The theme toggle
   (◐ button) flips <html data-theme="light"> and these variables swap.
   ========================================================================== */

/* ---- Dark theme (default): white ink on black paper ---- */
:root {
  --bg: #0a0a0a;
  --card: #121212;
  --ink: #f5f5f5;             /* main text */
  --muted: #9a9a9a;           /* secondary text */
  --line: rgba(255, 255, 255, 0.16);   /* borders / hairlines */
  --dot: rgba(255, 255, 255, 0.10);    /* background dot grid */
  --img-filter: none;         /* SVG line-art illustrations stay white */
  --max-width: 1000px;
}

/* ---- Light theme: black ink on white paper ---- */
[data-theme="light"] {
  --bg: #fafafa;
  --card: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --line: rgba(0, 0, 0, 0.18);
  --dot: rgba(0, 0, 0, 0.10);
  --img-filter: invert(1);    /* flip white line art to black */
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, .logo, .stat-number {
  font-family: "Space Grotesk", system-ui, sans-serif;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================================
   SCROLL-REVEAL ANIMATION
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .caret { animation: none; }
  .marquee-track { animation: none; }
  .skill-fill { transition: none; width: var(--level); }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

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

.logo { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.02em; }
.logo:hover { text-decoration: none; }

.nav-right { display: flex; align-items: center; gap: 1.4rem; }

.nav-links { display: flex; gap: 1.8rem; list-style: none; }
.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.theme-toggle, .nav-toggle {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.theme-toggle { border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; }
.theme-toggle:hover { border-color: var(--ink); }

.nav-toggle { display: none; font-size: 1.5rem; }

/* ==========================================================================
   HERO — centered stack: text → photo → social icons → button
   ========================================================================== */
.hero {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
}

.hero-kicker {
  font-family: monospace;
  color: var(--muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.06em;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2.8vw, 1.5rem);
  color: var(--muted);
  margin: 0.4rem 0 1.6rem;
  min-height: 1.4em;   /* keeps layout stable while text types */
  font-weight: 500;
}

.caret { animation: blink 1s step-end infinite; color: var(--ink); }
@keyframes blink { 50% { opacity: 0; } }

/* Portrait with an offset frame behind it */
.portrait-frame { position: relative; width: 260px; }  /* desktop size */
.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 10px -10px -10px 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  z-index: -1;
  transition: inset 0.25s ease;
}
.portrait-frame:hover::after { inset: 4px -4px -4px 4px; }

.portrait {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  filter: grayscale(1) contrast(1.05);
}

/* Social icon row (GitHub / LinkedIn / Gmail) */
.social-icons {
  list-style: none;
  display: flex;
  gap: 1.1rem;
  margin-top: 1.8rem;
}
.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.social-icons a:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-3px); }
.social-icons svg { width: 20px; height: 20px; }

/* Compact version of the social icons for the navbar */
.nav-social { margin-top: 0; gap: 0.4rem; }
.nav-social a { width: 34px; height: 34px; border: none; }
.nav-social a:hover { transform: none; }
.nav-social svg { width: 18px; height: 18px; }

.hero-buttons { margin-top: 1.8rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.7rem;
  border-radius: 4px;
  font-weight: 600;
  border: 1.5px solid var(--ink);
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

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

.btn-outline { color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--bg); }

/* ==========================================================================
   STATS — big numbers that count up
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.stat {
  padding: 1.8rem 1.4rem;
  text-align: center;
  border-right: 1px solid var(--line);
  transition: background 0.2s ease;
}
.stat:last-child { border-right: none; }
.stat:hover { background: var(--card); text-decoration: none; }

.stat-number { display: block; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
.stat-number::after { content: "+"; color: var(--muted); font-size: 0.6em; }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

/* ==========================================================================
   SCROLLING TECH RIBBON
   The track holds two identical copies of the text; the animation slides
   the track left by exactly one copy's width, so the loop is seamless.
   ========================================================================== */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 4rem;
  padding: 0.9rem 0;
}
.marquee-track {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: scroll 30s linear infinite;
  font-family: monospace;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
.section { padding: 5.5rem 1.5rem; }

.section-title {
  font-size: 1.6rem;
  margin-bottom: 2.4rem;
  letter-spacing: -0.01em;
}

/* ---- About: comfortable reading column ---- */
.about-text { max-width: 720px; }
.about-text p { margin-bottom: 1.2rem; color: var(--muted); font-size: 1.05rem; }
.about-text strong { color: var(--ink); }

/* ---- Projects: cards with photo headers ---- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.6rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;               /* the whole card opens the GitHub page */
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--ink); }

/* Image band on top of each card */
.project-image {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--line);
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* SVG line-art illustrations: contained, theme-inverted */
.project-image img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  filter: var(--img-filter);
  transition: transform 0.35s ease, filter 0.35s ease;
}

/* Photos: fill the band, black & white until you hover — then color */
.project-image img.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.project-card:hover .project-image img { transform: scale(1.07); }
.project-card:hover .project-image img.photo { filter: grayscale(0); }

.project-body { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.project-body h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.project-body p { color: var(--muted); font-size: 0.95rem; flex-grow: 1; }

.project-links { margin-top: 1.1rem; font-size: 0.9rem; font-weight: 600; }
.project-links a::after { content: " →"; transition: margin-left 0.15s ease; }
.project-links a:hover::after { margin-left: 4px; }

/* Small labels (tech tags / foundations) */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.tags li {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.tags li:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-2px); }

/* ==========================================================================
   SKILLS — animated proficiency bars
   Each .skill sets its own width via  style="--level: NN%".
   The fill starts at 0 and slides to that width when the card becomes
   visible (the .reveal → .visible class flip triggers the transition).
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}

.skill-group {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.6rem;
  border-radius: 10px;
  transition: border-color 0.2s ease;
}
.skill-group:hover { border-color: var(--ink); }
.skill-group h3 { font-size: 1.05rem; margin-bottom: 1.1rem; }

.skill {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  margin-bottom: 0.9rem;
}
.skill:last-child { margin-bottom: 0; }

.skill-name { font-size: 0.92rem; }
.skill-tier {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.skill-bar {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  margin-top: 0.35rem;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  width: 0;                                /* animates to --level on reveal */
  background: var(--ink);
  border-radius: 999px;
  transition: width 1.1s cubic-bezier(0.25, 1, 0.4, 1);
}
.reveal.visible .skill-fill { width: var(--level); }

/* Stagger: each bar in a card starts slightly after the previous one */
.skill:nth-child(2) .skill-fill { transition-delay: 0.05s; }
.skill:nth-child(3) .skill-fill { transition-delay: 0.15s; }
.skill:nth-child(4) .skill-fill { transition-delay: 0.25s; }
.skill:nth-child(5) .skill-fill { transition-delay: 0.35s; }

.foundations { margin-top: 1.6rem; }

/* ==========================================================================
   FOOTER — contact links live here now
   ========================================================================== */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.8rem;
  margin-bottom: 1.2rem;
}
.footer-links a { color: var(--muted); font-size: 0.95rem; }
.footer-links a:hover { color: var(--ink); }

/* ==========================================================================
   PHONES & SMALL SCREENS
   ========================================================================== */
@media (max-width: 700px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--card);
    padding: 1.2rem 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }

  .portrait-frame { width: 190px; }   /* phone size */
  .stat { border-right: none; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: none; }
  .section { padding: 3.5rem 0; }
}
