/* =========================================================
   Amegh K P — Portfolio
   Design system + layout
   Palette is driven by CSS custom properties below.
   To rebrand, change --accent (and --accent-2) only.
   ========================================================= */

:root {
  /* surfaces (faint green-tinted charcoal) */
  --bg:        #0a0c0a;
  --bg-2:      #0e110e;
  --surface:   #141814;
  --surface-2: #192019;
  --border:    rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --glass:     rgba(18, 20, 18, 0.72);

  /* text */
  --text:   #ebeeea;
  --muted:  #9aa29a;
  --faint:  #6b746b;

  /* accent (fresh developer green) */
  --accent:    #8bd450;
  --accent-2:  #63b232;
  --accent-ink:#0b1305;
  --accent-soft: rgba(139, 212, 80, 0.13);
  --accent-glow: rgba(139, 212, 80, 0.38);

  /* layout */
  --radius:   18px;
  --radius-sm:12px;
  --maxw:     1240px;
  --sidebar:  340px;
  --gap:      26px;
  --shadow:   0 20px 50px -24px rgba(0, 0, 0, 0.75);
  --shadow-sm:0 8px 24px -14px rgba(0, 0, 0, 0.7);

  /* type */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Sora", var(--font-body);

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- light theme (toggled via html[data-theme="light"]) ---------- */
:root[data-theme="light"] {
  --bg:        #f3f5f1;
  --bg-2:      #eef1ea;
  --surface:   #ffffff;
  --surface-2: #f3f6ef;
  --border:    rgba(10, 20, 10, 0.10);
  --border-strong: rgba(10, 20, 10, 0.18);
  --glass:     rgba(255, 255, 255, 0.78);

  --text:   #15181a;
  --muted:  #51575a;
  --faint:  #8a9088;

  --accent:    #5aa72c;
  --accent-2:  #478a20;
  --accent-ink:#ffffff;
  --accent-soft: rgba(90, 167, 44, 0.12);
  --accent-glow: rgba(90, 167, 44, 0.30);

  --shadow:   0 20px 50px -26px rgba(20, 40, 20, 0.28);
  --shadow-sm:0 8px 24px -16px rgba(20, 40, 20, 0.22);
}
:root[data-theme="light"] .status-dot { border-color: #fff; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
button { font: inherit; cursor: pointer; }

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

.skip-link {
  position: fixed;
  left: 14px; top: -60px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 14px; }

/* ---------- decorative background ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 700px at 82% -10%, #121a12 0%, var(--bg) 55%); }
:root[data-theme="light"] .bg-decor { background: radial-gradient(1200px 700px at 82% -10%, #e8f1e2 0%, var(--bg) 58%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.orb-1 { width: 520px; height: 520px; top: -160px; right: -120px; background: radial-gradient(circle, rgba(139,212,80,.20), transparent 70%); }
.orb-2 { width: 460px; height: 460px; bottom: -180px; left: -140px; background: radial-gradient(circle, rgba(99,178,50,.12), transparent 70%); }
/* flowing accent lines */
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.flow-lines path { fill: none; stroke: var(--accent); stroke-width: 1; opacity: .14; }
:root[data-theme="light"] .flow-lines path { opacity: .22; }
:root[data-theme="light"] .orb { opacity: .4; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(900px 600px at 70% 10%, #000 30%, transparent 75%);
}

/* =========================================================
   LAYOUT
   ========================================================= */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: var(--gap);
  align-items: start;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- sidebar / profile ---------- */
.sidebar { position: sticky; top: 26px; }

.profile-card { padding: 20px 22px 24px; text-align: center; }

/* top bar of the card: monogram + theme toggle */
.profile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.profile-top .mono {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  font-family: var(--font-head); font-weight: 800; font-size: 1.05rem;
  color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(18deg); }
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.profile-photo {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #000;
  border: 1px solid var(--border-strong);
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
/* subtle accent tint over the portrait to unify it with the theme */
.profile-photo .tint {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(150deg, rgba(139,212,80,.28) 0%, rgba(139,212,80,0) 42%, rgba(10,12,10,.35) 100%);
  mix-blend-mode: screen; opacity: .65;
}
:root[data-theme="light"] .profile-photo .tint { mix-blend-mode: multiply; opacity: .35; background: linear-gradient(150deg, rgba(90,167,44,.30) 0%, rgba(90,167,44,0) 45%, rgba(255,255,255,.2) 100%); }
.status-dot {
  position: absolute; left: 14px; bottom: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #35d07f; border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px rgba(53,208,127,.3);
}

.profile-name {
  font-family: var(--font-head);
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em;
  margin-top: 18px;
}
.profile-role {
  color: var(--muted);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .18em;
  margin-top: 6px; min-height: 1.4em;
}
html.js .role-static { display: none; } /* with JS, the typewriter renders the role */
.role-rotator { color: var(--muted); }
html:not(.js) .role-rotator::after { display: none; }
.role-rotator::after {
  content: "_"; color: var(--accent); font-weight: 700;
  margin-left: 1px; animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .role-rotator::after { animation: none; } }

.profile-meta { margin: 20px 0 6px; text-align: left; display: grid; gap: 12px; }
.profile-meta li { display: flex; gap: 11px; align-items: center; font-size: .9rem; color: var(--muted); }
.profile-meta svg { width: 30px; height: 30px; flex: 0 0 30px; padding: 7px; fill: var(--accent); background: var(--accent-soft); border-radius: 9px; }
.profile-meta a { color: var(--muted); transition: color .2s var(--ease); word-break: break-word; }
.profile-meta a:hover { color: var(--accent); }

.profile-socials { display: flex; justify-content: center; gap: 10px; margin: 20px 0; }
.social-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 50%; background: transparent;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.social-btn svg { width: 18px; height: 18px; fill: var(--muted); transition: fill .2s var(--ease); }
.social-btn:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--accent-soft); }
.social-btn:hover svg { fill: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 600; font-size: .94rem;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 10px 26px -12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -12px var(--accent-glow); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* =========================================================
   MAIN COLUMN
   ========================================================= */
.main { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 26px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); border-radius: 10px; font-size: 1.05rem;
}
.brand-text { font-size: 1.05rem; letter-spacing: -.01em; }
.dot { color: var(--accent); }

.nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px; font-size: .88rem; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border);
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.nav-link svg { width: 15px; height: 15px; fill: currentColor; opacity: .9; }
.nav-link:hover { color: var(--text); border-color: var(--border-strong); }
.nav-link.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.nav-toggle { display: none; width: 44px; height: 42px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); position: relative; }
.nav-toggle span { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s var(--ease), opacity .2s var(--ease); }
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.nav-toggle span:nth-child(3) { top: 25px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- sections ---------- */
.section {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  scroll-margin-top: 92px;
}
.section-head { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-index { display: none; } /* numbered badges retired in favour of the circle marker */
.section-title {
  position: relative; display: inline-block;
  font-family: var(--font-head); font-weight: 800;
  text-transform: uppercase; letter-spacing: .01em;
  font-size: clamp(1.5rem, 1rem + 1.8vw, 2.15rem); line-height: 1.1;
  padding-left: 6px;
}
/* translucent green circle sitting behind the first letter */
.section-title::before {
  content: ""; position: absolute; left: -10px; top: 50%;
  width: 42px; height: 42px; transform: translateY(-50%);
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 50%; z-index: -1; opacity: .9;
}
.section-note { color: var(--muted); margin-top: 16px; max-width: 60ch; }

/* ---------- hero ---------- */
.hero { padding: clamp(36px, 3vw, 54px) 40px; }
.hero:focus { outline: none; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; }
.hero-title { font-family: var(--font-head); font-weight: 800; letter-spacing: -.03em; line-height: 1.02; font-size: clamp(2.4rem, 1rem + 6vw, 4.4rem); margin: 10px 0 6px; }
.hero-name-line { font-size: clamp(1.1rem, .9rem + 1vw, 1.5rem); color: var(--text); font-weight: 500; margin-bottom: 4px; }
.hero-name-line strong { color: var(--accent); font-weight: 700; }
/* green highlight pill around one word of the big headline */
.hl {
  display: inline-block; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 0 .3em; border-radius: .34em; line-height: 1.05;
  box-shadow: 0 8px 22px -12px var(--accent-glow);
}
.hero-lead { color: var(--muted); max-width: 62ch; margin-top: 18px; font-size: 1.02rem; }
.hero-lead strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.hero-stats > div {
  flex: 1 1 140px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.hero-stats dt { font-family: var(--font-head); font-weight: 800; font-size: 1.8rem; color: var(--accent); }
.hero-stats dd { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; }
.about-text p + p { margin-top: 14px; }
.about-text { color: var(--muted); }
.about-text strong { color: var(--text); font-weight: 600; }
.about-facts { align-self: start; display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.about-facts li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 16px; font-size: .9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.about-facts li:last-child { border-bottom: 0; }
.about-facts span { color: var(--faint); }
.about-facts strong { font-weight: 600; text-align: right; word-break: break-word; }
.about-facts a { color: var(--text); }
.about-facts a:hover { color: var(--accent); }

/* ---------- international reach ---------- */
.intl { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--border); }
.intl-title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 600; }
.intl-title .pin { color: var(--accent); }
.intl-note { color: var(--muted); margin: 8px 0 18px; max-width: 70ch; font-size: .95rem; }
.countries { display: flex; flex-wrap: wrap; gap: 12px; }
.country {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 9px 16px 9px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .92rem; font-weight: 500;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.country:hover { transform: translateY(-2px); border-color: var(--accent); }
.country .flag {
  width: 30px; height: 20px; flex: 0 0 auto; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border-strong); box-shadow: 0 2px 6px rgba(0,0,0,.35);
  background: #fff;
}
.country .flag svg { width: 100%; height: 100%; display: block; }

/* ---------- projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.filter {
  padding: 8px 16px; border-radius: 999px; font-size: .86rem; font-weight: 500;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  transition: all .2s var(--ease);
}
.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter.is-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.project {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.project:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project.is-hidden { display: none; }

.project-shot { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0a0a0e; border-bottom: 1px solid var(--border); }
.project-shot picture { position: absolute; inset: 0; z-index: 1; display: block; }
.project-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .5s var(--ease); }
.project:hover .project-shot img { transform: scale(1.04); }
.project-shot.no-shot picture { display: none; }
.project-shot .ph {
  position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; gap: 8px;
  color: var(--faint); font-size: .82rem; text-align: center; padding: 10px;
  background: repeating-linear-gradient(45deg, #101017, #101017 12px, #13131b 12px, #13131b 24px);
}
.project-shot .ph svg { width: 34px; height: 34px; fill: var(--faint); }
.project-cat {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  background: rgba(11,11,15,.78); backdrop-filter: blur(6px);
  color: var(--accent); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong);
}

.project-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.project-body h3 { font-family: var(--font-head); font-size: 1.12rem; font-weight: 600; }
.project-body p { color: var(--muted); font-size: .9rem; flex: 1; }
.project-link { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 600; font-size: .88rem; margin-top: 4px; }
.project-link svg { width: 15px; height: 15px; fill: currentColor; transition: transform .2s var(--ease); }
.project-link:hover svg { transform: translate(2px, -2px); }

.noscript-projects { display: grid; gap: 10px; }
.noscript-projects li { padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.noscript-projects a { color: var(--accent); font-weight: 500; }

/* ---------- services ---------- */
.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.service { display: flex; flex-direction: column; padding: 28px 24px; transition: transform .25s var(--ease), border-color .25s var(--ease); }
.service:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.service-icon { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); margin-bottom: 18px; }
.service-icon svg { width: 26px; height: 26px; fill: var(--accent); }
.service h3 { font-family: var(--font-head); font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin-bottom: 10px; }
.service p { color: var(--muted); font-size: .92rem; line-height: 1.65; }
/* reserve 2 lines for titles so descriptions line up across a row (multi-column only) */
@media (min-width: 861px) { .service h3 { min-height: 2.6em; } }

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.skill-group { padding: 22px; }
.skill-group h3 { font-family: var(--font-head); font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: .84rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); padding: 6px 13px; border-radius: 9px; transition: border-color .2s var(--ease), color .2s var(--ease); }
.tags li:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- timeline ---------- */
.timeline { position: relative; margin-left: 8px; padding-left: 28px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), transparent); }
.timeline-item { position: relative; }
.timeline-item + .timeline-item { margin-top: 18px; }
.timeline-dot { position: absolute; left: -28px; top: 22px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-card { padding: 22px 24px; background: var(--surface-2); }
.timeline-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.timeline-top h3 { font-family: var(--font-head); font-size: 1.14rem; font-weight: 600; }
.timeline-date { font-size: .82rem; color: var(--accent); font-weight: 600; background: var(--accent-soft); padding: 3px 11px; border-radius: 999px; }
.timeline-org { color: var(--muted); font-weight: 500; margin: 4px 0 12px; }
.timeline-points { display: grid; gap: 7px; }
.timeline-points li { position: relative; padding-left: 20px; color: var(--muted); font-size: .92rem; }
.timeline-points li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- education ---------- */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.edu-card { padding: 24px; }
.edu-meta { color: var(--accent); font-weight: 600; margin-top: 8px; font-size: .9rem; }
.edu-sub { font-family: var(--font-head); font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; }
.edu-projects { display: grid; gap: 14px; }
.edu-projects li { display: grid; gap: 3px; padding-left: 18px; position: relative; }
.edu-projects li::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.edu-projects strong { font-weight: 600; }
.edu-projects span { color: var(--muted); font-size: .88rem; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: start; }
.contact-actions { display: grid; gap: 14px; }
.contact-method { display: flex; align-items: center; gap: 15px; padding: 18px 20px; transition: transform .2s var(--ease), border-color .2s var(--ease); }
.contact-method:hover { transform: translateY(-3px); border-color: var(--accent); }
.cm-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); }
.cm-icon svg { width: 22px; height: 22px; fill: var(--accent); }
.cm-body { display: grid; }
.cm-body strong { font-weight: 600; }
.cm-body span { color: var(--muted); font-size: .88rem; word-break: break-word; }

