@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap");

/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */
:root {
  --bg: #0b0b0a;
  --bg-raise: #131311;
  --fg: #f2f1ed;
  --fg-muted: #8d8c86;
  --border: rgba(242, 241, 237, 0.14);
  --border-strong: rgba(242, 241, 237, 0.85);
  --invert-bg: #f2f1ed;
  --invert-fg: #0b0b0a;
  --accent: #f2f1ed;
  --pad: clamp(16px, 2.4vw, 32px);
  --ease: cubic-bezier(0.16, 0.84, 0.32, 1);
  --dur-s: 0.4s;
  --dur-m: 0.7s;
  --dur-l: 1.1s;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f6f3;
  --bg-raise: #ffffff;
  --fg: #121212;
  --fg-muted: #6b6b68;
  --border: rgba(18, 18, 18, 0.14);
  --border-strong: rgba(18, 18, 18, 0.9);
  --invert-bg: #121212;
  --invert-fg: #f7f6f3;
  --accent: #121212;
  color-scheme: light;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition:
    background var(--dur-m) var(--ease),
    color var(--dur-m) var(--ease);
  overflow-x: clip;
}

body.menu-open {
  overflow: hidden;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

a:focus-visible,
button:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 3px;
}

/* Layout Utility Classes */
.container {
  padding: 0 var(--pad);
}

.hidden {
  display: none !important;
}

.shell {
  position: relative;
  width: 100%;
}

.section {
  border-top: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: 1px solid var(--border);
}

.section-head {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  border-bottom: 1px solid var(--border);
}

.section-head__index {
  grid-column: span 2;
  padding: 14px var(--pad);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-right: 1px solid var(--border);
}

.section-head__title {
  grid-column: span 10;
  padding: 14px var(--pad);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
}

@media (max-width: 720px) {
  .section-head__index {
    grid-column: span 4;
  }
  .section-head__title {
    grid-column: span 8;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Preloader Component
   ========================================================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

.preloader__content {
  width: min(320px, 80vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.preloader__counter {
  font-size: 36px;
  font-weight: 700;
}

.preloader__bar {
  width: 100%;
  height: 2px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.preloader__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--fg);
  transition: width 0.1s linear;
}

.preloader__text {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
}

.nav__menu {
  display: flex;
}

.nav__logo {
  padding: 16px var(--pad);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0;
  border-left: 1px solid var(--border);
}

.nav__links a {
  padding: 16px 20px;
  font-size: 13px;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.nav__links a::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--fg);
  z-index: 0;
  transition: height var(--dur-s) var(--ease);
}

.nav__links a > * {
  position: relative;
  z-index: 1;
  transition: color var(--dur-s) var(--ease);
}

.nav__links span {
  color: var(--fg-muted);
  padding-right: 10px;
  font-family: "JetBrains Mono", monospace;
}

.nav__links p {
  color: var(--fg);
}

.nav__links a:hover p {
  color: var(--bg);
}

.nav__links a:hover::before {
  height: 100%;
}

.nav__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.theme-toggle {
  padding: 16px var(--pad);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  height: 100%;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: inline-flex;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: inline-flex;
}
:root[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

/* Mobile Trigger Button */
.menu-btn {
  display: none;
  padding: 0;
}

.menu-btn__trigger {
  position: relative;
  width: 53px;
  height: 53px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

.menu-btn__trigger svg {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.menu-btn__trigger .icon-close {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.5);
}

/* Mobile Menu Container */
.mobile-menu {
  position: fixed;
  inset: 0;
  top: 53px;
  z-index: 55;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  visibility: hidden;
  opacity: 0;
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: background var(--dur-m) var(--ease);
}

.mobile-menu__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  padding: var(--pad);
}

.mobile-menu__links {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 40px;
}

.mobile-menu__links a {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 600;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu__links span {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  color: var(--fg-muted);
}

.mobile-menu__actions {
  display: flex;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

@media (max-width: 860px) {
  .nav__menu {
    display: none;
  }
  .menu-btn {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border);
  }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: 53px;
  overflow: hidden;
}

.hero__media {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

.hero__media img {
  /* width: 100%; */
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(0.75);
  transform: scale(1.08);
}

.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--bg) 8%, transparent) 0%,
    color-mix(in srgb, var(--bg) 22%, transparent) 45%,
    var(--bg) 92%
  );
}

:root[data-theme="light"] .hero__media img {
  filter: grayscale(1) contrast(1.25);
}

.hero__inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--pad) 18px;
}

