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

:root {
  --bg:           #ffffff;
  --surface:      #f8f9fa;
  --surface2:     #eef0f3;
  --border:       #e2e6ea;

  --mint:         #2dbf8a;
  --mint-hover:   #26a87a;
  --mint-soft:    #e6f9f2;
  --orange:       #f97316;
  --orange-hover: #e8650a;
  --orange-soft:  #fff2e8;

  --text:         #1a1a2e;
  --text-muted:   #6b7280;

  --radius:       12px;
  --nav-h:        60px;
  --transition:   0.22s ease;
  --shadow:       0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  width: 92%;
  max-width: 1200px;
  margin: 0 auto;
}

.section { padding: 72px 0; }
.section-tight { padding: 32px 0 72px; }

.section-title {
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  font-weight: 700;
  margin-bottom: 36px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--mint);
  border-radius: 2px;
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  width: 92%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 24px;
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--mint);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.main-nav { margin-left: auto; }

.main-nav > ul {
  display: flex;
  align-items: center;
  gap: 2px;
}

.main-nav a {
  display: block;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.main-nav a.active {
  color: var(--mint);
  background: var(--mint-soft);
}

/* mobile toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 6px;
}

/* ============================================================
   HOME SECTION BAR
   ============================================================ */
.home-section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 40px 0 20px;
  margin-bottom: 12px;
}

.home-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.home-section-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mint);
  transition: color var(--transition);
}

.home-section-link:hover { color: var(--mint-hover); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 28px;
  margin-bottom: 8px;
}

.filter-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--mint);
  color: var(--mint);
}

.filter-btn.active {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

/* ============================================================
   PAGE HERO (inner pages)
   ============================================================ */
.page-hero {
  padding: 56px 0 44px;
}

.page-hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.page-hero h1 .accent-mint  { color: var(--mint); }
.page-hero h1 .accent-orange { color: var(--orange); }

.page-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 480px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  padding: 10px 22px;
  background: var(--mint);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:hover {
  background: var(--mint-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(45,191,138,0.3);
}

.btn-orange {
  background: var(--orange);
}

.btn-orange:hover {
  background: var(--orange-hover);
  box-shadow: 0 4px 16px rgba(249,115,22,0.3);
}

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

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

/* ============================================================
   CARDS
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
}

.card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--mint);
}

.card-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-thumb img { transform: scale(1.04); }

.card-body { padding: 18px 20px 20px; }

.card-category {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 7px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 7px;
  line-height: 1.3;
  color: var(--text);
}

.card-desc {
  font-size: 0.845rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.tag {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}


/* ============================================================
   PUBLICATION LIST
   ============================================================ */
.pub-list { display: flex; flex-direction: column; gap: 0; }

.pub-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

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

.pub-year {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-top: 3px;
}

.pub-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}

.pub-meta {
  font-size: 0.845rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

.pub-links { display: flex; gap: 8px; flex-wrap: wrap; }

.pub-link {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1.5px solid var(--mint);
  color: var(--mint);
  transition: background var(--transition), color var(--transition);
}

.pub-link:hover { background: var(--mint); color: #fff; }

.pub-link.orange {
  border-color: var(--orange);
  color: var(--orange);
}

.pub-link.orange:hover { background: var(--orange); color: #fff; }

/* ============================================================
   CODING LIST
   ============================================================ */
.code-list { display: flex; flex-direction: column; gap: 0; }

.code-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

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

.code-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.code-dash { color: var(--border); flex-shrink: 0; }

.code-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 180px;
}

.code-links { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* ============================================================
   GALLERY GRID
   ============================================================ */
.gallery-filter { margin-bottom: 32px; }

.gallery-grid {
  columns: 3 280px;
  column-gap: 16px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
}

.gallery-item:hover img { transform: scale(1.03); }

.gallery-caption {
  padding: 10px 14px 12px;
  background: var(--bg);
}

.gallery-caption-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.gallery-caption-cat {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}

.about-photo {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--surface2);
  border: 1.5px solid var(--border);
}

.about-photo img { width: 100%; height: 100%; object-fit: cover; }

.about-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.8;
  font-size: 0.95rem;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.skill-badge {
  padding: 5px 13px;
  border-radius: 20px;
  background: var(--mint-soft);
  border: 1.5px solid rgba(45,191,138,0.25);
  color: var(--mint-hover);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.83rem;
}

/* ============================================================
   TABS (Notes page)
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 36px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--mint);
  border-bottom-color: var(--mint);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Dev log entries */
.devlog-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

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

.devlog-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 3px;
  white-space: nowrap;
}

.devlog-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.devlog-title a {
  color: inherit;
  transition: color var(--transition);
}

.devlog-title a:hover { color: var(--mint); }

.devlog-desc {
  font-size: 0.845rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .devlog-item { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   INDIVIDUAL PROJECT PAGE
   ============================================================ */
.project-back {
  padding: 24px 0 0;
}

.project-back a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}

.project-back a:hover { color: var(--mint); }

.project-hero-img {
  margin: 28px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  aspect-ratio: 16/7;
  background: var(--surface2);
}

.project-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-header {
  max-width: 760px;
  margin-bottom: 48px;
}

.project-header .card-category {
  font-size: 0.75rem;
  margin-bottom: 10px;
}

.project-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.project-meta {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.project-meta span::before {
  content: '';
}

.project-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 20px;
}

.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Prose body */
.project-body {
  max-width: 760px;
}

.project-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}

.project-body p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 16px;
}

.project-body ul, .project-body ol {
  padding-left: 20px;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 16px;
}

.project-body li { margin-bottom: 6px; }

/* Figures */
.project-figure {
  margin: 28px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.project-figure img {
  width: 100%;
  display: block;
  background: var(--surface2);
}

.project-figure figcaption {
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* Two-column image grid */
.project-img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.project-img-grid .project-figure { margin: 0; }

/* Full-bleed image (wider than body) */
.project-figure-wide {
  max-width: 960px;
  margin: 28px 0;
}

@media (max-width: 600px) {
  .project-img-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--mint); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .main-nav {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 10px 0 16px;
  }

  .main-nav.open { display: block; }

  .main-nav > ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .main-nav a { padding: 10px 24px; border-radius: 0; font-size: 0.92rem; }

  .nav-toggle { display: block; }

  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 180px; }

  .page-intro-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .page-intro p { margin-left: 0; }

  .gallery-grid { columns: 2 200px; }
}

@media (max-width: 480px) {
  .gallery-grid { columns: 1; }
  .pub-item { grid-template-columns: 40px 1fr; gap: 0 12px; }
  .code-item { flex-direction: column; gap: 6px; }
  .code-links { margin-left: 0; }
}
