/* ==========================================================================
   Rajiv Aryal — portfolio styles
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e7f5f2;
  --warm: #b45309;
  --warm-soft: #fdf3e7;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.1);
  --header-h: 64px;
  --container: 1120px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
ul { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

[hidden] { display: none !important; }
.container { width: min(100% - 40px, var(--container)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 15px; line-height: 1;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.link-arrow { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.link-arrow i { transition: transform 0.15s; }
.link-arrow:hover i { transform: translateX(3px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(246, 247, 249, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 24px; }
.brand { font-weight: 800; color: var(--ink); font-size: 18px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 14px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a:not(.btn) { color: var(--ink-2); font-weight: 500; font-size: 15px; padding: 8px 12px; border-radius: var(--radius-sm); }
.nav-links a:not(.btn):hover { color: var(--ink); background: rgba(15, 23, 42, 0.05); }
.nav-links a[aria-current="page"] { color: var(--ink); background: rgba(15, 23, 42, 0.06); }
.nav-links .btn { margin-left: 8px; }
.nav-toggle { display: none; background: none; border: 0; font-size: 28px; color: var(--ink); cursor: pointer; padding: 4px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); padding: 12px 20px 20px;
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a:not(.btn) { padding: 12px; }
  .nav-links .btn { margin: 8px 0 0; justify-content: center; }
}

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.section-title { font-size: clamp(28px, 4vw, 36px); font-weight: 800; margin: 0; }
.section-sub { color: var(--muted); margin: 8px 0 0; max-width: 60ch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.hero-role { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; margin-bottom: 20px; }
.hero-role::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.hero-lead { font-size: clamp(18px, 2vw, 20px); color: var(--ink-2); max-width: 34ch; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.socials { display: flex; gap: 8px; flex-wrap: wrap; }
.socials a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 18px; transition: all 0.15s; }
.socials a:hover { color: #fff; background: var(--ink); border-color: var(--ink); }
.hero-photo { position: relative; justify-self: center; width: min(100%, 360px); }
.hero-photo img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 28px; box-shadow: var(--shadow-lg); position: relative; z-index: 1; }
.hero-photo::before { content: ""; position: absolute; inset: 18px -18px -18px 18px; border-radius: 28px; background: var(--accent-soft); border: 1px solid #cde9e3; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 56px; }
.stat { padding: 20px; }
.stat strong { display: block; font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; }
.stat span { font-size: 14px; color: var(--muted); }

@media (max-width: 900px) {
  .hero { padding-top: 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-photo { order: -1; width: 200px; justify-self: start; }
  .hero-photo::before { inset: 10px -10px -10px 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; }
.about-text p { font-size: 17px; }
.side-stack { display: grid; gap: 16px; }
.side-card { padding: 24px; }
.side-card h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.chip { font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); }
.chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-hover); }
.edu h4 { font-size: 16px; margin-bottom: 4px; }
.edu p { font-size: 14px; color: var(--muted); margin: 0; }
.edu + .edu { margin-top: 14px; }
.ticks { list-style: none; padding: 0; display: grid; gap: 10px; font-size: 15px; }
.ticks li { display: flex; gap: 10px; }
.ticks li::before { content: "\F26A"; font-family: "bootstrap-icons"; color: var(--accent); flex: none; }

@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.skill { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 12px; text-align: center; transition: transform 0.15s, box-shadow 0.15s; }
.skill:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.skill img { width: 44px; height: 44px; object-fit: contain; }
.skill span { font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- Experience ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.tab { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 9px 16px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tab .count { font-size: 12px; background: var(--bg); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.tab[aria-selected="true"] .count { background: rgba(255, 255, 255, 0.18); color: #fff; }

.timeline { list-style: none; padding: 0; position: relative; display: grid; gap: 12px; }
.exp { padding: 0; overflow: hidden; transition: box-shadow 0.15s, border-color 0.15s; }
.exp:hover { border-color: #cbd5e1; }
.exp[open] { box-shadow: var(--shadow-lg); }
.exp summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 170px 1fr auto; gap: 20px; align-items: start; padding: 20px 24px; }
.exp summary::-webkit-details-marker { display: none; }
.exp-period { font-size: 14px; font-weight: 600; color: var(--muted); padding-top: 2px; }
.exp-role { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0; }
.exp-org { font-weight: 600; color: var(--accent); }
.exp-loc { color: var(--muted); font-size: 14px; }
.exp-summary { margin: 6px 0 0; font-size: 15px; }
.exp-toggle { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); transition: transform 0.2s, background 0.15s; }
.exp[open] .exp-toggle { transform: rotate(45deg); background: var(--ink); color: #fff; border-color: var(--ink); }
.exp-body { padding: 0 24px 22px calc(170px + 44px); }
.exp-body ul { display: grid; gap: 6px; font-size: 15px; }
.exp-body li::marker { color: var(--accent); }

@media (max-width: 700px) {
  .exp summary { grid-template-columns: 1fr auto; gap: 4px 12px; padding: 18px; }
  .exp-period { grid-column: 1 / -1; order: -1; font-size: 13px; }
  .exp-body { padding: 0 18px 18px; }
}

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project { padding: 24px; display: flex; flex-direction: column; gap: 12px; transition: transform 0.15s, box-shadow 0.15s; }
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.project-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.project-cat { color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.project h3 { font-size: 19px; margin: 0; }
.project p { margin: 0; font-size: 15px; }
.project .chips { margin-top: auto; }
.project details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.project details summary::-webkit-details-marker { display: none; }
.project details summary i { transition: transform 0.2s; }
.project details[open] summary i { transform: rotate(180deg); }
.project details ul { margin-top: 10px; font-size: 14px; display: grid; gap: 4px; }
.project-links { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; font: inherit; font-size: 15px; padding: 10px 14px 10px 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Writing ---------- */
.posts { display: grid; gap: 12px; }
.post { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 20px 24px; color: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
.post:hover { color: inherit; border-color: var(--accent); box-shadow: var(--shadow-lg); }
.post h3 { font-size: 17px; margin: 0 0 4px; }
.post p { margin: 0; font-size: 14px; color: var(--muted); }
.post-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.post > i { font-size: 20px; color: var(--muted); }
.post:hover > i { color: var(--accent); }

/* ---------- Giving ---------- */
.giving-teaser { display: grid; grid-template-columns: 1fr 1.3fr; gap: 32px; padding: 36px; background: linear-gradient(135deg, var(--warm-soft), #fff 70%); }
.giving-teaser h2 { font-size: 28px; }
.mini-stats { display: flex; gap: 32px; margin: 20px 0 24px; }
.mini-stats strong { display: block; font-size: 28px; color: var(--ink); font-weight: 800; }
.mini-stats span { font-size: 13px; color: var(--muted); }
.donation-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.donation-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.donation-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--warm-soft); color: var(--warm); font-size: 18px; }
.donation-row strong { color: var(--ink); display: block; }
.donation-row small { color: var(--muted); }
.donation-amount { font-weight: 700; color: var(--ink); font-size: 15px; white-space: nowrap; }

@media (max-width: 900px) { .giving-teaser { grid-template-columns: 1fr; padding: 24px; } }

/* ---------- Donations page ---------- */
.page-hero { padding: 64px 0 40px; }
.page-hero h1 { font-size: clamp(36px, 5vw, 52px); font-weight: 800; letter-spacing: -0.03em; }
.page-hero p { font-size: 18px; max-width: 60ch; color: var(--ink-2); }
.year-group + .year-group { margin-top: 40px; }
.year-group h2 { font-size: 20px; display: flex; align-items: center; gap: 12px; }
.year-group h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.donation-card { padding: 22px 24px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; }
.donation-card h3 { font-size: 18px; margin: 0 0 4px; }
.donation-card p { margin: 6px 0 0; font-size: 15px; }
.donation-card .meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.donation-cards { display: grid; gap: 12px; }
@media (max-width: 600px) { .donation-card { grid-template-columns: auto 1fr; } .donation-card .donation-amount { grid-column: 2; } }

/* ---------- Participations ---------- */
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 32px; list-style: none; padding: 0; }
.event { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.event strong { color: var(--ink); font-weight: 600; font-size: 15px; display: block; }
.event small { color: var(--muted); }
.event .year { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; }
.contact-info { padding: 32px; background: var(--ink); color: #cbd5e1; border: 0; }
.contact-info h3 { color: #fff; font-size: 24px; }
.contact-info ul { list-style: none; padding: 0; display: grid; gap: 18px; margin-top: 28px; }
.contact-info li { display: flex; gap: 14px; align-items: center; }
.contact-info li i { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); color: #5eead4; font-size: 18px; flex: none; }
.contact-info small { display: block; color: #94a3b8; font-size: 13px; }
.contact-info a, .contact-info span { color: #fff; }
.contact-form { padding: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-control { width: 100%; font: inherit; font-size: 15px; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink); transition: border-color 0.15s, background 0.15s; }
.form-control:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.form-control { resize: vertical; min-height: 140px; }
.form-footer { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.contact-form .loading,
.contact-form .error-message,
.contact-form .sent-message { display: none; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.contact-form .loading { background: var(--bg); color: var(--ink-2); }
.contact-form .error-message { background: #fef2f2; color: #b91c1c; }
.contact-form .sent-message { background: var(--accent-soft); color: var(--accent-hover); }
@media (max-width: 900px) { .contact-grid, .form-row { grid-template-columns: 1fr; } .contact-form, .contact-info { padding: 24px; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; margin-top: 88px; font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-2); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

/* ---------- Loading skeleton ---------- */
.skeleton { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }

/* ---------- CV page ---------- */
.cv-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.cv { max-width: 860px; margin: 0 auto; padding: 56px; }
.cv-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid var(--ink); margin-bottom: 28px; flex-wrap: wrap; }
.cv-head h1 { font-size: 36px; margin-bottom: 4px; }
.cv-head .role { color: var(--accent); font-weight: 600; }
.cv-contact { font-size: 14px; display: grid; gap: 2px; text-align: right; }
.cv-section { margin-bottom: 28px; break-inside: avoid-page; }
.cv-section > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 14px; }
.cv-item { margin-bottom: 14px; break-inside: avoid; }
.cv-item-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cv-item-head strong { color: var(--ink); }
.cv-item-head span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.cv-item p, .cv-item ul { font-size: 14.5px; margin: 4px 0 0; }
.cv-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
@media (max-width: 700px) { .cv { padding: 24px; } .cv-contact { text-align: left; } .cv-two { grid-template-columns: 1fr; } }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .site-header, .site-footer, .cv-actions, .no-print { display: none !important; }
  .cv { padding: 0; box-shadow: none; border: 0; max-width: none; }
  .page-hero { display: none; }
  a { color: inherit; }
}
