/* =========================================================
   Nanda Gopal · Portfolio
   1. Tokens & base      5. About
   2. Layout helpers     6. Teaching
   3. Navigation         7. Contact
   4. Hero               8. Footer & utilities
                         9. Animations (reveal, parallax)
   ========================================================= */


/* ---------- 1. Tokens & base ---------- */
:root {
  --bg: #0d0d0d;
  --bg-2: #141414;
  --card: #1a1a1a;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #a0a0a0;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, .12);
  --nova: #e63946;                       /* LearnwithNova brand red */
  --font-head: "Montserrat", sans-serif;
  --font-body: "Open Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, nav, .btn { font-family: var(--font-head); }


/* ---------- 2. Layout helpers ---------- */
.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
section { padding: 100px 0; }
section.alt { background: var(--bg-2); }

.head { text-align: center; margin: 0 auto 56px; max-width: 640px; }
.head small {
  color: var(--accent); font-family: var(--font-head); font-weight: 600;
  letter-spacing: .25em; text-transform: uppercase; font-size: .75rem;
}
.head h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 700; margin-top: 6px; line-height: 1.2; }
.head h2::after {
  content: ""; display: block; width: 50px; height: 3px; border-radius: 2px;
  background: var(--accent); margin: 16px auto 0;
}
.head p { color: var(--muted); margin-top: 18px; }

.link-accent { color: var(--accent); font-weight: 600; }
.link-accent:hover { text-decoration: underline; }

.btn {
  display: inline-block; padding: 12px 28px; border-radius: 30px; cursor: pointer;
  font-weight: 600; font-size: .85rem; color: #fff;
  background: var(--accent); border: 2px solid var(--accent); transition: .25s;
}
.btn:hover { background: transparent; color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 4px 13px; border-radius: 20px; font-family: var(--font-head);
  font-size: .78rem; font-weight: 600; background: var(--accent-soft); color: #cfe0ff;
}


/* ---------- 3. Navigation ---------- */
nav { position: fixed; inset: 0 0 auto; z-index: 100; padding: 22px 0; transition: background .3s, padding .3s; }
nav.solid {
  background: rgba(13, 13, 13, .95); padding: 12px 0;
  box-shadow: 0 1px 0 var(--line); backdrop-filter: blur(8px);
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.logo { color: var(--accent); font-family: var(--font-head); font-weight: 700; letter-spacing: .08em; font-size: 1.05rem; text-transform: uppercase; }
.menu { display: flex; gap: 24px; font-size: .78rem; font-weight: 500; }
.menu a { color: #cfcfcf; position: relative; padding: 4px 0; white-space: nowrap; }
.menu a:hover, .menu a.active { color: #fff; }
.menu a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--accent); }
.burger { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 900px) {
  .burger { display: block; }
  .menu {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); max-height: 0; overflow: hidden; transition: max-height .3s;
  }
  .menu.open { max-height: 480px; border-bottom: 1px solid var(--line); }
  .menu a { padding: 13px 16px; border-top: 1px solid var(--line); }
  .menu a.active::after { display: none; }
}


/* ---------- 4. Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; position: relative;
  background: var(--bg); overflow: hidden; isolation: isolate;
}

/* Full-screen close-up portrait, face right of centre.
   Height is 165vh but capped at 1600px so big screens don't over-enlarge the 1448px photo. */
.hero::before {
  --hs: min(145vh, 1450px);   /* photo height */
  --fx: 68vw;                 /* horizontal centre of the face */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: #1e1e1e url("../images/hero.jpg") no-repeat;
  background-size: auto var(--hs);
  /* x: centre the face at --fx; y: keep the eyes around 40% of the screen height */
  background-position: calc(var(--fx) - var(--hs) * .375) min(0px, 40vh - var(--hs) * .28);
  filter: grayscale(1) contrast(1.05) brightness(.5);
  /* parallax: --py = scroll offset, --mx/--my = mouse offset (set in main.js) */
  transform: translate3d(var(--mx, 0px), calc(var(--py, 0px) + var(--my, 0px)), 0) scale(1.03);
  transform-origin: 68% 35%;
  will-change: transform;
}

