/* ==========================================================================
   Prashil Raj Shrestha — personal site
   Written from scratch in the spirit of Apple product pages: large type,
   generous space, quiet colour. No framework dependencies.
   SF Pro is used where the system has it (macOS, iOS); Inter elsewhere.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-dark: #000000;
  --tile-dark: #1d1d1f;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --text-on-dark: #f5f5f7;
  --text-on-dark-2: #86868b;
  --line: #d2d2d7;
  --link: #0066cc;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --link-on-dark: #2997ff;
  --control: rgba(210, 210, 215, 0.64);
  --control-hover: rgba(223, 223, 227, 0.7);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --radius-xl: 28px;
  --radius: 18px;
  --radius-sm: 12px;
  --wrap: 1024px;
  --gutter: 22px;
  --nav-h: 48px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.011em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; letter-spacing: inherit; }
h1, h2, h3, h4, p { margin: 0; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--text); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

/* ---------- Navigation ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.scrolled { border-bottom-color: rgba(0, 0, 0, 0.12); }

.nav-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}

.brand { color: var(--text); font-weight: 600; font-size: 19px; letter-spacing: 0.005em; white-space: nowrap; }
.brand:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 24px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text); font-size: 12px; letter-spacing: -0.01em; opacity: 0.8; transition: opacity 0.2s var(--ease); }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.nav-links a.active { opacity: 1; }
.nav-links .nav-cta {
  display: inline-block; background: var(--blue); color: #fff; opacity: 1;
  padding: 4px 11px; border-radius: 980px; font-size: 12px;
}
.nav-links .nav-cta:hover { background: var(--blue-hover); }

.nav-toggle {
  display: none;
  width: 40px; height: 40px; margin-right: -10px;
  background: none; border: 0; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 1.5px; background: currentColor; border-radius: 2px;
  position: relative; transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav.open .nav-toggle span { background: transparent; }
.nav.open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav.open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 24px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; padding: 10px 0; }
  .nav-links .nav-cta { margin-top: 16px; padding: 8px 18px; font-size: 15px; font-weight: 400; }
}

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; padding: 11px 21px; border-radius: 980px;
  font-size: 17px; font-weight: 400; line-height: 1.18;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary { color: var(--blue); border-color: var(--blue); }
.btn-secondary:hover { background: var(--blue); color: #fff; }

.link-arrow::after { content: "\00a0\203A"; }

/* ---------- Sections and headings ---------- */

section { padding: 112px 0; }
.section-alt { background: var(--bg-alt); }

.eyebrow {
  font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: 0.01em;
  color: var(--text-2); margin-bottom: 10px;
}

.headline {
  font-size: clamp(34px, 5.4vw, 56px);
  font-weight: 600; line-height: 1.07; letter-spacing: -0.015em;
  max-width: 880px; text-wrap: balance;
}
.headline .muted { color: var(--text-2); }
.subhead {
  font-size: clamp(19px, 2vw, 21px);
  line-height: 1.38; color: var(--text-2); font-weight: 400;
  letter-spacing: 0.005em; margin-top: 20px; max-width: 700px;
}
.section-head { margin-bottom: 56px; }

/* ---------- Hero ---------- */

.hero { padding: 88px 0 0; text-align: center; overflow: hidden; }
.hero .eyebrow { font-size: clamp(21px, 2.4vw, 28px); color: var(--text); margin-bottom: 14px; }
.hero h1 {
  font-size: clamp(44px, 7.6vw, 80px);
  font-weight: 600; line-height: 1.05; letter-spacing: -0.02em;
  max-width: 920px; margin: 0 auto; text-wrap: balance;
}
.hero .subhead { margin: 24px auto 0; max-width: 660px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 36px; }

.hero-media {
  margin: 72px auto 0;
  max-width: 1260px;
  padding: 0 var(--gutter);
}
.hero-media figure {
  margin: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  transform: scale(var(--hero-scale, 0.92));
  transform-origin: center top;
  will-change: transform;
}
.hero-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Highlights ---------- */

.stats { padding: 104px 0 120px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 48px 32px;
}
.stat-value {
  font-size: clamp(36px, 3.8vw, 48px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.07;
  white-space: nowrap;
}
.stat-label { font-size: 17px; color: var(--text-2); margin-top: 10px; line-height: 1.41; font-weight: 500; }
@media (max-width: 860px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- About ---------- */

.about-grid {
  display: grid; grid-template-columns: 5fr 7fr; gap: 64px; align-items: center;
}
.about-photo {
  border-radius: var(--radius-xl); overflow: hidden; background: var(--bg);
  aspect-ratio: 4 / 5;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.about-text .headline { font-size: clamp(34px, 4.4vw, 48px); line-height: 1.08; }
.about-text p { font-size: 19px; line-height: 1.47; color: var(--text-2); letter-spacing: 0.005em; }
.about-text p + p { margin-top: 18px; }
.about-text strong { color: var(--text); font-weight: 600; }

.facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 32px;
  margin: 40px 0 0; padding: 32px 0 0; border-top: 1px solid var(--line);
}
.facts dt { font-size: 14px; color: var(--text-2); }
.facts dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; line-height: 1.35; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-photo { max-width: 440px; }
}
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } }

/* ---------- Experience (laid out like a spec sheet) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tl-item {
  display: grid; grid-template-columns: 240px 1fr; gap: 32px;
  padding: 44px 0; border-bottom: 1px solid var(--line);
}
.tl-when { font-size: 17px; font-weight: 600; color: var(--text); padding-top: 3px; }
.tl-when span { display: block; font-weight: 400; color: var(--text-2); margin-top: 2px; }
.tl-role { font-size: 28px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.14; }
.tl-org { font-size: 17px; color: var(--text-2); margin-top: 6px; }
.tl-summary { margin-top: 14px; color: var(--text-2); }
.tl-points { margin: 18px 0 0; padding: 0; list-style: none; }
.tl-points li { position: relative; padding-left: 18px; margin-top: 10px; }
.tl-points li::before {
  content: ""; position: absolute; left: 2px; top: 0.66em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-3);
}

.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 56px; }
.edu-card { background: var(--bg-alt); border-radius: var(--radius-xl); padding: 36px 40px; }
.edu-card .tl-when { font-size: 14px; font-weight: 400; color: var(--text-2); padding: 0; margin-bottom: 8px; }
.edu-card h3 { font-size: 24px; font-weight: 600; letter-spacing: 0.005em; line-height: 1.17; }
.edu-card p { color: var(--text-2); margin-top: 12px; }

@media (max-width: 760px) {
  .tl-item { grid-template-columns: 1fr; gap: 10px; padding: 32px 0; }
  .edu-grid { grid-template-columns: 1fr; }
  .edu-card { padding: 30px 28px; }
}

/* ---------- Tools ---------- */

.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tool-card {
  background: var(--bg-alt); border-radius: var(--radius-xl); padding: 40px;
  display: flex; flex-direction: column;
}
.tool-tag { font-size: 14px; font-weight: 600; color: var(--text-2); }
.tool-card h3 { font-size: 32px; font-weight: 600; letter-spacing: 0.004em; margin-top: 6px; line-height: 1.12; }
.tool-card p { color: var(--text-2); margin-top: 14px; }
.tool-card .link-arrow { margin-top: 20px; }
.tool-metric { margin-top: auto; padding-top: 20px; font-weight: 600; color: var(--text) !important; }

@media (max-width: 760px) { .tools-grid { grid-template-columns: 1fr; } .tool-card { padding: 32px 28px; } }

/* ---------- Project gallery (horizontal scroller) ---------- */

.work-grid {
  --inset: max(var(--gutter), calc((100% - var(--wrap)) / 2));
  display: flex; gap: 20px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--inset);
  padding: 8px var(--inset) 40px;
  scrollbar-width: none;
}
.work-grid::-webkit-scrollbar { display: none; }

.project {
  position: relative; flex: 0 0 auto;
  width: min(372px, 80vw); height: 560px;
  scroll-snap-align: start;
  background: var(--bg); color: var(--text);
  border-radius: var(--radius-xl); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.project:hover { text-decoration: none; transform: scale(1.01); box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.1); }
.project:focus-visible { outline-offset: 4px; border-radius: var(--radius-xl); }