.contact-form { padding: 24px; }
.form-intro { color: var(--muted); font-size: .92rem; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; min-height: 110px; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.form-status { margin-top: 12px; font-size: .88rem; min-height: 1.2em; }
.form-status.ok { color: #35d07f; }
.form-status.err { color: #ff6b6b; }
.form-status.info { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  text-align: center; padding: 30px; border: 1px solid var(--border);
  border-radius: var(--radius); background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow); display: grid; gap: 14px; justify-items: center;
}
.foot-name { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; }
.foot-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.foot-links a { color: var(--muted); font-size: .9rem; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; transition: all .2s var(--ease); }
.foot-links a:hover { color: var(--accent); border-color: var(--accent); }
.foot-copy { color: var(--faint); font-size: .82rem; }

/* ---------- back to top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 46px; height: 46px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  border-radius: 13px; box-shadow: 0 12px 26px -12px var(--accent-glow);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.to-top svg { width: 22px; height: 22px; fill: currentColor; }
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-2px); }

/* ---------- reveal animation ----------
   Hidden state only applies when JS is active (html.js), so the site
   degrades gracefully: without JavaScript, all content stays visible. */
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
html.js .reveal.in { opacity: 1; transform: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1080px) {
  :root { --gap: 20px; }
  .page { grid-template-columns: 1fr; padding: 18px; }
  .sidebar { position: static; }
  .profile-card { display: grid; grid-template-columns: 180px 1fr; text-align: left; gap: 22px; align-items: center; }
  .profile-photo { aspect-ratio: 4 / 5; }
  .profile-name { margin-top: 0; }
  .profile-meta { margin-top: 14px; }
  .profile-socials { justify-content: flex-start; }
  .btn-block#download-cv { grid-column: 1 / -1; }
  .profile-card > *:not(.profile-photo) { grid-column: 2; }
  .profile-card .profile-photo { grid-row: 1 / span 5; }
}

@media (max-width: 860px) {
  .section { padding: 28px 22px; }
  .hero { padding: 30px 22px; }
  .about-grid, .contact-grid, .edu-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }

  /* collapse profile card back to centered single column on small */
  .profile-card { grid-template-columns: 1fr; text-align: center; }
  .profile-card > *:not(.profile-photo) { grid-column: 1; }
  .profile-card .profile-photo { grid-row: auto; max-width: 240px; margin: 0 auto; width: 100%; }
  .profile-socials { justify-content: center; }
  .profile-meta { max-width: 320px; margin-left: auto; margin-right: auto; }

  /* mobile nav */
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: calc(100% + 10px); right: 0; left: 0;
    flex-direction: column; gap: 4px; padding: 10px;
    background: var(--glass); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
    transform: scale(.98); transform-origin: top right; opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  }
  .nav.open { opacity: 1; visibility: visible; transform: scale(1); }
  .nav-link { width: 100%; }
  .topbar { position: sticky; }
}

