/* dm-mono-300 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 300;
  src: url("./assets/fonts/dm-mono-v16-latin-300.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-mono-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  src: url("./assets/fonts/dm-mono-v16-latin-regular.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-mono-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  src: url("./assets/fonts/dm-mono-v16-latin-500.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-sans-300 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 300;
  src: url("./assets/fonts/dm-sans-v17-latin-300.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-sans-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  src: url("./assets/fonts/dm-sans-v17-latin-regular.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* dm-sans-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  src: url("./assets/fonts/dm-sans-v17-latin-500.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-serif-display-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: "DM Serif Display";
  font-style: normal;
  font-weight: 400;
  src: url("./assets/fonts/dm-serif-display-v17-latin-regular.woff2")
    format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/*  Design tokens */
:root {
  --fz-sm: 1rem; /* small */
  --fz-md: 1.5rem; /* medium */
  --fz-lrg: 3rem; /* large */

  --fw-300: 300;
  --fw-400: 400;
  --fw-500: 500;
  --fw-700: 700;

  /* Dark mode styles(Default) */
  --bg: #0d0d0d;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --border: #2a2a2a;
  --muted: #555;
  --subtle: #888;
  --body: #c8c8c8;
  --heading: #f0ece4;
  --accent: #e8d5a3;
  --accent2: #7fcba4;
  --danger: #e07b6a;

  --font-serif: "DM Serif Display", Georgia, serif;
  --font-sans: "DM Sans", sans-serif;
  --font-mono: "DM Mono", monospace;

  --radius: 4px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode styles */
[data-theme="light"] {
  --bg: #faf8f4;
  --bg2: #f0ece4;
  --bg3: #e8e2d8;
  --border: #b8b0a0;
  --muted: #6e6458;
  --subtle: #3e3830;
  --body: #2a2420;
  --heading: #0f0c0a;
  --accent: #7a5a18;
  --accent2: #1a6a48;
  --danger: #a03020;
}

/* --- Resets --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  /* overflow-x: hidden; */
  /* min-height: 100svb; */
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
  object-fit: cover;
}
ul {
  list-style: none;
}
form,
button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
  /* font-family: inherit; */
  border: none;
  background: none;
}
input,
textarea {
  width: 100%; /* prevent overlowing gri whose children have min-width: auto */
  display: block; /* fill &respect with of parent */
}
/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* --- Utility --- */
.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.accent {
  color: var(--accent);
}
.accent2 {
  color: var(--accent2);
}
.muted {
  color: var(--subtle);
}
.tag {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--subtle);
  letter-spacing: 0.04em;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  transition: var(--transition);
}

/* --- Grain overlay --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.35;
}

/* --- Nav --- */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 4vw;
  border-bottom: 1px solid transparent;
  transition:
    border-color var(--transition),
    background var(--transition),
    backdrop-filter var(--transition);
}
nav.scrolled {
  border-color: var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--heading);
  letter-spacing: 0.01em;
}
.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-links a {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--transition);
}
.nav-links a:hover {
  color: var(--heading);
}

.theme-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--subtle);
  font-size: 0.9rem;
  transition: var(--transition);
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--subtle);
  transition: var(--transition);
}

/* ─── Hero ───────────────────────────────────────────────── */
#hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 4vw 6rem;
  position: relative;
  /* overflow: hidden; */
}
.hero-bg-line {
  position: absolute;
  top: 0;
  right: 4vw;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--border) 30%,
    var(--border) 70%,
    transparent
  );
  opacity: 0.4;
}
.hero-index {
  position: absolute;
  top: 50%;
  right: calc(4vw + 1.5rem);
  transform: translateY(-50%) rotate(90deg);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s 0.2s forwards;
}
.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 9vw, 8rem);
  color: var(--heading);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.35s forwards;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.5vw, 1.8rem);
  color: var(--accent);
  font-style: italic;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.5s forwards;
}
.hero-bio {
  max-width: 560px;
  font-size: 1rem;
  color: var(--subtle);
  line-height: 1.8;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.65s forwards;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.9s 0.8s forwards;
}
.btn-primary {
  padding: 0.7rem 1.8rem;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: var(--transition);
}
.btn-primary:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}
.btn-ghost {
  padding: 0.7rem 1.8rem;
  border: 1px solid var(--border);
  color: var(--body);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: var(--transition);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-socials {
  display: flex;
  gap: 1.2rem;
  margin-top: 2rem;
  opacity: 0;
  animation: fadeUp 0.9s 0.95s forwards;
}
.hero-socials a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  transition: color var(--transition);
}
.hero-socials a:hover {
  color: var(--accent2);
}
.hero-socials svg {
  width: 16px;
  height: 16px;
}

