/* ============================================================
   CSS CUSTOM PROPERTIES — edit these to theme your site!
   TODO: Try asking Copilot to suggest a color palette for you.
   ============================================================ */
:root {
  /* Pastel light theme derived from the dark palette */
  --color-bg: #f7fbff; /* very light sky tint */
  --color-bg-alt: #edf7fb; /* pale aqua panel */
  --color-text: #243042; /* softened navy text */
  --color-text-muted: #6e7b8f;
  --color-accent: #63bfd6; /* pastel cyan accent */
  --color-accent-hover: #8fcfe0; /* brighter pastel hover */
  --color-border: #d9eaf3;
  --hero-overlay: rgba(255,255,255,0.68);
  --hero-image: url("photos/Starred (4031).jpg");
  --font-main: 'Segoe UI', system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(99,191,214,0.1);
  --transition: 0.2s ease;
}

/* Dark theme (applied with data-theme="dark") - keeps the previous dark green palette */
[data-theme="dark"] {
  /* Colorful dark theme */
  --color-bg: #071129; /* deep navy */
  --color-bg-alt: #0b2233; /* tealish deep */
  --color-text: #e6f7ff; /* pale cyan text */
  --color-text-muted: #9dd1d8;
  --color-accent: #06b6d4; /* bright cyan accent */
  --color-accent-hover: #7c3aed; /* violet hover for contrast */
  --color-border: #0e2b3a;
  --hero-overlay: rgba(2,8,18,0.5);
  --hero-image: url("photos/Starred (4040).jpg");
  --shadow: 0 6px 24px rgba(6,182,212,0.06);
}

/* Make light mode sections and general colors match dark theme style, but use a pastel green accent */
body:not([data-theme="dark"]) {
  --color-bg: #f7fbff; /* very light sky tint */
  --color-bg-alt: #edf7fb; /* pale aqua panel */
  --color-text: #243042; /* softened navy text */
  --color-text-muted: #6e7b8f;
  --color-accent: #63bfd6; /* pastel cyan accent */
  --color-accent-hover: #8fcfe0; /* brighter pastel hover */
  --color-border: #d9eaf3;
  --hero-overlay: rgba(255,255,255,0.68);
  --shadow: 0 6px 24px rgba(99,191,214,0.1);
}

/* TODO: Add a [data-theme="dark"] block here for dark mode.
   Copilot can generate this for you — try:
   "Add a dark mode theme using CSS custom properties" */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
}

/* Smooth transitions for theme switches */
body, .navbar, .section, .project-card, .btn, .tag, .skill-badge, .hero, .hero-content {
  transition: background-color 240ms ease, color 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-accent);
}

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

.nav-links a {
  color: var(--color-text);
  font-weight: 500;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.8rem 0.45rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-alt);
  color: var(--color-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background-color 240ms ease, border-color 240ms ease, transform 240ms ease, box-shadow 240ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle__track {
  position: relative;
  width: 3rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--color-border);
  transition: background-color 240ms ease;
  flex-shrink: 0;
}

.theme-toggle__thumb {
  position: absolute;
  top: 50%;
  left: 0.18rem;
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 50%;
  background: var(--color-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%);
  transition: transform 240ms ease, background-color 240ms ease;
}

.theme-toggle__label {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.theme-toggle[aria-checked="true"] .theme-toggle__track {
  background: var(--color-accent);
}

.theme-toggle[aria-checked="true"] .theme-toggle__thumb {
  transform: translate(1.35rem, -50%);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* TODO: The nav isn't responsive on mobile yet.
   Ask Copilot: "Make this navbar collapse into a hamburger menu on small screens" */

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  color: var(--color-text);
  overflow: hidden;
}

/* Hero image layer */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  opacity: 1;
  transition: opacity 240ms ease;
}

/* Overlay layer that adapts to theme and transitions */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--hero-overlay);
  z-index: 0;
  transition: background-color 240ms ease, opacity 240ms ease;
}

.hero-content {
  width: min(100%, 1100px);
  max-width: none;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
  width: min(100%, 1100px);
  margin-inline: auto;
  text-align: center;
  white-space: nowrap;
}

.highlight {
  color: var(--color-accent);
}

@keyframes caret-blink {
  50% {
    border-color: transparent;
  }
}

.typing-cursor {
  display: inline-block;
  width: 0.12em;
  height: 1em;
  margin-left: 0.08em;
  border-right: 0.12em solid var(--color-accent);
  vertical-align: -0.08em;
  animation: caret-blink 0.8s step-end infinite;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background: var(--color-accent);
  color: #fff !important;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}

.btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--color-accent) !important;
  border: 2px solid var(--color-accent);
}

