/* ===========================================================
   Sougat Thapa — Portfolio
   Design tokens, layout, components. Light + dark themes.
   =========================================================== */

:root {
  --brand:      #0078D4;   /* Azure blue  */
  --brand-600:  #106EBE;
  --brand-700:  #005A9E;
  --accent:     #50E6FF;   /* Azure cyan  */

  --bg:         #ffffff;
  --bg-muted:   #f4f7fb;
  --surface:    #ffffff;
  --border:     #e3e8ef;
  --text:       #1b2733;
  --text-soft:  #5a6b7b;
  --shadow:     0 8px 30px rgba(16, 42, 67, 0.08);

  --radius:     16px;
  --radius-sm:  10px;
  --maxw:       1080px;
  --gap:        clamp(1rem, 2.5vw, 2rem);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg:        #0d1117;
  --bg-muted:  #121a24;
  --surface:   #161f2b;
  --border:    #263143;
  --text:      #e6edf3;
  --text-soft: #9fb0c3;
  --shadow:    0 10px 34px rgba(0, 0, 0, 0.45);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff; font-size: .85rem; font-weight: 800;
}

.nav__menu { display: flex; align-items: center; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.nav__link {
  color: var(--text-soft); font-weight: 500; padding: .5rem .8rem; border-radius: 8px; font-size: .95rem;
  transition: color .2s, background .2s;
}
.nav__link:hover { color: var(--text); background: var(--bg-muted); text-decoration: none; }
.nav__link.is-active { color: var(--brand-600); background: color-mix(in srgb, var(--brand) 12%, transparent); }

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; margin-left: .3rem;
  background: var(--bg-muted); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--brand); }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px;
  background: none; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; padding: 0 10px;
}
.nav__toggle span { height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .25s; }
.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;
  padding: .72rem 1.2rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff; box-shadow: var(--shadow); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-600); }

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0; }
.hero__inner { display: grid; grid-template-columns: 1.35fr .9fr; gap: var(--gap); align-items: center; }
.hero__eyebrow { color: var(--brand-600); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; margin: 0 0 .4rem; }
.hero__title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 800; }
.hero__lead { color: var(--text-soft); font-size: clamp(1rem, 1.5vw, 1.15rem); max-width: 46ch; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 1.4rem; list-style: none; padding: 0; margin: 1.4rem 0; }
.hero__facts li { color: var(--text-soft); font-size: .9rem; }
.hero__facts strong { display: block; color: var(--text); font-size: 1.35rem; font-weight: 800; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.2rem; }
.hero__social { display: flex; gap: 1.1rem; }
.hero__social a { color: var(--text-soft); font-weight: 500; font-size: .95rem; }
.hero__social a:hover { color: var(--brand-600); }

.hero__avatar { display: grid; place-items: center; gap: 1rem; }
.avatar {
  width: clamp(160px, 20vw, 230px); aspect-ratio: 1; border-radius: 30px;
  display: grid; place-items: center; font-size: clamp(3.4rem, 6vw, 5rem); font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-700) 60%, var(--accent));
  box-shadow: var(--shadow); position: relative; isolation: isolate;
}
.avatar::after {
  content: ""; position: absolute; inset: -3px; border-radius: 33px; z-index: -1;
  background: linear-gradient(135deg, var(--accent), transparent 60%); filter: blur(14px); opacity: .55;
}
.avatar__badge {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  padding: .35rem .8rem; border-radius: 999px; font-size: .85rem; box-shadow: var(--shadow);
}

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section--muted { background: var(--bg-muted); }
.section__title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; position: relative; padding-bottom: .5rem; margin-bottom: 1.6rem; }
.section__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 54px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.prose { color: var(--text-soft); max-width: 68ch; font-size: 1.05rem; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--gap); }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.skill-card h3 { font-size: 1.02rem; margin-bottom: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.chip {
  font-size: .82rem; padding: .35rem .7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand-600); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); font-weight: 500;
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding: 0 0 1.8rem 2.2rem; }
.timeline__item::before {
  content: ""; position: absolute; left: 2px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--brand);
}
.timeline__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; margin-bottom: .5rem; }
.timeline__head h3 { font-size: 1.12rem; margin: 0; }
.timeline__org { color: var(--brand-600); font-weight: 600; }
.timeline__date { color: var(--text-soft); font-size: .88rem; margin-left: auto; }
.timeline__points { margin: 0; padding-left: 1.1rem; color: var(--text-soft); }
.timeline__points li { margin-bottom: .35rem; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, border-color .18s;
}
.card:hover { transform: translateY(-4px); border-color: var(--brand); }
.card__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.card__badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .25rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--brand-700); }
html[data-theme="dark"] .card__badge { color: var(--accent); }
.card h3 { font-size: 1.1rem; }
.card__desc { color: var(--text-soft); font-size: .96rem; flex: 1; }
.card__tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0; }
.card__link { font-weight: 600; align-self: flex-start; }
.card__link::after { content: " →"; }

/* ---------- Education ---------- */
.edu { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.edu__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.edu__item h3 { font-size: 1.05rem; }
.edu__org { color: var(--text); font-weight: 500; margin: .2rem 0; }
.edu__date { color: var(--text-soft); font-size: .88rem; margin: 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); margin-top: 1.4rem; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .25rem;
  transition: transform .18s, border-color .18s; color: var(--text);
}
.contact-card:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; }
.contact-card__label { color: var(--text-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.contact-card__value { font-weight: 600; word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 1.6rem 0; background: var(--bg); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: .9rem; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none; font-size: 1.2rem; cursor: pointer;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s; z-index: 90;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--brand-700); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__facts, .hero__cta, .hero__social { justify-content: center; }
  .hero__lead { margin-inline: auto; }
  .hero__avatar { order: -1; }

  .nav__toggle { display: flex; }
  .nav__menu {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: .6rem 1rem 1.2rem;
    transform: translateY(-140%); transition: transform .3s ease; box-shadow: var(--shadow);
  }
  .nav__menu.is-open { transform: translateY(0); }
  .nav__link { display: block; padding: .8rem .6rem; }
  .theme-toggle { margin: .4rem 0 0; width: 100%; height: 44px; }
  .timeline__date { margin-left: 0; }
}
