/* =========================================================
   NG Patel Portfolio
   Theme tokens, layout, components, responsive, dark mode
   ========================================================= */

:root {
  /* Palette */
  --navy: #0a1f44;
  --navy-700: #16386e;
  --gold: #c9a227;
  --gold-soft: #e6c860;
  --white: #ffffff;
  --gray-50: #f6f7f9;
  --gray-100: #eef1f5;
  --gray-200: #e2e7ee;
  --gray-400: #9aa6b6;
  --gray-600: #5b6878;
  --ink: #11202f;

  /* Semantic (light defaults) */
  --bg: var(--white);
  --bg-alt: var(--gray-50);
  --surface: var(--white);
  --surface-2: var(--gray-50);
  --text: var(--ink);
  --text-soft: var(--gray-600);
  --border: var(--gray-200);
  --brand: var(--navy);
  --brand-contrast: #ffffff;
  --accent: var(--gold);
  --shadow: 0 10px 30px rgba(10, 31, 68, 0.08);
  --shadow-lg: 0 20px 50px rgba(10, 31, 68, 0.14);

  --radius: 14px;
  --radius-lg: 22px;
  --container: 1160px;
  --header-h: 72px;

  --ff-head: "Lora", Georgia, "Times New Roman", serif;
  --ff-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0a1320;
  --bg-alt: #0d1827;
  --surface: #11203a;
  --surface-2: #0f1c33;
  --text: #e8eef6;
  --text-soft: #9fb0c4;
  --border: #1e3354;
  --brand: #16386e;
  --brand-contrast: #ffffff;
  --accent: var(--gold-soft);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s var(--ease), color .35s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
h1, h2, h3 { font-family: var(--ff-head); line-height: 1.15; color: var(--text); font-weight: 600; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.7rem); }
h3 { font-size: 1.25rem; }
button { font-family: inherit; cursor: pointer; }

.container { width: min(100% - 2.4rem, var(--container)); margin-inline: auto; }
.visually-hidden, .skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 10px; left: 10px; width: auto; height: auto;
  clip: auto; z-index: 2000; background: var(--brand); color: #fff;
  padding: .6rem 1rem; border-radius: 8px;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
  background: var(--navy); transition: opacity .6s var(--ease), visibility .6s;
}
#loader.hide { opacity: 0; visibility: hidden; }
.loader-mark {
  font-family: var(--ff-head); font-size: 2.4rem; font-weight: 700; color: #fff;
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid rgba(201,162,39,.35); position: relative;
}
.loader-mark::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid transparent; border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scroll progress ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  z-index: 1500;
}

/* ---------- Navbar ---------- */
#navbar {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s, background .3s;
}
#navbar.scrolled { border-color: var(--border); box-shadow: var(--shadow); }
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand-mark {
  font-family: var(--ff-head); font-weight: 700; color: #fff;
  background: var(--navy); width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; letter-spacing: .5px;
  border: 1.5px solid var(--gold); flex-shrink: 0;
}
.brand-name { font-size: 1.1rem; letter-spacing: .3px; }

