/* ==========================================================================
   PORTFOLIO STYLES
   Theme: dark aerospace / robotics
   Organized top-to-bottom to match the HTML: variables, base, background,
   nav, hero, sections, cards, forms, footer, responsive, animations.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES (design tokens)
   Change these to re-theme the whole site from one place.
-------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-bg: #0a0e14;          /* near-black background */
  --color-bg-alt: #0d1420;      /* slightly lighter panel background */
  --color-surface: #111927;     /* card / panel surface */
  --color-border: #1f2b3d;      /* subtle borders */

  --color-text: #d7e1ec;        /* main body text */
  --color-text-dim: #8593a6;    /* secondary / muted text */

  --color-accent: #4fd8ff;      /* cyan — primary accent (HUD blue) */
  --color-accent-dim: #2a6f85;  /* dimmer cyan for grid lines etc */
  --color-warn: #ff9f4f;        /* amber — used sparingly for highlights */

  /* Typography */
  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Share Tech Mono', monospace;

  /* Layout */
  --max-width: 1100px;
  --section-padding: 6rem 1.5rem;

  /* Motion */
  --transition-fast: 0.2s ease;
  --transition-med: 0.4s ease;
}

/* --------------------------------------------------------------------------
   2. RESET / BASE STYLES
-------------------------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden; /* prevent horizontal scroll from the grid background */
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

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

ul {
  list-style: none;
}

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

/* --------------------------------------------------------------------------
   3. ANIMATED BLUEPRINT GRID BACKGROUND
   Two overlaid grids (fine + bold) that slowly drift diagonally.
   position: fixed keeps it behind all content and unaffected by scrolling.
-------------------------------------------------------------------------- */
.blueprint-grid {
  position: fixed;
  inset: 0; /* top/right/bottom/left: 0 */
  z-index: -1;
  background-color: var(--color-bg);

  /* Fine grid lines (small squares) + bold grid lines (large squares) */
  background-image:
    linear-gradient(rgba(79, 216, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 216, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(79, 216, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 216, 255, 0.12) 1px, transparent 1px);
  background-size:
    24px 24px,
    24px 24px,
    120px 120px,
    120px 120px;

  animation: drift-grid 40s linear infinite;
}

/* A soft radial glow so the grid isn't perfectly flat/uniform */
.blueprint-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(79, 216, 255, 0.08),
    transparent 60%
  );
}

@keyframes drift-grid {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  to {
    /* Move the grid by exactly one large-cell size so the loop is seamless */
    background-position: 120px 120px, 120px 120px, 120px 120px, 120px 120px;
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .blueprint-grid {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   4. NAVIGATION
-------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

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

.logo {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

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

.nav-links a {
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-dim);
  position: relative;
  padding-bottom: 4px;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-accent);
}

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

/* Hamburger button — hidden on desktop, shown on mobile via media query */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-accent);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* --------------------------------------------------------------------------
   5. HERO SECTION
-------------------------------------------------------------------------- */
.hero {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  position: relative;
}

.hero-content {
  max-width: 750px;
}

/* The name starts invisible and slides up into place. JS adds the
   "show" class once the intro sequence reaches this step. */
.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  color: var(--color-accent);
  margin-bottom: 0.8rem;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-title.show {
  opacity: 1;
  transform: translateY(0);
}

.hero-subtitle {
  color: var(--color-text-dim);
  font-size: 1.05rem;
}

/* The tagline lives inside a plain inline span — script.js fills it in
   one character at a time, so there's no fade needed here; the text
   itself appearing IS the animation. */
.hero-line {
  white-space: pre-wrap; /* preserves spacing and allows wrapping on small screens */
}

/* Scroll-down indicator at the bottom of the hero */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-hint-line {
  display: block;
  width: 1px;
  height: 40px;
  background: linear-gradient(var(--color-accent), transparent);
  animation: scroll-hint-move 2s ease-in-out infinite;
}

@keyframes scroll-hint-move {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(10px); opacity: 0.3; }
}

/* --------------------------------------------------------------------------
   6. BUTTONS (shared across sections)
-------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.8rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn-primary {
  background: var(--color-accent);
  color: #04121a;
  font-weight: bold;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(79, 216, 255, 0.4);
}

/* --------------------------------------------------------------------------
   7. SHARED SECTION LAYOUT
-------------------------------------------------------------------------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--section-padding);
}

.section-heading {
  margin-bottom: 3rem;
  text-align: center;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

/* --------------------------------------------------------------------------
   8. ABOUT SECTION
-------------------------------------------------------------------------- */
.about-content {
  max-width: 700px;
  margin: 0 auto;
}

