*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 var(--gutter); }

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

/* ---- Nav ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 24px 0;
  mix-blend-mode: difference;
}
.nav .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav__logo {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.nav__links {
  display: flex;
  gap: 32px;
  list-style: none;
}
.nav__links a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #fff;
  opacity: 0.6;
  transition: opacity 0.3s;
}
.nav__links a:hover { opacity: 1; }

/* ---- Hero ---- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 0 80px;
  position: relative;
}
.hero h1 {
  font-size: clamp(56px, 8vw, 120px);
  color: var(--fg);
  line-height: 0.95;
  margin-bottom: 32px;
}
.hero h1 span {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(16px, 2vw, 22px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 16px;
  line-height: 1.4;
}
.hero__line {
  width: 60px;
  height: 1px;
  background: var(--mute);
  margin-bottom: 24px;
}
.hero__sub {
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--mute);
  max-width: 480px;
  line-height: 1.6;
}

/* ---- Project sections ---- */
.project {
  position: relative;
  padding: 160px 0;
  overflow: hidden;
}
.project__header {
  margin-bottom: 64px;
}
.project__tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 20px;
}
.project__name {
  font-size: clamp(40px, 5vw, 72px);
  margin-bottom: 16px;
}
.project__desc {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--mute);
  max-width: 540px;
  line-height: 1.65;
}
.project__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--fg);
  border-bottom: 1px solid var(--mute);
  padding-bottom: 4px;
  transition: border-color 0.3s, gap 0.3s;
}
.project__link:hover {
  border-color: var(--fg);
  gap: 14px;
}
.project__link svg {
  width: 14px;
  height: 14px;
}

/* ---- Device frames ---- */
.devices {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
  margin-top: 64px;
}
.device-desktop {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  position: relative;
}
.device-desktop::before {
  content: '';
  display: block;
  height: 36px;
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background-image: radial-gradient(circle at 20px 50%, #ff5f57 5px, transparent 5px),
                     radial-gradient(circle at 36px 50%, #febc2e 5px, transparent 5px),
                     radial-gradient(circle at 52px 50%, #28c840 5px, transparent 5px);
  background-size: 100% 100%;
}
.device-desktop img {
  width: 100%;
  display: block;
}
.device-mobile {
  width: 280px;
  border-radius: 32px;
  overflow: hidden;
  border: 8px solid #1a1a1a;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  position: relative;
  align-self: start;
}
.device-mobile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 24px;
  background: #1a1a1a;
  border-radius: 0 0 16px 16px;
  z-index: 2;
}
.device-mobile img {
  width: 100%;
  display: block;
}

/* ---- Project themes ---- */
.project--ayvan { background: #100E0C; color: #F2EADB; --mute: #8a7f6e; }
.project--detailing { background: #0c0d10; color: #e8e6e3; --mute: #8b919c; }
.project--veselova { background: #f2efeb; color: #1c1c1c; --mute: #5a5652; }
.project--veselova .device-desktop::before { background: #e8e4de; background-image: radial-gradient(circle at 20px 50%, #ff5f57 5px, transparent 5px), radial-gradient(circle at 36px 50%, #febc2e 5px, transparent 5px), radial-gradient(circle at 52px 50%, #28c840 5px, transparent 5px); border-color: rgba(0,0,0,0.08); }
.project--veselova .device-desktop { box-shadow: 0 24px 80px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.08); }
.project--veselova .device-mobile { border-color: #d0cdc8; box-shadow: 0 24px 80px rgba(0,0,0,0.1); }

/* ---- Contact ---- */
.contact {
  padding: 200px 0 120px;
  text-align: center;
}
.contact h2 {
  font-size: clamp(40px, 5vw, 72px);
  margin-bottom: 24px;
}
.contact__sub {
  color: var(--mute);
  font-size: 18px;
  margin-bottom: 56px;
}
.contact__buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 36px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--fg);
  background: transparent;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s;
}
.btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---- Footer ---- */
.site-footer {
  padding: 40px 0;
  text-align: center;
  font-size: 13px;
  color: var(--mute);
}

/* ---- Reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero h1 { font-size: 44px; }
  .project { padding: 100px 0; }
  .project__name { font-size: 36px; }
  .devices {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .device-mobile {
    width: 200px;
    border-radius: 24px;
    border-width: 6px;
    justify-self: center;
  }
  .nav__links { gap: 16px; }
  .nav__links a { font-size: 13px; }
  .contact { padding: 100px 0 60px; }
  .contact__buttons { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  body { transition: none; }
}
