/* ============================================================
   Anish Guntreddi — iOS Portfolio
   Aesthetic: warm-charcoal editorial-technical.
   Fraunces (display serif) · Hanken Grotesk (body) · JetBrains Mono (meta)
   ============================================================ */

:root {
  --bg:        #0E0D0B;
  --bg-2:      #141210;
  --panel:     #1A1713;
  --panel-2:   #221E18;
  --ink:       #F4EDE1;
  --ink-soft:  #BEB4A2;
  --ink-faint: #837A6B;
  --line:      rgba(244, 237, 225, 0.11);
  --line-2:    rgba(244, 237, 225, 0.055);
  --gold:      #E9A93C;
  --gold-deep: #C98A26;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --maxw: 1240px;
  --pad: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

::selection { background: var(--gold); color: #1a1206; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.05; letter-spacing: -0.01em; }

.serif-italic { font-style: italic; font-weight: 400; }
.accent { color: var(--gold); }

/* ---- Atmosphere: grain + radial warmth ---- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 80% -10%, rgba(233, 169, 60, 0.10), transparent 60%),
    radial-gradient(90% 60% at -10% 20%, rgba(76, 155, 214, 0.06), transparent 55%);
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > *:not(.grain):not(.scroll-progress) { position: relative; z-index: 2; }

/* ---- Scroll progress ---- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  z-index: 100; transition: width 0.1s linear;
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 18px var(--pad);
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), border-color 0.4s var(--ease), padding 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: rgba(14, 13, 11, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line-2);
  padding-top: 13px; padding-bottom: 13px;
}
.nav__brand { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-weight: 600; }
.nav__mark { font-size: 16px; letter-spacing: 0.04em; }
.nav__mark-sub { font-size: 13px; color: var(--gold); }
.nav__links { display: flex; gap: 30px; }
.nav__links a {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em;
  color: var(--ink-soft); position: relative; padding: 4px 0;
  transition: color 0.25s var(--ease);
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 0;
  background: var(--gold); transition: width 0.3s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }
.nav__cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}
.nav__cta:hover { border-color: var(--gold); background: rgba(233, 169, 60, 0.08); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(130px, 19vh, 200px) var(--pad) 40px;
}
.hero__grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
}
.eyebrow__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.hero__title {
  font-size: clamp(42px, 7.4vw, 92px); margin: 22px 0 26px; letter-spacing: -0.025em;
}
.hero__title span { display: block; }
.hero__lede {
  font-size: clamp(16.5px, 1.4vw, 19px); color: var(--ink-soft); max-width: 33ch; line-height: 1.62;
}
.hero__nope {
  display: inline-block; margin-top: 4px; color: var(--ink); font-weight: 600;
  font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.01em;
  border-bottom: 2px solid var(--gold);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-family: var(--mono); font-size: 14px; font-weight: 500;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn svg { transition: transform 0.25s var(--ease); }
.btn--solid { background: var(--gold); color: #1a1206; }
.btn--solid:hover { background: #f4b54a; transform: translateY(-2px); }
.btn--solid:hover svg { transform: translateX(3px); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-soft); background: rgba(244, 237, 225, 0.04); transform: translateY(-2px); }

/* Hero phone stage */
.hero__stage { position: relative; height: clamp(380px, 52vw, 560px); }
.phone--hero {
  position: absolute; width: clamp(150px, 17vw, 210px);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.75), 0 8px 22px -10px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
.phone--back  { top: 2%;  right: 36%; transform: rotate(-9deg)  scale(0.9); opacity: 0.85; z-index: 1; filter: saturate(0.95) brightness(0.92); }
.phone--mid   { top: 24%; right: 4%;  transform: rotate(6deg);              z-index: 2; }
.phone--front { top: 40%; left: 2%;   transform: rotate(-3deg) scale(1.06); z-index: 3; }

/* Ticker */
.ticker {
  margin-top: clamp(40px, 7vw, 80px);
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  padding: 16px 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker__track {
  display: inline-flex; align-items: center; gap: 26px; white-space: nowrap;
  font-family: var(--mono); font-size: 14px; color: var(--ink-soft); letter-spacing: 0.02em;
  animation: ticker 42s linear infinite;
}
.ticker__track span { transition: color 0.25s var(--ease); }
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__track i { color: var(--gold); font-style: normal; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ============================================================
   STATS
   ============================================================ */
.stats {
  max-width: var(--maxw); margin: 0 auto; padding: 30px var(--pad);
}
.stats__row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 38px 0;
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat__num {
  font-family: var(--serif); font-size: clamp(36px, 5vw, 60px); font-weight: 500;
  line-height: 1; letter-spacing: -0.02em; color: var(--ink);
}
.stat__num.is-zero { color: var(--gold); }
.stat__label {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============================================================
   SECTION HEADS
   ============================================================ */
.section-head { max-width: var(--maxw); margin: 0 auto; padding: clamp(80px, 13vw, 150px) var(--pad) clamp(40px, 6vw, 70px); }
.section-title { font-size: clamp(34px, 5.4vw, 70px); margin: 20px 0 22px; letter-spacing: -0.02em; }
.section-sub { font-size: clamp(16px, 1.3vw, 19px); color: var(--ink-soft); max-width: 56ch; }

/* ============================================================
   PROJECTS
   ============================================================ */
.apps { padding-bottom: 40px; }
.project {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 0.92fr 1.08fr; gap: clamp(30px, 5vw, 70px);
  align-items: center;
  padding: clamp(54px, 8vw, 96px) var(--pad);
  border-top: 1px solid var(--line-2);
}
.project--reverse .project__info { order: 2; }
.project--reverse .project__gallery { order: 1; }

.project__head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.project__index {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding: 4px 9px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.project__icon {
  width: 46px; height: 46px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.project__icon svg { width: 24px; height: 24px; }
.project__name { font-size: clamp(32px, 4vw, 50px); margin-bottom: 8px; }
.project__tag {
  font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.02em;
  color: var(--accent); margin-bottom: 18px;
}
.project__blurb { color: var(--ink-soft); font-size: 17px; line-height: 1.62; margin-bottom: 22px; max-width: 46ch; }
.project__feats { list-style: none; display: flex; flex-direction: column; gap: 11px; margin-bottom: 24px; }
.project__feats li {
  position: relative; padding-left: 24px; color: var(--ink); font-size: 15.5px; line-height: 1.5;
}
.project__feats li::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 11px; height: 11px;
  border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chips span {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(244, 237, 225, 0.02);
}
.project__foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.testpill {
  font-family: var(--mono); font-size: 12px; color: var(--ink); letter-spacing: 0.02em;
  padding: 7px 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.repo-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}
.repo-link svg { transition: transform 0.25s var(--ease); }
.repo-link:hover { color: var(--accent); }
.repo-link:hover svg { transform: translate(2px, -2px); }

/* Gallery rail */
.project__gallery {
  display: flex; gap: 20px; overflow-x: auto; padding: 16px 4px 22px; cursor: grab;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 90%, transparent);
}
.project__gallery::-webkit-scrollbar { display: none; }
.project__gallery.is-grabbing { cursor: grabbing; scroll-snap-type: none; }
.project__gallery .phone { flex: none; width: clamp(190px, 22vw, 244px); scroll-snap-align: center; }

/* ============================================================
   DEVICE FRAME (custom component)
   ============================================================ */
.phone {
  aspect-ratio: 1206 / 2622;
  border-radius: 13% / 6%;
  padding: 2.1%;
  background:
    linear-gradient(150deg, #2a2620, #100e0b 55%, #050403);
  box-shadow:
    0 22px 50px -18px rgba(0, 0, 0, 0.7),
    0 4px 14px -6px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.phone img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 11% / 5%;
  background: #000;
}
.project__gallery .phone { transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease); }
.project__gallery .phone:hover {
  transform: translateY(-8px);
  box-shadow:
    0 34px 64px -20px color-mix(in srgb, var(--accent) 40%, rgba(0,0,0,0.7)),
    0 6px 16px -6px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   CRAFT
   ============================================================ */
.craft { background:
    linear-gradient(180deg, transparent, rgba(244,237,225,0.018) 30%, transparent);
}
.craft__grid {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) clamp(40px, 7vw, 90px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.craft__card {
  padding: 30px 28px 32px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line-2);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.craft__card:hover { transform: translateY(-5px); border-color: var(--line); background: var(--panel-2); }
.craft__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--gold); margin-bottom: 20px;
  background: rgba(233, 169, 60, 0.10); border: 1px solid rgba(233, 169, 60, 0.22);
}
.craft__icon svg { width: 22px; height: 22px; }
.craft__card h3 { font-size: 22px; margin-bottom: 10px; }
.craft__card p { color: var(--ink-soft); font-size: 15px; line-height: 1.58; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { padding: clamp(80px, 13vw, 160px) var(--pad); }
.contact__inner {
  max-width: 920px; margin: 0 auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.contact .eyebrow { justify-content: center; }
.contact__title { font-size: clamp(40px, 7vw, 88px); margin: 22px 0 22px; letter-spacing: -0.02em; }
.contact__sub { color: var(--ink-soft); font-size: 18px; max-width: 52ch; margin-bottom: 36px; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 46px; }
.contact__repos {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  width: 100%;
}
.contact__repos a {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 13px; color: var(--ink-soft);
  padding: 9px 15px; border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(244,237,225,0.015);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.contact__repos a:hover { color: var(--ink); border-color: var(--line); transform: translateY(-2px); }
.contact__repos i { width: 8px; height: 8px; border-radius: 50%; background: var(--a); box-shadow: 0 0 10px var(--a); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--line-2); padding: 40px var(--pad) 56px;
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.footer__name { font-family: var(--serif); font-size: 22px; }
.footer__note { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); max-width: 50ch; line-height: 1.6; }

/* ============================================================
   REVEAL ANIMATIONS
   ============================================================ */
[data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: 0.07s; }
[data-reveal-delay="2"] { transition-delay: 0.14s; }
[data-reveal-delay="3"] { transition-delay: 0.21s; }
[data-reveal-delay="4"] { transition-delay: 0.30s; }
[data-reveal-delay="5"] { transition-delay: 0.38s; }
[data-reveal-delay="6"] { transition-delay: 0.46s; }
.project__info > *, .project__gallery { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.project.is-visible .project__info > * { opacity: 1; transform: none; }
.project.is-visible .project__gallery { opacity: 1; transform: none; }
.project.is-visible .project__info > *:nth-child(2) { transition-delay: 0.05s; }
.project.is-visible .project__info > *:nth-child(3) { transition-delay: 0.10s; }
.project.is-visible .project__info > *:nth-child(4) { transition-delay: 0.15s; }
.project.is-visible .project__info > *:nth-child(5) { transition-delay: 0.20s; }
.project.is-visible .project__info > *:nth-child(6) { transition-delay: 0.25s; }
.project.is-visible .project__info > *:nth-child(7) { transition-delay: 0.30s; }
.project.is-visible .project__gallery { transition-delay: 0.12s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; gap: 10px; }
  .hero__stage { height: clamp(360px, 90vw, 480px); margin-top: 12px; max-width: 460px; }
  .project, .project--reverse { grid-template-columns: 1fr; gap: 26px; }
  .project--reverse .project__info, .project--reverse .project__gallery { order: 0; }
  .craft__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav__links { display: none; }
  .stats__row { grid-template-columns: repeat(2, 1fr); gap: 28px 18px; }
  .stat:last-child { grid-column: 1 / -1; }
  .craft__grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 14px; }
  .hero__stage { display: none; }
  .hero { padding-top: 120px; }
}
@media (max-width: 420px) {
  .stats__row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-reveal], .project__info > *, .project__gallery { opacity: 1 !important; transform: none !important; }
  .ticker__track { animation: none; }
}