.hero__eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(12px, 1.4vw, 15px);
  line-height: 1.9;
  color: var(--fg);
  margin-bottom: clamp(18px, 3vw, 34px);
}

.hero__eyebrow .line {
  display: block;
  overflow: hidden;
}

.hero__eyebrow .line span {
  display: inline-block;
}

.hero__name {
  font-size: clamp(48px, 11vw, 168px);
  line-height: 0.88;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow: hidden;
}

.hero__name .word {
  display: block;
  overflow: hidden;
}

.hero__name .word span {
  display: inline-block;
  will-change: transform;
}

.hero__bottom {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  border-top: 1px solid var(--border);
}

.hero__tz,
.hero__scroll {
  grid-column: span 6;
  padding: 14px var(--pad);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero__tz {
  border-right: 1px solid var(--border);
}

.hero__scroll {
  justify-content: space-between;
}

.hero__scroll-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.about__text {
  grid-column: span 7;
  padding: clamp(40px, 6vw, 88px) var(--pad);
  border-right: 1px solid var(--border);
}

.about__text p {
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 46ch;
}

.about__text p + p {
  margin-top: 1.2em;
  color: var(--fg-muted);
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.7;
  max-width: 42ch;
}

.about__meta {
  grid-column: span 5;
  display: flex;
  flex-direction: column;
}

.about__meta-row {
  padding: 18px var(--pad);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

.about__meta-row:last-child {
  border-bottom: none;
}

.about__meta-row .label {
  font-family: "JetBrains Mono", monospace;
  color: var(--fg-muted);
}

.about__meta-row .value {
  text-align: right;
}

@media (max-width: 860px) {
  .about__text,
  .about__meta {
    grid-column: span 12;
    border-right: none;
  }
  .about__text {
    border-bottom: 1px solid var(--border);
  }
}

/* Tech Stack Grid */
.stack {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}

.stack__item {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 22px var(--pad);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(13px, 1.6vw, 16px);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
  will-change: transform;
  transition:
    background var(--dur-s) var(--ease),
    color var(--dur-s) var(--ease);
  position: relative;
}

.stack__item:hover {
  background: var(--fg);
  color: var(--bg);
}

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

/* ==========================================================================
   Contact
   ========================================================================== */

.contact {
  display: flex;
}
.contact__main {
  width: 60vw;
  padding: clamp(60px, 10vw, 140px) var(--pad);
  border-right: 1px solid var(--border);
}
.contact__eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.contact__title {
  font-size: clamp(30px, 5.4vw, 76px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.contact__email {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: clamp(28px, 4vw, 52px);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(16px, 2.4vw, 26px);
  padding-bottom: 6px;
  position: relative;
}

.contact__email p {
  border-bottom: 1px solid var(--border-strong);
}
.contact__email svg {
  width: 18px;
  height: 18px;
}

.contact__side {
  width: 40vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.contact__side a {
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.contact__side a:last-child {
  border-bottom: none;
}
.contact__side a {
  transition:
    background var(--dur-s) var(--ease),
    color var(--dur-s) var(--ease);
}
.contact__side a:hover {
  background: var(--fg);
  color: var(--bg);
}

@media (max-width: 860px) {
  .contact {
    flex-direction: column;
  }
  .contact__main,
  .contact__side {
    border-right: none;
    width: 100%;
  }
  .contact__main {
    border-bottom: 1px solid var(--border);
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}
.footer__brand {
  grid-column: span 6;
  padding: 22px var(--pad);
  border-right: 1px solid var(--border);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--fg-muted);
}
.footer__totop {
  grid-column: span 6;
  padding: 22px var(--pad);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}
@media (max-width: 720px) {
  .footer__brand,
  .footer__totop {
    grid-column: span 12;
  }
  .footer__brand {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