@media (max-width: 520px) {
  .page { padding: 12px; }
  .section { padding: 24px 18px; }
  .services-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1 1 100%; }
  .hero-stats > div { flex: 1 1 100%; }
  .profile-card { padding: 20px 18px; }
}

/* =========================================================
   LEFT VERTICAL NAV RAIL
   Hidden by default (mobile uses the top bar + hamburger);
   shown as a fixed left rail on desktop.
   ========================================================= */
.nav-rail { display: none; }
.rail-link {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 6px; border-radius: 14px;
  color: var(--muted); border: 1px solid transparent;
  font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  text-align: center; line-height: 1.15;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.rail-link svg { width: 22px; height: 22px; fill: currentColor; }
.rail-link:hover { color: var(--text); background: var(--surface-2); }
.rail-link.is-active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }

@media (min-width: 1081px) {
  .page { grid-template-columns: 104px var(--sidebar) 1fr; }
  .nav-rail {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 26px; align-self: start;
    padding: 14px 8px;
  }
  .topbar { display: none; }           /* nav lives in the left rail on desktop */
  .section { scroll-margin-top: 30px; } /* no sticky top bar to clear on desktop */
}

/* =========================================================
   MOTION / A11Y PREFERENCES
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html.js .reveal { opacity: 1; transform: none; }
}

/* light-mode safety: this site is intentionally dark, but ensure form controls stay legible */
@media (prefers-color-scheme: light) {
  :root { color-scheme: dark; }
}
