/* ==============================================
   Personal Website — Taste-Skill + Dark Mode
   Robotics Engineer · Minimal · Typographic
   ============================================== */

/* --- Theme Variables --- */
:root {
  --bg: #FAFAFA;
  --bg-alt: #F2F2F2;
  --text: #1A1A1A;
  --text-secondary: #777;
  --text-muted: #999;
  --accent: #3B5998;
  --accent-hover: #2A4370;
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);
  --hr-color: rgba(59, 89, 152, 0.18);
  --glow-1: rgba(59, 89, 152, 0.08);
  --glow-2: rgba(59, 89, 152, 0.04);
  --tag-bg: transparent;
  --tag-border: rgba(0, 0, 0, 0.1);
  --tag-color: #555;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0D0D0D;
  --bg-alt: #141414;
  --text: #E5E5E5;
  --text-secondary: #999;
  --text-muted: #666;
  --accent: #6B9BD2;
  --accent-hover: #8BB5E8;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --hr-color: rgba(107, 155, 210, 0.2);
  --glow-1: rgba(107, 155, 210, 0.12);
  --glow-2: rgba(107, 155, 210, 0.06);
  --tag-bg: transparent;
  --tag-border: rgba(255, 255, 255, 0.12);
  --tag-color: #999;
}

/* System preference — only when no manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0D0D;
    --bg-alt: #141414;
    --text: #E5E5E5;
    --text-secondary: #999;
    --text-muted: #666;
    --accent: #6B9BD2;
    --accent-hover: #8BB5E8;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --hr-color: rgba(107, 155, 210, 0.2);
    --glow-1: rgba(107, 155, 210, 0.12);
    --glow-2: rgba(107, 155, 210, 0.06);
    --tag-bg: transparent;
    --tag-border: rgba(255, 255, 255, 0.12);
    --tag-color: #999;
  }
}

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

/* --- Base --- */
html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2.5rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
}

h1 { font-size: 2.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.35rem; margin-bottom: 1rem; font-weight: 500; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1.2rem;
}

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

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

/* --- Horizontal Rule --- */
hr {
  border: none;
  border-top: 1px solid var(--hr-color);
  margin: 5rem 0;
}

/* --- Navigation --- */
.site-nav {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 3rem 0 4rem 0;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--text);
}

.site-nav .nav-home {
  margin-right: auto;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.01em;
}

.site-nav .nav-lang {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav .nav-lang:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem;
  line-height: 0;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.theme-toggle:hover {
  background: var(--border);
}

/* Sun/Moon SVG animation */
.sun-moon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:active .sun-moon {
  transform: scale(0.85);
}

/* Rays hidden in light mode (moon), visible in dark mode (sun) */
.sun-moon .rays {
  opacity: 0;
  transform-origin: 11px 11px;
  transform: rotate(-60deg) scale(0.5);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Body circle: filled in light (moon), hollow in dark (sun) */
.sun-moon .body {
  fill: currentColor;
  transition: fill 0.35s ease;
}

/* Dark mode = show sun */
[data-theme="dark"] .sun-moon {
  transform: rotate(180deg);
}

[data-theme="dark"] .sun-moon .rays {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .sun-moon .body {
  fill: none;
}

/* --- Footer --- */
.site-footer {
  margin-top: 10rem;
  padding: 3rem 0 5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 2rem;
}

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

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

/* ==============================================
   HOMEPAGE — Asymmetric Hero + Decorative Glow
   ============================================== */

.hero-wrapper {
  position: relative;
  padding: 2rem 0 0 0;
}

/* Decorative glow — robotics/engineering geometric */
.hero-glow {
  position: absolute;
  top: -80px;
  right: -40px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--glow-1) 0%, var(--glow-2) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* Subtle grid lines — engineering/technical feel */
.hero-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.15) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero {
  display: flex;
  align-items: center;
  gap: 4rem;
  padding: 3rem 0 3rem 0;
  position: relative;
  z-index: 1;
}

.hero-text {
  flex: 1;
  max-width: 65%;
}

.hero-name {
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero-role {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Highlights list — multi-line key points */
.hero-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem 0;
}

.hero-highlights li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero-highlights li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  opacity: 0.5;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 28rem;
  line-height: 1.6;
}

/* Education logos — inline below hero name */
.edu-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.edu-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.edu-badge img {
  opacity: 0.6;
}


.hero-photo {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.hero-photo img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(30%);
  border: 2px solid var(--border);
}

/* Curated — border-t list, anti-card */
.curated {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 1rem 0 3rem 0;
}

.curated-item {
  padding: 2rem 2rem 2rem 0;
  border-top: 1px solid var(--border);
}

.curated-item:last-child {
  padding-right: 0;
}

.curated-item .item-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.curated-item h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.curated-item h3 a {
  color: var(--text);
}

.curated-item h3 a:hover {
  color: var(--accent);
}

.curated-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ==============================================
   RESUME PAGE
   ============================================== */

.resume-bio {
  font-size: 1.1rem;
  max-width: 34rem;
  margin-bottom: 2rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 2.5rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: 1px solid var(--border);
}

.timeline-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 0.1rem;
}

.timeline-meta .company {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.15rem;
}

.timeline-content h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.timeline-content ul {
  margin: 0;
  padding-left: 1.2rem;
}

.timeline-content li {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Skills Tags */
.skills-section {
  margin-top: 3rem;
}

.skills-section h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 500;
}

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

.skill-tag {
  font-size: 0.78rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--tag-border);
  color: var(--tag-color);
}

