/* --------------------------------- */
/* ----- Base & Reset -----          */
/* --------------------------------- */

@font-face {
  font-family: "Mona Sans";
  src: url("assets/fonts/Mona-Sans.woff2") format("woff2 supports variations"),
    url("assets/fonts/Mona-Sans.woff2") format("woff2-variations");
  font-display: swap;
  font-weight: 200 900;
  font-stretch: 75% 125%;
}

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

html {
  font-family: "Mona Sans", sans-serif;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

textarea {
  resize: vertical;
}

input,
textarea,
button {
  font: inherit;
}

/* --------------------------------- */
/* ----- Theme Variables -----       */
/* --------------------------------- */

body.dark {
  --bg:          #0d1117;
  --bg-card:     #161b22;
  --bg-hover:    #1c2128;
  --border:      #30363d;
  --text:        #8b949e;
  --heading:     #e6edf3;
  --accent:      #38bdf8;
  --accent-dim:  rgba(56, 189, 248, 0.12);
  --btn-text:    #0d1117;
  --shadow:      0 8px 32px rgba(0, 0, 0, 0.5);
}

body.light {
  --bg:          #ffffff;
  --bg-card:     #f6f8fa;
  --bg-hover:    #eaeef2;
  --border:      #d0d7de;
  --text:        #57606a;
  --heading:     #24292f;
  --accent:      #0969da;
  --accent-dim:  rgba(9, 105, 218, 0.08);
  --btn-text:    #ffffff;
  --shadow:      0 8px 32px rgba(0, 0, 0, 0.1);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

/* --------------------------------- */
/* ----- Site Header / Nav -----     */
/* --------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 800;
  font-stretch: 125%;
  color: var(--heading);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  list-style: none;
}

.nav-link {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--heading);
  background: var(--bg-hover);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Theme button */
.theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  line-height: 1;
}

.theme-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.theme-btn .sun-icon { display: none; }
.theme-btn .moon-icon { display: inline; }
body.light .theme-btn .sun-icon { display: inline; }
body.light .theme-btn .moon-icon { display: none; }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--heading);
  border-radius: 2px;
  transition: 0.3s;
}

.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    gap: 0;
  }

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

  .nav-link {
    padding: 0.75rem 0.5rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
  }

  .nav-link:last-child { border-bottom: none; }

  .menu-toggle { display: flex; }
}

/* --------------------------------- */
/* ----- Shared Layout -----         */
/* --------------------------------- */

section {
  padding: 5rem 0;
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 800;
  font-stretch: 125%;
  color: var(--heading);
  line-height: 1.2;
  margin-bottom: 0.875rem;
  letter-spacing: -0.03em;
}

.section-title.centered { text-align: center; }

.section-subtitle {
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  max-width: 580px;
  margin: 0 auto 3.5rem;
  line-height: 1.7;
}

/* --------------------------------- */
/* ----- Buttons -----               */
/* --------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  font-stretch: 115%;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-dim);
}

.btn-outline {
  background: transparent;
  color: var(--heading);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--heading);
  background: var(--bg-card);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.825rem;
}

/* --------------------------------- */
/* ----- Hero Section -----          */
/* --------------------------------- */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 80%);
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.875rem;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-title {
  font-size: clamp(2.2rem, 6.5vw, 4.25rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1.12;
  color: var(--heading);
  margin-bottom: 1.5rem;
  letter-spacing: -0.04em;
}

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

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.175rem);
  color: var(--text);
  max-width: 660px;
  line-height: 1.75;
  margin-bottom: 2.25rem;
}

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

.tech-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* --------------------------------- */
/* ----- About Section -----         */
/* --------------------------------- */

.about {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.about-desc {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.about-stats-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.2s, transform 0.25s;
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 0.375rem;
}

.stat-heading {
  font-size: 0.9rem;
  font-weight: 800;
  font-stretch: 125%;
  color: var(--heading);
}

.stat-detail {
  font-size: 0.75rem;
  color: var(--text);
  font-family: "Courier New", monospace;
  letter-spacing: 0.02em;
}

/* --------------------------------- */
/* ----- Work / Projects -----       */
/* --------------------------------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

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

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

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.project-img {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

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

.project-card:hover .project-img img {
  transform: scale(1.05);
}

.project-body {
  padding: 1.375rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
}

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 800;
  font-stretch: 125%;
  color: var(--heading);
  margin-bottom: 0.625rem;
  letter-spacing: -0.02em;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.25rem;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-top: auto;
}

.icon-link {
  display: flex;
  align-items: center;
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s;
}

.icon-link:hover {
  opacity: 1;
  transform: scale(1.12);
}

.icon-link img {
  width: 22px;
  height: 22px;
}

body.dark .icon-link img {
  filter: invert(1);
}

/* --------------------------------- */
/* ----- Articles Section -----      */
/* --------------------------------- */

.articles {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.articles-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
}

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

.article-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.25s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.article-img {
  display: block;
  aspect-ratio: 16 / 7;
  overflow: hidden;
}

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

.article-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-tag {
  font-size: 0.72rem;
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.625rem;
}

.article-title {
  font-size: 1.05rem;
  font-weight: 700;
  font-stretch: 125%;
  color: var(--heading);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.article-text {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 1.375rem;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
}

.reaction-count {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.82rem;
  color: var(--text);
}

.reaction-count img {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

/* --------------------------------- */
/* ----- Skills Section -----        */
/* --------------------------------- */

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-top: 0.5rem;
}

.skill-icon {
  width: 76px;
  height: 76px;
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: grayscale(25%) opacity(0.85);
}

.skill-icon:hover {
  transform: translateY(-5px) scale(1.1);
  filter: grayscale(0%) opacity(1);
}

@media (max-width: 640px) {
  .skill-icon { width: 60px; height: 60px; }
  .skills-grid { gap: 1.5rem; }
}

/* --------------------------------- */
/* ----- Contact Section -----       */
/* --------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
}

@media (max-width: 800px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }
}

.hire-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.875rem;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.contact-desc {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0 1.75rem;
}

.contact-social {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.contact-social:hover { color: var(--accent); }

.contact-social img {
  width: 18px;
  height: 18px;
}

body.dark .contact-social img { filter: invert(1); }

.signature {
  width: 130px;
  opacity: 0.75;
  margin-top: 0.5rem;
}

body.light .signature { filter: invert(1); }

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-group label {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: var(--heading);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea {
  min-height: 130px;
}

/* --------------------------------- */
/* ----- Footer -----                */
/* --------------------------------- */

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

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-social {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.footer-social a {
  display: flex;
  align-items: center;
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s;
}

.footer-social a:hover {
  opacity: 1;
  transform: scale(1.1);
}

.footer-social img {
  width: 22px;
  height: 22px;
}

body.dark .footer-social img { filter: invert(1); }

.footer-copy {
  font-size: 0.825rem;
  color: var(--text);
}

/* Footer theme switch */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.825rem;
  color: var(--text);
  user-select: none;
}

.theme-switch input {
  -webkit-appearance: none;
  appearance: none;
  width: 38px;
  height: 20px;
  background: var(--border);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}

.theme-switch input::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.3s cubic-bezier(0.45, 0.05, 0.22, 1.3);
}

.theme-switch input:checked {
  background: var(--accent);
}

.theme-switch input:checked::after {
  transform: translateX(18px);
}

@media (max-width: 600px) {
  .footer-container {
    flex-direction: column;
    text-align: center;
  }
  .footer-social { justify-content: center; }
}