.nav-menu { display: flex; align-items: center; gap: 1.6rem; }
.nav-menu a { font-size: .95rem; font-weight: 500; color: var(--text-soft); position: relative; padding: .3rem 0; transition: color .25s; }
.nav-menu a:hover, .nav-menu a.active { color: var(--text); }
.nav-menu a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
  background: var(--gold); transition: width .3s var(--ease);
}
.nav-menu a:hover::after, .nav-menu a.active::after { width: 100%; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 8px; }
.nav-toggle span { width: 26px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1.5px solid transparent; transition: transform .2s var(--ease), box-shadow .25s, background .25s, color .25s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .55rem 1.1rem; font-size: .85rem; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 8px 20px rgba(10,31,68,.25); }
.btn-primary:hover { background: var(--navy-700); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
[data-theme="dark"] .btn-primary { background: var(--gold); color: var(--navy); }
[data-theme="dark"] .btn-primary:hover { background: var(--gold-soft); }
.btn-outline { border-color: var(--navy); color: var(--text); }
.btn-outline:hover { background: var(--navy); color: #fff; }
[data-theme="dark"] .btn-outline { border-color: var(--gold); }
[data-theme="dark"] .btn-outline:hover { background: var(--gold); color: var(--navy); }
.btn-ghost { color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold); color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto clamp(2rem, 4vw, 3.2rem); }
.section-tag {
  display: inline-block; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: .6rem;
}
.section-sub { color: var(--text-soft); margin-top: .8rem; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(3rem, 6vw, 5rem); padding-bottom: clamp(4rem, 8vw, 7rem); overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 80% -10%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 60%),
    radial-gradient(700px 600px at 0% 20%, color-mix(in srgb, var(--navy) 12%, transparent), transparent 55%);
}
.hero-inner { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .04em; margin-bottom: .4rem; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); letter-spacing: -.5px; }
.hero-headline { font-size: clamp(1rem, 2.2vw, 1.35rem); font-weight: 600; color: var(--text); margin: .6rem 0 1.2rem; }
.hero-headline .sep { color: var(--gold); }
.hero-intro { color: var(--text-soft); font-size: 1.05rem; max-width: 56ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }

.hero-photo { position: relative; justify-self: center; }
.photo-frame {
  width: clamp(240px, 30vw, 360px); aspect-ratio: 5/6; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--navy), var(--navy-700));
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

.scroll-hint { position: absolute; left: 0; right: 0; bottom: 6px; margin-inline: auto; width: 26px; height: 42px; border: 2px solid var(--text-soft); border-radius: 14px; display: grid; justify-items: center; padding-top: 6px; }
.scroll-hint span { width: 4px; height: 8px; background: var(--accent); border-radius: 4px; animation: scrolldot 1.5s infinite; }
@keyframes scrolldot { 0%{opacity:0;transform:translateY(0)} 40%{opacity:1} 80%{opacity:0;transform:translateY(12px)} }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.about-story p { margin-bottom: 1rem; color: var(--text-soft); }
.about-story strong { color: var(--text); }
.about-highlights { display: grid; gap: .9rem; }
.about-highlights li {
  display: flex; gap: .9rem; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; box-shadow: var(--shadow);
  transition: transform .25s var(--ease);
}
.about-highlights li:hover { transform: translateX(5px); }
.hi-icon { font-size: 1.5rem; }
.about-highlights strong { display: block; }
.about-highlights span { color: var(--text-soft); font-size: .88rem; }

/* ---------- Card grids ---------- */
.cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

/* Experience */
.exp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.8rem; box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s; }
.exp-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.exp-head { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 1.1rem; }
.exp-head h3 { font-size: 1.5rem; }
.exp-role { color: var(--accent); font-weight: 600; font-size: .95rem; }
.checklist { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem 1rem; }
.checklist li { position: relative; padding-left: 1.6rem; color: var(--text-soft); font-size: .95rem; }
.checklist li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--gold); font-weight: 700; }

/* Timeline */
.timeline { position: relative; max-width: 780px; margin: 0 auto; padding-left: 1.5rem; }
.timeline::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 2rem 1.8rem; }
.tl-dot { position: absolute; left: -7px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--gold); }
.tl-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); }
.tl-date { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--accent); letter-spacing: .05em; margin-bottom: .3rem; }
.tl-sub { color: var(--text-soft); font-weight: 600; margin-bottom: .5rem; }
.tl-content p { color: var(--text-soft); }
.tl-meta { font-size: .92rem; margin-top: .6rem; }
.tl-meta strong { color: var(--text); }