/* Resume Download Link */
.resume-download {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==============================================
   PROJECTS PAGE
   ============================================== */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem 2.5rem;
}

.project-card {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.project-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

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

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

.project-card .project-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.project-card .project-tech {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.project-card img {
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
}

/* Project Detail */
.project-detail {
  max-width: 38rem;
}

.project-detail .project-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-detail .project-links {
  margin-top: 2.5rem;
  display: flex;
  gap: 1.5rem;
}

/* ==============================================
   WRITING PAGE
   ============================================== */

.writing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.writing-item {
  padding: 1.75rem 0;
  border-top: 1px solid var(--border);
}

.writing-item:last-child {
  border-bottom: 1px solid var(--border);
}

.writing-item .post-date {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.writing-item h3 {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.writing-item h3 a {
  color: var(--text);
}

.writing-item h3 a:hover {
  color: var(--accent);
}

.writing-item .post-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Writing Post (Reading View) */
.post {
  max-width: 38rem;
}

.post-header {
  margin-bottom: 3rem;
}

.post-header .post-date {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.post-header .read-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-body {
  font-size: 1.1rem;
  line-height: 1.8;
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
}

.post-body ul,
.post-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body blockquote {
  border-left: 2px solid var(--accent);
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ==============================================
   PHOTOS PAGE — Single-column feed + lightbox
   ============================================== */

.photo-feed {
  display: flex;
  flex-direction: column;
}

.photo-story {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  align-items: center;
}

.photo-story:last-child {
  border-bottom: 1px solid var(--border);
}

.photo-story-image {
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.photo-story-image:hover {
  opacity: 0.85;
}

.photo-story-image img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-story-text h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.photo-story-text p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 0;
}

/* Photos empty state */
.photo-empty {
  padding: 4rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.is-open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  cursor: default;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
  z-index: 1001;
}

.lightbox-close:hover {
  color: #fff;
}

/* ==============================================
   PAGE HEADER
   ============================================== */

.page-header {
  margin-bottom: 3.5rem;
}

.page-header h1 {
  font-size: 2.5rem;
  letter-spacing: -0.03em;
}

.page-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 32rem;
  line-height: 1.6;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
  html { font-size: 16px; }

  body {
    padding: 0 1.5rem;
  }

  .hero-glow {
    width: 350px;
    height: 350px;
    top: -40px;
    right: -20px;
  }

  .hero {
    flex-direction: column-reverse;
    gap: 2rem;
    align-items: flex-start;
  }

  .hero-text {
    max-width: 100%;
  }

  .hero-photo img {
    width: 120px;
    height: 120px;
  }

  .hero-name {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  .curated {
    grid-template-columns: 1fr;
  }

  .curated-item {
    padding-right: 0;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .project-card {
    padding: 1.5rem 0;
  }

  .photo-story {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .site-nav {
    gap: 1.25rem;
    font-size: 0.72rem;
    padding: 2rem 0 2.5rem 0;
  }
}

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

  .photo-story-text h2 {
    font-size: 1.05rem;
  }

  .site-nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .site-nav .nav-home {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .page-header h1,
  .post-header h1 {
    font-size: 2rem;
  }
}

/* ==============================================
   PRINT
   ============================================== */

@media print {
  body { font-size: 12pt; color: #000; background: #fff; }
  .site-nav, .site-footer { display: none; }
  a { color: #000; }
}