/* ─── Section base ───────────────────────────────────────── */
section {
  padding: 6rem 4vw;
  border-top: 1px solid var(--border);
}
.section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 3.5rem;
}
.section-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--heading);
  letter-spacing: -0.01em;
}
.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 1rem;
}

/* ─── About ─────────────────────────────────────────────── */
#about .about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  align-items: start;
}
#about p {
  font-size: 1.05rem;
  color: var(--body);
  line-height: 1.85;
}
.about-facts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.fact {
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
}
.fact-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.fact-value {
  font-size: 0.9rem;
  color: var(--body);
}

/* ─── Skills / Stack ─────────────────────────────────────── */
#stack .stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.stack-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  transition:
    border-color var(--transition),
    transform var(--transition);
}
.stack-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.stack-card-icon {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}
.stack-card h3 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--heading);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}
.stack-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.stack-years {
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* ─── Projects ───────────────────────────────────────────── */
#projects .projects-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.project-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.project-item:first-child {
  border-top: 1px solid var(--border);
}
.project-item:hover .project-title {
  color: var(--accent);
}
.project-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding-top: 0.3rem;
}
.project-title {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--heading);
  transition: color var(--transition);
  margin-bottom: 0.4rem;
}
.project-desc {
  font-size: 0.88rem;
  color: var(--subtle);
  line-height: 1.65;
  margin-bottom: 0.8rem;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.project-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  padding-top: 0.3rem;
}
.project-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color var(--transition);
  white-space: nowrap;
}
.project-link:hover {
  color: var(--accent2);
}

/* Expandable case study */
.project-case {
  display: none;
  grid-column: 2 / -1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 0.5rem;
}
.project-case.open {
  display: block;
}
.project-case h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}
.project-case h4:first-child {
  margin-top: 0;
}
.project-case p {
  font-size: 0.88rem;
  color: var(--subtle);
  line-height: 1.7;
}

/* ─── Services ───────────────────────────────────────────── */
#services .services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.service-card {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  transition:
    border-color var(--transition),
    transform var(--transition);
}
.service-card:hover {
  border-color: var(--accent2);
  transform: translateY(-2px);
}
.service-icon {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}
.service-card h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: 0.6rem;
}
.service-card p {
  font-size: 0.88rem;
  color: var(--subtle);
  line-height: 1.7;
}

/* ─── Contact ────────────────────────────────────────────── */
#contact {
  text-align: center;
  padding: 8rem 4vw;
}
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.contact-heading {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 4rem);
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.1;
}
.contact-sub {
  font-size: 0.95rem;
  color: var(--subtle);
  max-width: 440px;
  margin: 0 auto 2.5rem;
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.contact-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--body);
  transition: var(--transition);
}
.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.contact-link svg {
  width: 16px;
  height: 16px;
}

/* ─── Footer ─────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 4vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
footer p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  /* pointer-events: none; */
  transition: opacity 0.3s ease;
}

.hero-index {
  display: none;
}

/* ─── Mobile nav ─────────────────────────────────────────── */
@media (max-width: 768px) {
  nav {
    padding: 1rem 5vw;
  }

  .hamburger {
    display: flex;
    z-index: 101;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .hamburger span {
    position: absolute;
    transition:
      transform 0.3s ease,
      opacity 0.3s ease;
  }
  .hamburger span:nth-child(1) {
    transform: translateY(-5px);
  }
  .hamburger span:nth-child(3) {
    transform: translateY(5px);
  }
  .hamburger.open span:nth-child(1) {
    transform: rotate(45deg);
  }
  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }
  .hamburger.open span:nth-child(3) {
    transform: rotate(-45deg);
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    /* height: 100%; */
    /* overflow-y: ; */
    width: min(300px, 80vw);
    background: var(--bg2);
    border-left: 1px solid var(--border);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    padding: 5rem 2rem 3rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
  }
  .nav-links.open {
    transform: translateX(0);
  }

  .nav-overlay {
    display: block;
    pointer-events: none;
  }
  .nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links li {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child {
    border-bottom: none;
    margin-top: 2rem;
    padding-top: 1rem;
  }

  .nav-links a {
    display: block;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 400;
    color: var(--body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition:
      color var(--transition),
      padding-left var(--transition);
  }
  .nav-links a:hover {
    color: var(--accent);
    padding-left: 0.5rem;
  }

  #about .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .project-item {
    grid-template-columns: 40px 1fr;
    grid-template-columns: 1fr;
  }
  .project-links {
    flex-direction: row;
  }

  .hero-index {
    display: none;
  }
  .hero-bg-line {
    display: none;
  }
}