/* Projects */
/* Highlights use a centered flex layout so an incomplete last row stays centered */
#projects .cards-3 { display: flex; flex-wrap: wrap; justify-content: center; }
#projects .cards-3 > .project-card { flex: 1 1 300px; max-width: calc(33.333% - 1rem); }
@media (max-width: 980px) { #projects .cards-3 > .project-card { max-width: calc(50% - 0.75rem); } }
@media (max-width: 760px) { #projects .cards-3 > .project-card { max-width: 100%; } }

.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s; display: flex; flex-direction: column; }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.project-img { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--c1), var(--c2)); display: grid; place-items: center; }
.project-img span { color: #fff; font-family: var(--ff-head); font-size: 1.4rem; font-weight: 600; letter-spacing: .03em; opacity: .95; }
.project-body { padding: 1.4rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.project-body p { color: var(--text-soft); font-size: .95rem; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags span { font-size: .75rem; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); padding: .25rem .6rem; border-radius: 999px; }

/* Articles */
.article-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s; display: flex; flex-direction: column; gap: .6rem; }
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.article-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent); }
.article-card p { color: var(--text-soft); font-size: .95rem; flex: 1; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem 2.5rem; max-width: 900px; margin: 0 auto; }
.skill-top { display: flex; justify-content: space-between; margin-bottom: .45rem; font-weight: 600; font-size: .95rem; }
.skill-top em { color: var(--accent); font-style: normal; }
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--navy), var(--gold)); border-radius: 999px; transition: width 1.2s var(--ease); }
.bar.animate i { width: var(--w); }

/* Contact */
.contact-cta { text-align: center; display: grid; gap: 1.2rem; justify-items: center; }
.email-btn { font-size: clamp(1.05rem, 2.5vw, 1.35rem); padding: 1rem 2.2rem; }
.email-btn .email-ico { font-size: 1.2em; }
.contact-alt { color: var(--text-soft); font-size: .95rem; }
.contact-alt a { color: var(--text); font-weight: 600; }
.contact-alt a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.footer { background: var(--navy); color: rgba(255,255,255,.85); padding-top: 3rem; }
[data-theme="dark"] .footer { background: #060d18; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer-brand { display: flex; align-items: center; gap: .9rem; max-width: 360px; }
.footer-brand p { font-size: .9rem; color: rgba(255,255,255,.7); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer-nav a { color: rgba(255,255,255,.8); font-size: .92rem; transition: color .2s; }
.footer-nav a:hover { color: var(--gold); }
.footer-social { display: flex; gap: .6rem; }
.footer-social a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-weight: 700; transition: background .25s, transform .25s; }
.footer-social a:hover { background: var(--gold); color: var(--navy); transform: translateY(-3px); }
.footer-bottom { text-align: center; padding: 1.3rem 0; font-size: .85rem; color: rgba(255,255,255,.6); }

/* ---------- Back to top ---------- */
.back-to-top { position: fixed; right: 22px; bottom: 26px; z-index: 900; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gold); color: var(--navy); font-size: 1.4rem; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(10px); transition: .3s var(--ease); }
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-cta { justify-content: center; }
  .hero-intro { margin-inline: auto; }
  .hero-photo { order: -1; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: flex-start;
    gap: .2rem; background: var(--bg); border-bottom: 1px solid var(--border); padding: 1rem 1.4rem 1.6rem;
    box-shadow: var(--shadow-lg); transform: translateY(-130%); transition: transform .35s var(--ease); height: auto;
  }
  .nav-menu.open { transform: translateY(0); }
  .nav-menu li { width: 100%; }
  .nav-menu a { display: block; width: 100%; padding: .7rem 0; border-bottom: 1px solid var(--border); }
  .nav-menu li:last-child { margin-top: .5rem; }
  .cards-2, .cards-3, .skills-grid { grid-template-columns: 1fr; }
  .checklist { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; align-items: center; }
}
@media (max-width: 420px) {
  .hero-cta .btn { width: 100%; }
}

/* Large monitors */
@media (min-width: 1600px) { :root { --container: 1320px; } }

/* Print */
@media print {
  #navbar, .back-to-top, #scroll-progress, #loader, .scroll-hint { display: none !important; }
  body { color: #000; background: #fff; }
}
