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

:root {
  --f: 'Geist', sans-serif;
  --fm: 'Geist Mono', monospace;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --fg: #111110;
  --fg2: #6f6e6a;
  --fg3: #a8a7a3;
  --border: #e4e4e0;
  --accent: #7F77DD;
  --accent-bg: #EEEDFE;
  --accent-text: #3C3489;
  --nav: 60px;
}

/* Hide elements initially to prevent Flash of Unstyled Content (FOUC) before GSAP loads */
.gsap-reveal { visibility: hidden; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--f);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
}

nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav);
  background: rgba(247,247,245,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
}

.logo {
  font-family: var(--fm);
  font-size: 13px;
  color: var(--fg2);
  text-decoration: none;
}

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

.nav-links {
  display: flex; gap: 28px; list-style: none;
}

.nav-links a {
  font-family: var(--f);
  font-size: 13px;
  font-weight: 400;
  color: var(--fg2);
  text-decoration: none;
  transition: color 0.15s;
}

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

@media (max-width: 600px) {
  nav { padding: 0 20px; }
  .nav-links { display: none; }
}

section { padding: 88px 0 72px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 40px; }

@media (max-width: 600px) {
  .wrap { padding: 0 20px; }
  section { padding: 64px 0 52px; }
}

.label {
  font-family: var(--fm);
  font-size: 11px;
  color: var(--fg3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h1 {
  font-family: var(--f);
  font-size: clamp(44px, 7vw, 68px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 24px;
}

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

h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-desc {
  font-size: 16px;
  color: var(--fg2);
  max-width: 460px;
  line-height: 1.75;
  margin-bottom: 40px;
  font-weight: 300;
}

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  font-family: var(--f);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  display: inline-block;
  letter-spacing: 0.01em;
  will-change: transform; /* Helps GSAP perform better */
}

.btn-solid {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
}
.btn-solid:hover { background: #333; border-color: #333; }

.btn-outline {
  background: transparent;
  color: var(--fg2);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--fg2); color: var(--fg); }

/* --- POLAROID STYLING --- */
.polaroid {
  position: absolute;
  right: -80px; 
  top: 20px;
  width: 220px;
  padding: 12px 12px 45px 12px;
  background: #ffffff;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08), 0 5px 15px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  transform: rotate(6deg);
  z-index: 10;
  will-change: transform;
}

.polaroid img {
  width: 100%;
  height: auto;
  display: block;
  background-color: var(--border);
  filter: contrast(1.05) saturate(1.05); /* Slight filter to make it pop */
}

.polaroid-caption {
  font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif; /* Handwritten vibe */
  font-size: 14px;
  color: #333;
  text-align: center;
  position: absolute;
  bottom: 14px;
  width: calc(100% - 24px);
  transform: rotate(-2deg); /* Counter-rotate the text slightly for realism */
}

@media (max-width: 950px) {
  .polaroid {
    display: none; /* Hide on smaller screens to prevent overlapping text */
  }
}
/* ------------------------ */

hr { border: none; border-top: 1px solid var(--border); margin: 0; }

#hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center;
  padding-top: var(--nav);
}

.hero-wrap {
  position: relative;
}

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 32px;
}

.work-header-title {
  margin-bottom: 0;
}

.btn-compact {
  padding: 6px 14px;
  font-size: 11px;
}

.proj-body {
  display: grid;
  grid-template-columns: 1fr 20px;
  gap: 16px;
  align-items: start;
}

.proj-img--missing {
  display: none;
}

.about-body {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 60px;
  align-items: start;
}

@media (max-width: 600px) {
  .about-body { grid-template-columns: 1fr; gap: 32px; }
}

.about-body p {
  font-size: 15px;
  color: var(--fg2);
  line-height: 1.8;
  font-weight: 300;
  margin-bottom: 14px;
}

.about-facts { display: flex; flex-direction: column; }