.about-content p {
  color: var(--color-text-dim);
  margin-bottom: 1rem;
}

.about-facts {
  margin-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.about-facts li {
  display: flex;
  gap: 0.75rem;
  padding: 0.4rem 0;
  font-size: 0.95rem;
}

.about-facts li span {
  color: var(--color-accent);
  min-width: 90px;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

/* --------------------------------------------------------------------------
   9. PROJECTS SECTION
-------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden; /* keeps the media's corners rounded to match the card */
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-accent);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Media area for each project's photo or video.
   To add your own media, replace the ".project-media-placeholder" div in
   the HTML with an <img> or <video> tag — this wrapper will automatically
   crop it to a consistent 16:9 shape via object-fit: cover. */
.project-media {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.project-media img,
.project-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-dim);
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.project-body {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-card-header {
  margin-bottom: 1rem;
  font-size: 0.75rem;
  letter-spacing: 1px;
}

.project-status {
  color: var(--color-accent);
  border: 1px solid var(--color-accent-dim);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
}

.project-body h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.project-subtitle {
  color: var(--color-accent);
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

.project-body p {
  color: var(--color-text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  flex-grow: 1; /* pushes tags to the bottom so cards align evenly */
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-tags li {
  font-size: 0.75rem;
  color: var(--color-warn);
  background: rgba(255, 159, 79, 0.08);
  border: 1px solid rgba(255, 159, 79, 0.25);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
}

/* Small "view full write-up" hint at the bottom of each card — the
   whole card is a link, this just makes that obvious. */
.project-view-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--color-accent);
}

.project-card:hover .project-view-link {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   10. PROJECT DETAIL PAGE
   Styles for the individual "projects/*.html" write-up pages — a link
   back to the grid, a big hero image/video, and a readable article body.
-------------------------------------------------------------------------- */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--color-accent);
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.project-detail-header {
  margin-bottom: 2rem;
}

.project-detail-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0.8rem 0 0.3rem;
}

.project-detail-header .project-subtitle {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.project-detail-header .project-tags {
  margin-top: 1rem;
}

.project-hero-media {
  width: 100%;
  aspect-ratio: 16 / 9; /* keeps a consistent shape even before media is added */
  max-height: 500px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  margin-bottom: 2.5rem;
}

.project-hero-media img,
.project-hero-media video {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  display: block;
}

/* The written write-up itself — narrower than the full page width so
   long paragraphs stay comfortable to read. */
.project-article {
  max-width: 720px;
  margin: 0 auto;
}

.project-article h2 {
  font-size: 1.3rem;
  color: var(--color-accent);
  margin: 2.5rem 0 1rem;
}

.project-article h2:first-child {
  margin-top: 0;
}

.project-article p {
  color: var(--color-text-dim);
  margin-bottom: 1.2rem;
}

.project-article ul {
  margin: 0 0 1.2rem 1.2rem;
  color: var(--color-text-dim);
  list-style: disc;
}

.project-article li {
  margin-bottom: 0.4rem;
}

.project-article img,
.project-article video {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin: 1rem 0 1.5rem;
}

.project-article figcaption {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  text-align: center;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   11. CONTACT SECTION
-------------------------------------------------------------------------- */
.contact-wrapper {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-intro {
  color: var(--color-text-dim);
  margin-bottom: 2rem;
}

.contact-form {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.75rem;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-status {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--color-accent);
  min-height: 1.2em; /* reserves space so layout doesn't jump when text appears */
}

/* --------------------------------------------------------------------------
   12. FOOTER
-------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  color: var(--color-text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--color-text-dim);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   13. SCROLL REVEAL ANIMATION
   Elements start hidden/offset via .reveal, then JS adds .reveal-visible
   (via IntersectionObserver) once they enter the viewport.
-------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   14. RESPONSIVE / MEDIA QUERIES
-------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Turn the nav links into a slide-down mobile menu */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-med);
  }

  .nav-links.open {
    max-height: 300px;
  }

  .nav-links li {
    border-top: 1px solid var(--color-border);
  }

  .nav-links a {
    display: block;
    padding: 1rem 1.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  /* Turn the hamburger into an "X" when the menu is open */
  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
}
