html {
  scrollbar-gutter: stable;
}
/* =======================================================
   THEME VARIABLES
======================================================= */

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --text: #2f2f2f;
  --muted: #6b6b6b;
  --accent: #4f6f52;
  --border: #e6e1d9;
}

[data-theme="dark"] {
  --bg: #121212;
  --surface: #1a1a1a;
  --text: #eaeaea;
  --muted: #9a9a9a;
  --accent: #6fa87c;
  --border: #2a2a2a;
}

/* =======================================================
   GLOBAL RESET & BASE
======================================================= */

* {
  box-sizing: border-box;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 18px;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =======================================================
   LAYOUT STRUCTURE
======================================================= */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  animation: fadeIn 0.4s ease;
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.logo {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

/* =======================================================
   NAVIGATION
======================================================= */

.site-header nav a {
  position: relative;
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  margin-left: 1.8rem;
  line-height: 1;
}

/* Thin underline animation */
.site-header nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

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

.site-header nav a:hover::after {
  width: 100%;
}

.site-header nav a.active {
  color: var(--text);
}

.site-header nav a.active::after {
  width: 100%;
}

/* =======================================================
   TYPOGRAPHY
======================================================= */

h1 {
  font-family: "Fraunces", serif;
  font-size: 2.6rem;
  font-weight: 600;
}

h2 {
  font-family: "Fraunces", serif;
  font-size: 1.6rem;
}

h3 {
  font-size: 1.1rem;
}

/* =======================================================
   LINKS
======================================================= */

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

/* ---------- Content links (paragraph links only) ---------- */

main p a,
main li a {
  position: relative;
}

main p a::after,
main li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 1px;
  width: 0;
  background: currentColor;
  transition: width 0.2s ease;
}

main p a:hover::after,
main li a:hover::after {
  width: 100%;
}
/* =======================================================
   FOOTER
======================================================= */

.site-footer {
  margin-top: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* =======================================================
   THEME TOGGLE (Sun / Moon Switch)
======================================================= */

.theme-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.theme-switch:hover {
  opacity: 1;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: var(--border);
  border-radius: 40px;
  transition: 0.25s ease;

  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 12px;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: var(--surface);
  border-radius: 50%;
  transition: 0.25s ease;
  z-index: 2;
}

/* Icons inside slider */
.icon {
  z-index: 1;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.sun {
  color: var(--text);
}

.moon {
  color: var(--text);
}

/* Dark mode active */
.theme-switch input:checked + .slider::before {
  transform: translateX(24px);
}

.theme-switch input:checked + .slider .moon {
  opacity: 1;
}

.theme-switch input:not(:checked) + .slider .sun {
  opacity: 1;
}

/* =======================================================
   ANIMATIONS
======================================================= */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ===============================
   RECENT POSTS SECTION
================================ */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.post-item {
  display: block;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.post-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.post-date {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-title {
  margin: 0.5rem 0 0.5rem 0;
  font-size: 1.3rem;
  font-family: "Fraunces", serif;
  color: var(--text);
}

.post-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
/* ===============================
   BLOG ARCHIVE
================================ */

.blog-archive {
  margin-top: 2rem;
}

.archive-year {
  margin-top: 3rem;
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.archive-group {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.4rem 0;
}

.archive-date {
  font-size: 0.85rem;
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
}

.archive-title {
  text-decoration: none;
  color: var(--text);
  position: relative;
}

/* ======================================
   CENTER-OUT UNDERLINE (Archive Links)
====================================== */

.archive-title {
  position: relative;
}

.archive-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.archive-title:hover::after {
  width: 100%;
}
/* ===============================
   MOBILE RESPONSIVE
================================ */

@media (max-width: 768px) {

  /* Reduce global padding */
  .container {
    padding: 2rem 1.2rem;
  }

  /* Header layout stack */
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  nav a {
    margin-left: 0;
    font-size: 0.95rem;
  }

  /* Reduce heading sizes */
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  /* Recent post cards smaller padding */
  .post-item {
    padding: 1.2rem;
  }

  .post-title {
    font-size: 1.1rem;
  }

  /* Archive layout stack */
  .archive-item {
    flex-direction: column;
    gap: 0.3rem;
  }

  .archive-date {
    width: auto;
  }

  /* Footer spacing smaller */
  .site-footer {
    font-size: 0.8rem;
  }

}
/* ===============================
   NAVIGATION
================================ */

.nav {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
}

/* Hamburger hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: 0.2s ease;
}

/* ===============================
   MOBILE
================================ */

@media (max-width: 768px) {

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 72px;
    right: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    flex-direction: column;
    gap: 1rem;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  }

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

  nav a {
    margin-left: 0;
  }
}
/* =============================
   PROJECT LAYOUT
============================= */
/* ======================================
   PROJECT HEADER ACCENT
====================================== */

.project-content h1,
.project-content h2,
.project-content h3 {
  color: var(--accent);
}

.project-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  margin-top: 2rem;
  width: 100%;
}

.project-sidebar {
  width: 240px;
  position: sticky;
  top: 120px;
  align-self: start;
}

.project-sidebar ul {
  list-style: none;
  padding: 0;
}

.project-sidebar li {
  margin-bottom: 0.6rem;
}

.project-sidebar a {
  position: relative;
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-sidebar a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

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

.project-sidebar a:hover::after {
  width: 100%;
}

.project-content {
  min-width: 0;
  width: 100%;
}

/* Mobile */
@media (max-width: 900px) {
  .project-layout {
    grid-template-columns: 1fr;
  }

  .project-sidebar {
    position: relative;
    top: auto;
    margin-bottom: 2rem;
  }
}
/* Active project sidebar link */
.project-sidebar a.active {
  color: var(--text);
}

.project-sidebar a.active::after {
  width: 100%;
}
/* =============================
   PROJECT ARCHIVE
============================= */

.project-archive {
  margin-top: 3rem;
}

.archive-year {
  margin-top: 3rem;
  font-size: 1.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.archive-item {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  align-items: flex-start;
}

.archive-date {
  width: 90px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.archive-content {
  max-width: 700px;
}

.archive-title {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
}
.archive-description {
  margin-top: 0.4rem;
  color: var(--muted);
  line-height: 1.6;
}