/* Darkening for text legibility + fade into the next section */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.3) 40%, rgba(0,0,0,0) 65%),
    linear-gradient(0deg, var(--bg) 0%, rgba(13,13,13,0) 22%),
    radial-gradient(ellipse at 68% 40%, rgba(0,0,0,0) 30%, rgba(0,0,0,.35) 80%);
}

.hero-inner {
  position: relative; max-width: 700px; padding-right: 16px; margin-top: -4vh;
  margin-left: max(16px, (100% - 1140px) / 2);
}
.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.6rem); font-weight: 700; line-height: 1.1;
  letter-spacing: -.005em; color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.35);
}
.roles {
  margin-top: 14px; min-height: 1.7em; color: #f0f0f0;
  font-family: var(--font-head); font-weight: 500; font-size: clamp(.92rem, 1.6vw, 1.05rem);
}
.roles .typed { border-right: 2px solid #fff; padding-right: 3px; }
.tagline { color: #bdbdbd; font-size: 1rem; margin-top: 12px; max-width: 520px; }

.social { display: flex; gap: 10px; margin-top: 26px; }
.social a {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--accent); transition: transform .2s, background .2s, color .2s;
}
.social a:hover { transform: translateY(-3px); background: var(--accent); color: #fff; }
.social svg { width: 12px; height: 12px; }

.scroll-down {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #fff; animation: bob 1.8s ease-in-out infinite;
}
.scroll-down svg { width: 26px; height: 26px; }
@keyframes bob { 50% { transform: translate(-50%, 8px); } }

/* Phone: photo pushed right so about half the face shows; text on the left */
@media (max-width: 760px) {
  .hero { padding: 70px 0 60px; }
  .hero::before { background-size: auto 115vh; background-position: calc(100vw - 50vh) -2vh; }
  .hero::after {
    background:
      linear-gradient(90deg, rgba(0,0,0,.6) 0%, rgba(0,0,0,.35) 50%, rgba(0,0,0,0) 80%),
      linear-gradient(0deg, var(--bg) 0%, rgba(13,13,13,0) 20%);
  }
  .hero-inner { margin-top: 0; max-width: none; width: 100%; }
  .hero h1 { font-size: clamp(2rem, 9.5vw, 2.6rem); }
  .hero h1 .im { display: block; }          /* "I'M" on its own line */
  .hero h1 .nm { white-space: nowrap; }
  .roles, .tagline { max-width: 72%; }
  .tagline { font-size: .92rem; }
  .social { margin-top: 20px; }
  .scroll-down { bottom: 16px; }
}


/* ---------- 5. About ---------- */
.about { display: grid; grid-template-columns: 1fr 1.3fr; gap: 56px; align-items: center; }
/* Photo and offset frame are separate layers so the frame stays behind the photo
   (the parallax translate creates a stacking context on .about-img). */
.about-img { position: relative; aspect-ratio: 4 / 5; isolation: isolate; }
.about-img::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 6px;
  background: url("../images/photo.png") center 20% / cover, linear-gradient(135deg, #222, #111);
}
.about-img::after {
  content: ""; position: absolute; inset: 18px -18px -18px 18px; z-index: -2;
  border: 2px solid var(--accent); border-radius: 6px;
}
.about h3 { font-size: 1.6rem; margin-bottom: 14px; line-height: 1.3; }
.about h3 span { color: var(--accent); }
.about p { color: var(--muted); margin-bottom: 16px; }

/* LearnwithNova card: uses the brand red instead of the site blue */
.nova {
  --accent: var(--nova);
  --accent-soft: rgba(230, 57, 70, .14);
  margin-top: 64px; padding: 34px; border-radius: 10px;
  background: var(--card); border: 1px solid rgba(230, 57, 70, .35);
}
.nova h3 { font-size: 1.25rem; margin-bottom: 6px; }
.nova p { color: var(--muted); font-size: .95rem; }
.nova .chips { margin-top: 14px; }
.nova .chip { color: #ffd2d6; }

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about-img { max-width: 340px; }
}
@media (max-width: 560px) { .nova { padding: 26px; } }


/* ---------- 6. Teaching ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.card {
  padding: 32px 26px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  transition: transform .3s, border-color .3s;
}
.card:hover { transform: translateY(-6px); border-color: var(--accent); }
.card .ic {
  width: 56px; height: 56px; border-radius: 14px; margin-bottom: 20px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.card .ic svg { width: 26px; height: 26px; }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .93rem; }


/* ---------- 7. Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.4fr; gap: 48px; }
.c-item { display: flex; gap: 16px; margin-bottom: 26px; }
.c-item .ic {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--accent);
}
.c-item .ic svg { width: 18px; height: 18px; }
.c-item h4 { font-size: .95rem; }
.c-item span, .c-item a { color: var(--muted); font-size: .92rem; word-break: break-word; }

form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input, textarea, select {
  width: 100%; padding: 13px 16px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: .92rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 140px; resize: vertical; }
form .btn { justify-self: start; }

@media (max-width: 760px) { .contact, .row { grid-template-columns: 1fr; } }


/* ---------- 8. Footer & utilities ---------- */
footer {
  padding: 30px 0; text-align: center; font-size: .85rem; color: var(--muted);
  background: #080808; border-top: 1px solid var(--line);
}
footer b { color: #fff; }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  opacity: 0; pointer-events: none; transition: .3s;
}
.to-top.show { opacity: 1; pointer-events: auto; }

.progress {
  position: fixed; top: 0; left: 0; z-index: 101; width: 100%; height: 2px; pointer-events: none;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}


/* ---------- 9. Animations ---------- */

/* Loader: "Hi, I'm Nanda Gopal" typed out in the landing-page heading style.
   main.js types the text, adds .typed-done (underline grows), then .done (screen slides up). */
.loader {
  position: fixed; inset: 0; z-index: 1000; padding: 0 16px;
  display: grid; place-items: center; align-content: center; gap: 18px;
  background: var(--bg);
  transition: transform .7s cubic-bezier(.77, 0, .18, 1), visibility 0s .7s;
}
.loader.done { transform: translateY(-100%); visibility: hidden; }
.no-intro .loader { display: none; }
html:not(.no-intro) body { overflow: hidden; }          /* no scrolling while the intro plays */
html.intro-done body { overflow: auto; }

.loader-text {
  font-family: var(--font-head); font-weight: 700; color: #fff; text-align: center;
  font-size: clamp(2rem, 6.2vw, 4.6rem); line-height: 1.1; letter-spacing: -.005em;
  min-height: 1.1em;
}
.loader-cursor {
  display: inline-block; width: 3px; height: .9em; margin-left: 4px; vertical-align: -.08em;
  background: var(--accent); animation: blink .8s steps(1) infinite;
}
.loader-line {
  display: block; width: min(320px, 50vw); height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.loader.typed-done .loader-line { transform: scaleX(1); }

@keyframes blink { 50% { opacity: 0; } }

.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1);
}
.reveal.show { opacity: 1; transform: none; }
.cards .reveal:nth-child(2) { transition-delay: .1s; }
.cards .reveal:nth-child(3) { transition-delay: .2s; }
.cards .reveal:nth-child(4) { transition-delay: .3s; }

/* Parallax layers (values set in main.js) */
.hero-inner { translate: var(--tx, 0px) var(--ty, 0px); opacity: var(--op, 1); will-change: translate, opacity; }
[data-speed] { translate: 0 var(--p, 0px); will-change: translate; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero::before { transform: none; }
  .hero-inner, [data-speed] { translate: none; opacity: 1; }
  .scroll-down { animation: none; }
}