.btn-outline:hover {
  background: var(--color-accent);
  color: #fff !important;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 5rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.section-alt {
  background: var(--color-bg-alt);
  max-width: 100%;
  padding: 5rem 2rem;
}

.section-alt > * {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Rounded corners and textured overlay for all non-hero sections */
.section,
.section-alt {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.section > *,
.section-alt > * {
  position: relative;
  z-index: 1;
}

/* Apply a single vertical texture that spans all wrapped sections */
.texture-wrap {
  position: relative;
}

.texture-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("photos/daytexture.jpg");
  background-repeat: no-repeat;
  background-position: center top;
  /* make vertical image span the full height of the wrapper */
  background-size: auto 100%;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.texture-wrap > .section,
.texture-wrap > .section-alt {
  position: relative;
  z-index: 1;
}

/* Dark theme uses a different texture and slightly stronger overlay */
[data-theme="dark"] .texture-wrap::before {
  background-image: url("photos/nighttexture.jpg");
  opacity: 0.16;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
}

/* Accent underline on section headings */
h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
}

.about-text p + p {
  margin-top: 1rem;
}

.avatar-placeholder {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  border: 3px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

/* Avatar image styling */
.avatar {
  width: 160px;
  height: 160px;
  max-width: 160px;
  max-height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--color-accent);
  display: block;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(99, 191, 214, 0.18);
}

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

.project-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.project-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.project-card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
}

.project-links {
  display: flex;
  gap: 0.75rem;
}

.project-links a {
  font-size: 0.875rem;
  font-weight: 600;
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-badge {
  padding: 0.5rem 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  /* TODO: Ask Copilot to add an emoji or icon prefix to each badge */
}

/* Tooltip/proficiency that appears on hover or focus */
.skill-badge {
  position: relative;
  cursor: default;
}

.skill-badge .skill-proficiency {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  transform-origin: bottom center;
}

.skill-badge:hover .skill-proficiency,
.skill-badge:focus .skill-proficiency,
.skill-badge:focus-within .skill-proficiency {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-4px);
}

/* ============================================================
   CONTACT
   ============================================================ */
#contact h2 {
  display: block;
  width: 100%;
  text-align: center;
}

#contact h2::after {
  left: 50%;
  transform: translateX(-50%);
}

.contact-intro {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  font-size: 1.1rem;
  text-align: center;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Visual separation under footer */
.contact-links {
  justify-content: center;
  align-items: center;
  /* smaller gap so icons sit nearer the footer without expanding sections */
  margin-top: 0.1rem;
  padding: 0;
  margin-bottom: 0.75rem;
}

/* Screen-reader-only text */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Circular icon buttons */
.contact-icon {
  padding: 0;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.contact-icon .icon {
  display: inline-block;
}

.contact-icon:hover,
.contact-icon:focus {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  transform: translateY(-3px);
}

/* Ensure inline SVG icons inherit color and size nicely */
.contact-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

@media (max-width: 480px) {
  .contact-icon {
    width: 48px;
    height: 48px;
    font-size: 1.05rem;
  }
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   RESPONSIVE
   TODO: This is a start, but there's more to do on mobile.
   Ask Copilot: "Improve the responsive styles for screens under 600px"
   ============================================================ */
@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .avatar-placeholder {
    width: 100px;
    height: 100px;
  }
}

/* Improved mobile styles for small screens under 600px */
@media (max-width: 600px) {
  /* Nav: hide links to avoid crowding (stacking would need additional JS/menu) */
  .nav-links {
    display: none;
  }

  .navbar {
    padding: 0.75rem 1rem;
  }

  /* Hero: reduce height, padding and scale down text */
  .hero {
    min-height: 60vh;
    padding: 2.5rem 1rem;
  }

  .hero::before {
    background-position: center center;
    background-size: cover;
  }

  .hero h1 {
    font-size: 1.6rem;
    line-height: 1.15;
    width: auto;
    margin-inline: 0;
    text-align: center;
    white-space: normal;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }

  /* Projects: single column for narrow screens */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Ensure images keep aspect, centered cropping instead of stretching */
  img, .avatar, .project-card img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center center;
    display: block;
  }

  /* If project images are placed inside cards, crop gracefully */
  .project-card {
    overflow: hidden;
  }

  /* Slightly smaller section padding to fit mobile view */
  .section, .section-alt {
    padding: 2.5rem 1rem;
  }
}