.project-body { order: -1; padding: 30px 30px 8px; }
.project-tag { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.project-title { font-size: 28px; font-weight: 600; letter-spacing: 0.007em; line-height: 1.14; margin-top: 8px; }
.project-blurb { font-size: 17px; color: var(--text-2); margin-top: 10px; line-height: 1.35; }
.project-detail { display: none; }

.project-media { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.project-media img { width: 100%; height: 100%; object-fit: contain; padding: 12px 24px 64px; }
.project-media.cover img { object-fit: cover; padding: 0; }

/* The round "+" that opens the detail view */
.project::after {
  content: ""; position: absolute; right: 20px; bottom: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  background:
    linear-gradient(#fff, #fff) center / 14px 2px no-repeat,
    linear-gradient(#fff, #fff) center / 2px 14px no-repeat,
    rgba(51, 51, 54, 0.92);
  transition: background-color 0.2s var(--ease);
}
.project:hover::after { background-color: #1d1d1f; }

.gallery-controls { display: flex; justify-content: flex-end; gap: 16px; margin-top: 4px; }
.paddle {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--control); color: rgba(0, 0, 0, 0.56);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.paddle:hover { background: var(--control-hover); color: rgba(0, 0, 0, 0.64); }
.paddle[disabled] { opacity: 0.36; cursor: default; }
.paddle svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .project { height: 480px; }
  .project-title { font-size: 24px; }
}

/* ---------- Project dialog ---------- */

.dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: var(--radius-xl);
  background: var(--bg); color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.45s var(--ease); }
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

.dialog-scroll { overflow-y: auto; }
.dialog-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(51, 51, 54, 0.92); color: #fff; font-size: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.dialog-close:hover { background: #1d1d1f; }

.gallery-stage {
  position: relative; background: var(--bg-alt);
  width: 100%; height: min(56vh, 580px); display: flex; align-items: center; justify-content: center;
}
.gallery-stage img { width: 100%; height: 100%; object-fit: contain; padding: 28px; mix-blend-mode: multiply; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--control); color: rgba(0, 0, 0, 0.56); font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.gallery-nav:hover { background: var(--control-hover); }
.gallery-nav.prev { left: 16px; }
.gallery-nav.next { right: 16px; }
.gallery-thumbs { display: flex; gap: 10px; padding: 16px 40px 0; overflow-x: auto; }
.gallery-thumbs button {
  flex: 0 0 auto; width: 72px; height: 54px; padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--bg-alt);
  opacity: 0.55; transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}
.gallery-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--blue); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.dialog-body { padding: 28px 40px 44px; max-width: 760px; }
.dialog-body .project-tag { font-size: 14px; }
.dialog-body h3 { font-size: 40px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.1; margin-top: 6px; }
.dialog-body p { color: var(--text-2); margin-top: 16px; font-size: 19px; line-height: 1.42; }
.dialog-body ul { margin: 16px 0 0; padding-left: 20px; color: var(--text-2); font-size: 17px; }
.dialog-body li { margin-top: 6px; }

@media (max-width: 600px) {
  .dialog-body { padding: 22px 24px 32px; }
  .gallery-thumbs { padding: 12px 24px 0; }
  .dialog-body h3 { font-size: 30px; }
  .dialog-body p { font-size: 17px; }
}

/* ---------- Skills ---------- */

.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 40px; }
.skill-card { padding-top: 24px; border-top: 1px solid var(--line); }
.skill-card h3 { font-size: 21px; font-weight: 600; letter-spacing: 0.011em; line-height: 1.2; }
.skill-card p { color: var(--text-2); margin-top: 10px; }
.training {
  margin-top: 64px; padding: 32px 40px; border-radius: var(--radius-xl);
  background: var(--bg-alt); color: var(--text-2);
}
.training strong { color: var(--text); font-weight: 600; }

@media (max-width: 960px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .skills-grid { grid-template-columns: 1fr; gap: 32px; } .training { padding: 28px; } }

/* ---------- Contact ---------- */

.contact-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 20px; }
.contact-info { display: flex; flex-direction: column; gap: 20px; }
.contact-card { background: var(--bg); border-radius: var(--radius-xl); padding: 32px 36px; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-list li:first-child { padding-top: 0; }
.contact-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.contact-list .label { display: block; font-size: 14px; color: var(--text-2); }
.contact-list .value { font-size: 17px; font-weight: 600; color: var(--text); word-break: break-word; }
.contact-list a.value { color: var(--link); font-weight: 400; }

.map {
  border-radius: var(--radius-xl); overflow: hidden; background: var(--bg);
  flex: 1; min-height: 280px; position: relative;
}
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.form { background: var(--bg); border-radius: var(--radius-xl); padding: 40px; }
.form h3 { font-size: 28px; font-weight: 600; letter-spacing: 0.007em; margin-bottom: 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--text-2); margin: 0 0 6px 4px; }
.field input, .field textarea {
  font: inherit; font-size: 17px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input:hover, .field textarea:hover { border-color: var(--text-3); }
.field input:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.2); }
.field textarea { min-height: 150px; resize: vertical; }
.form-footer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.form-status { font-size: 15px; color: var(--text-2); }
.form-status.ok { color: #1d8a3a; }
.form-status.err { color: #d70015; }
.btn[disabled] { opacity: 0.6; cursor: default; }

@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form { padding: 30px 22px; }
  .contact-card { padding: 28px 22px; }
}

/* ---------- Footer ---------- */

.footer { background: var(--bg-alt); padding: 0 0 36px; font-size: 12px; line-height: 1.33; color: var(--text-2); }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.footer-links { display: flex; gap: 0; list-style: none; margin: 0; padding: 0; }
.footer-links li + li { border-left: 1px solid var(--line); }
.footer-links a { color: var(--text-2); padding: 0 10px; }
.footer-links li:last-child a { padding-right: 0; }
.footer-links a:hover { color: var(--text); }

/* ---------- Scroll reveal ---------- */

.js .reveal {
  opacity: 0; transform: translateY(32px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  section { padding: 80px 0; }
  .section-head { margin-bottom: 40px; }
  .hero { padding-top: 56px; }
  .hero-media { margin-top: 48px; }
  .hero-media figure { border-radius: var(--radius); }
  .stats { padding: 72px 0 88px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .hero-media figure { transform: none; }
}