.fact {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.fact:first-child { border-top: 1px solid var(--border); }

.fact-key {
  font-family: var(--fm);
  font-size: 11px;
  color: var(--fg3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fact-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  text-align: right;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 500px) {
  .skills-grid { grid-template-columns: 1fr; }
  .skill-block { border-right: none !important; }
}

.skill-block {
  padding: 24px 28px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.skill-block:nth-child(2n) { border-right: none; }
.skill-block:nth-last-child(-n+2) { border-bottom: none; }

.skill-head {
  font-family: var(--fm);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg3);
  margin-bottom: 14px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-family: var(--fm);
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--fg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tag:hover {
  transform: translateY(-2px);
  border-color: var(--fg2);
}

.tag.hi {
  background: var(--accent-bg);
  color: var(--accent-text);
  border-color: transparent;
}

.proj-list { display: flex; flex-direction: column; gap: 32px; padding-top: 16px; }

.proj {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.proj:hover .proj-name { color: var(--accent); }
.proj:hover .proj-arrow { color: var(--accent); transform: translate(3px, -3px); }

.proj-arrow {
  font-size: 16px;
  color: var(--fg3);
  transition: all 0.15s;
  padding-top: 28px;
}

/* Image container for parallax */
.proj-img-wrap {
  width: 100%;
  height: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden; /* Crucial for parallax hiding edges */
  background-color: #e4e4e0;
}

.proj-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* --img-y sets the vertical crop focus per-image (0% = top, 50% = center,
     100% = bottom) — set it inline via style="--img-y: 20%" instead of
     writing out a full object-position/object-fit override each time. */
  object-position: center var(--img-y, 50%);
  /* Scale up slightly to give parallax room to move without showing edges */
  transform: scale(1.15);
}

/* Archive page cards: same --img-y knob, different fixed box size */
.archive-card .proj-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center var(--img-y, 50%);
  border-radius: 6px;
  margin-bottom: 16px;
}

.proj-idx {
  font-family: var(--fm);
  font-size: 11px;
  color: var(--fg3);
  margin-bottom: 8px;
}

.proj-name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  transition: color 0.15s;
}

.proj-desc {
  font-size: 13px;
  color: var(--fg2);
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 14px;
}

.proj-stack { display: flex; gap: 6px; flex-wrap: wrap; }

.stack-tag {
  font-family: var(--fm);
  font-size: 11px;
  color: var(--fg3);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.resume-block { margin-bottom: 52px; }

.resume-block-head {
  font-family: var(--fm);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg3);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.resume-row {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 24px;
}

@media (max-width: 500px) {
  .resume-row { grid-template-columns: 1fr; gap: 8px; }
  .resume-date { text-align: left !important; }
}

.resume-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}

.resume-company {
  font-family: var(--fm);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
}

.resume-note {
  font-size: 13px;
  color: var(--fg2);
  line-height: 1.6;
  font-weight: 300;
}

.resume-date {
  font-family: var(--fm);
  font-size: 12px;
  color: var(--fg3);
  text-align: right;
}

#contact {
  background: var(--fg);
}

.contact-label {
  font-family: var(--fm);
  font-size: 11px;
  color: #a8a7a3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.contact-h {
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 12px;
}

.contact-sub {
  font-size: 15px;
  color: #a8a7a3;
  max-width: 320px;
  margin: 0 0 40px;
  font-weight: 300;
}

.contact-rows {
  border-top: 1px solid #333333;
  max-width: 480px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #333333;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
  will-change: transform;
}

.contact-row:hover { padding-left: 6px; opacity: 1; }
.contact-row:hover .ca { color: var(--accent); transform: translate(3px, -3px); }

.cp {
  font-family: var(--fm);
  font-size: 11px;
  color: #a8a7a3;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ch {
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
}

.ca { font-size: 16px; color: #a8a7a3; transition: all 0.15s; }

.site-footer {
  background: var(--fg);
  border-top: 1px solid #1a1a1a;
  padding: 40px 40px 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-meta {
  font-family: var(--fm);
  font-size: 11px;
  color: #888;
}

/* --- Projects archive page (projects.html) --- */
.back-link {
  font-family: var(--f);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
}

.page-projects section {
  padding: 120px 0 72px;
}

.page-projects .wrap {
  max-width: 1000px;
}

@media (max-width: 600px) {
  .page-projects section {
    padding: 100px 0 52px;
  }
}

.page-projects h1 {
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.2;
}

.header-desc {
  font-size: 16px;
  color: var(--fg2);
  margin-bottom: 48px;
  font-weight: 300;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

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

.archive-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  will-change: transform;
}

.archive-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
  border-color: #d0d0cc;
}

.archive-card:hover .card-title {
  color: var(--accent);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.folder-icon {
  font-size: 20px;
  color: var(--accent);
}

.github-link {
  font-size: 18px;
  color: var(--fg3);
  transition: color 0.15s;
}

.archive-card:hover .github-link {
  color: var(--fg);
}

.card-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  transition: color 0.15s;
}

.card-desc {
  font-size: 13px;
  color: var(--fg2);
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 24px;
  flex-grow: 1;
}

.archive-card .proj-stack {
  margin-top: auto;
}

.archive-card .stack-tag {
  background: var(--bg);
}

#hardware-matrix {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  /* Fades the rain out before it hits your text */
  mask-image: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 20%);
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 20%);
}