/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  /* Dark mode (default) */
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #334155;
  --color-border: #334155;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-accent: #3b82f6;
  --color-accent-hover: #60a5fa;
  --color-accent-light: #1e3a5f;
  --color-nav-bg: rgba(15, 23, 42, 0.92);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --radius: 0.5rem;
  --radius-sm: 0.25rem;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);

  --container-width: 900px;
  --nav-height: 64px;
  --section-padding: 5rem;
}

[data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-surface-alt: #f1f5f9;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-light: #dbeafe;
  --color-nav-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Applied only during theme toggle — removed immediately after transition */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease !important;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
}

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

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

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

.nav-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.nav-name:hover {
  color: var(--color-accent);
  text-decoration: none;
}

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

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--color-text);
}

/* Show sun in dark mode, moon in light mode */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: flex; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.35rem;
  color: var(--color-text);
  padding: 0.25rem;
  line-height: 1;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
}

.hero .container {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero h2 {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 400;
  color: var(--color-accent);
  margin-bottom: 1.5rem;
}

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

.hero-summary {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--color-accent);
  color: #ffffff;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--color-accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-outline:hover {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  padding: var(--section-padding) 0;
  border-top: 1px solid var(--color-border);
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

/* ============================================================
   Photos
   ============================================================ */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

@media (max-width: 768px) {
  .photos-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .photos-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Work — Skills
   ============================================================ */
.skills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.skill-group h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.skill-list li {
  font-size: 0.9rem;
}

/* ============================================================
   Work — Experience
   ============================================================ */
.experience {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.job {
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.job-role {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.job-company {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  display: block;
}

.job-dates {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  padding-top: 0.1rem;
}

.job-bullets {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.job-bullets li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* ============================================================
   Projects
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.project-card {
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, background-color 0.15s;
}

.project-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--color-accent);
  background-color: var(--color-surface-alt);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.project-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.project-card h3 a {
  color: var(--color-text);
}

/* Stretched link — expands the <a> to cover the entire card */
.project-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.project-card:hover h3 a {
  color: var(--color-accent);
  text-decoration: none;
}

.project-card p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: var(--radius-sm);
}

/* ============================================================
   Status Badges
   ============================================================ */
.status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.status-active   { background: #dcfce7; color: #166534; }
.status-archived { background: var(--color-surface-alt); color: var(--color-text-muted); }
.status-wip      { background: #fef9c3; color: #854d0e; }

/* ============================================================
   Life
   ============================================================ */
.life-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.life-card {
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  position: relative;
}

.life-card--linked {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, background-color 0.15s;
}

.life-card--linked:hover {
  box-shadow: var(--shadow);
  border-color: var(--color-accent);
  background-color: var(--color-surface-alt);
}

.stretched-link {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.life-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.life-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.highlights {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.highlights li {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Contact
   ============================================================ */
.contact-intro {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  max-width: 560px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 560px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-group input,
.form-group textarea {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  transition: border-color 0.15s;
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

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

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-status {
  font-size: 0.875rem;
}

.form-status--success { color: #22c55e; }
.form-status--error   { color: #ef4444; }

/* ============================================================
   Resume Viewer
   ============================================================ */
.resume-viewer {
  padding-top: var(--nav-height);
  padding-bottom: 3rem;
}

.resume-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.resume-embed {
  display: block;
  width: 100%;
  max-width: 860px;
  /* US Letter aspect ratio — sizes embed to show the full page */
  aspect-ratio: 8.5 / 11;
  margin: 0 auto;
  border: none;
  border-radius: var(--radius);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer a {
  color: var(--color-text-muted);
}

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

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.footer-social a {
  font-size: 0.875rem;
}

/* ============================================================
   Education
   ============================================================ */
.education {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.education-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.education-degree {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.education-school {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 768px) {
  :root { --section-padding: 3.5rem; }

  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  .nav-links.open { display: flex; }

  .skills          { grid-template-columns: repeat(2, 1fr); }
  .projects-grid   { grid-template-columns: 1fr 1fr; }
  .life-grid       { grid-template-columns: 1fr; }

  .job-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 480px) {
  .skills        { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }

  .hero-actions  { flex-direction: column; }
  .btn           { text-align: center; }
}
