/* =========================================================
   Prabodh Tuladhar — Portfolio
   Palette: earthy (sand / forest / terracotta)
   Type:    Fraunces (display), IBM Plex Sans (body), JetBrains Mono (code)
   ========================================================= */

/* -------- Reset -------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* -------- Tokens -------- */
:root {
  /* Earthy palette */
  --sand-bg:         #F4ECDE;
  --sand-raised:     #EADFC8;
  --sand-card:       #FBF5E9;
  --sand-line:       #DDCEB1;

  --forest-ink:      #1B2A22;
  --forest-mid:      #3E5448;
  --forest-soft:     #6B7E72;

  --terracotta:      #C2603E;
  --terracotta-dark: #9D4826;
  --terracotta-soft: #EBC9B5;
  --terracotta-tint: #F5E0D1;

  /* Type */
  --ff-display: "Fraunces", ui-serif, Georgia, serif;
  --ff-body:    "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --ff-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Scale */
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;

  /* Layout */
  --sidebar-w: 300px;
  --main-max:  720px;
  --gutter:    clamp(1.25rem, 4vw, 3rem);

  /* Motion */
  --ease:      cubic-bezier(.2, .7, .3, 1);
}

/* -------- Base -------- */
html { font-size: 16px; }
body {
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--forest-ink);
  background: var(--sand-bg);
  /* Subtle warm atmosphere */
  background-image:
    radial-gradient(at 85% 0%, rgba(194, 96, 62, 0.07) 0%, transparent 45%),
    radial-gradient(at 5% 95%, rgba(62, 84, 72, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono  { font-family: var(--ff-mono); font-size: 0.9em; letter-spacing: -0.01em; }
.prose p + p { margin-top: 1rem; }
.prose a {
  color: var(--terracotta-dark);
  border-bottom: 1px solid var(--terracotta-soft);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.prose a:hover { color: var(--terracotta); border-color: var(--terracotta); }

::selection { background: var(--terracotta); color: var(--sand-card); }

/* -------- Layout -------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ==========================================================
   SIDEBAR
   ========================================================== */
.sidebar {
  background: var(--sand-raised);
  border-right: 1px solid var(--sand-line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar__inner {
  padding: 2.5rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 2rem;
}

.sidebar__identity {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sidebar__avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sand-card);
  box-shadow: 0 4px 16px rgba(27, 42, 34, 0.12);
  margin-bottom: .5rem;
}
.sidebar__name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest-ink);
  font-variation-settings: "opsz" 48;
}
.sidebar__tagline {
  font-size: var(--fs-sm);
  color: var(--terracotta-dark);
  font-weight: 500;
  letter-spacing: .005em;
}
.sidebar__location {
  font-size: var(--fs-xs);
  color: var(--forest-soft);
  margin-top: .25rem;
}
.sidebar__location .mono { color: var(--terracotta); }

/* Nav */
.sidebar__nav { margin-top: .5rem; }
.sidebar__nav ul { display: flex; flex-direction: column; gap: .125rem; }
.sidebar__nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .55rem .75rem;
  border-radius: 4px;
  color: var(--forest-mid);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.sidebar__nav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 2px;
  height: 60%;
  background: var(--terracotta);
  transform-origin: center;
  transition: transform .25s var(--ease);
}
.sidebar__nav a:hover {
  color: var(--forest-ink);
  background: rgba(194, 96, 62, 0.06);
}
.sidebar__nav a.is-active {
  color: var(--forest-ink);
  background: var(--terracotta-tint);
}
.sidebar__nav a.is-active::before {
  transform: translateY(-50%) scaleY(1);
}
.sidebar__nav a.is-active .nav-num {
  color: var(--terracotta-dark);
}
.nav-num {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--forest-soft);
  font-weight: 500;
  min-width: 1.4rem;
  transition: color .2s var(--ease);
}
.nav-label {
  letter-spacing: .005em;
}

/* Sidebar links (icons) */
.sidebar__links {
  display: flex;
  gap: .75rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--sand-line);
  margin-top: auto;
}
.sidebar__links a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--forest-mid);
  border: 1px solid var(--sand-line);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.sidebar__links a:hover {
  color: var(--terracotta-dark);
  border-color: var(--terracotta);
  transform: translateY(-2px);
}

/* Download CV */
.sidebar__cv {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .85rem;
  border: 1px solid var(--forest-mid);
  color: var(--forest-ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: 2px;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  align-self: flex-start;
}
.sidebar__cv:hover {
  background: var(--forest-ink);
  color: var(--sand-card);
  border-color: var(--forest-ink);
}
.sidebar__cv .mono { color: var(--terracotta); transition: color .2s var(--ease); }
.sidebar__cv:hover .mono { color: var(--terracotta-soft); }

/* ==========================================================
   MAIN
   ========================================================== */
.main {
  padding: 4.5rem var(--gutter) 3rem;
  max-width: calc(var(--main-max) + var(--gutter) * 2);
}

/* -------- Hero -------- */
.hero {
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--sand-line);
  margin-bottom: 4rem;
  animation: heroRise .7s var(--ease) both;
}
.hero__prompt {
  color: var(--terracotta-dark);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}
.hero__prompt::after {
  content: "▊";
  display: inline-block;
  margin-left: .2em;
  color: var(--forest-mid);
  animation: blink 1.1s steps(2, start) infinite;
}
.hero__headline {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.2vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--forest-ink);
  font-variation-settings: "opsz" 144;
  margin-bottom: 1.5rem;
}
.hero__headline .amp {
  font-style: italic;
  font-weight: 400;
  color: var(--terracotta-dark);
}
.hero__accent {
  position: relative;
  display: inline-block;
  color: var(--forest-ink);
  font-style: italic;
  font-weight: 400;
}
.hero__accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 4%;
  height: 10px;
  background: var(--terracotta-soft);
  z-index: -1;
  border-radius: 2px;
  transform: skewX(-4deg);
}
.hero__lead {
  font-size: var(--fs-lg);
  color: var(--forest-mid);
  max-width: 34em;
  margin-bottom: 2rem;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 2.25rem;
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: .8rem;
  color: var(--forest-soft);
  padding-top: 1.5rem;
  border-top: 1px dashed var(--sand-line);
}
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--terracotta);
  border-radius: 50%;
  margin-right: .3em;
  box-shadow: 0 0 0 0 var(--terracotta);
  animation: pulse 2.2s var(--ease) infinite;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* -------- Buttons -------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.25rem;
  border-radius: 2px;
  font-weight: 500;
  font-size: var(--fs-sm);
  letter-spacing: .005em;
  transition: transform .2s var(--ease), background .2s var(--ease),
              color .2s var(--ease), border-color .2s var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--forest-ink);
  color: var(--sand-card);
  border: 1px solid var(--forest-ink);
}
.btn--primary:hover {
  background: var(--terracotta-dark);
  border-color: var(--terracotta-dark);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--forest-ink);
  border: 1px solid var(--sand-line);
}
.btn--ghost:hover {
  border-color: var(--forest-ink);
  transform: translateY(-1px);
}
.btn--ghost .mono { color: var(--terracotta-dark); transition: transform .2s var(--ease); }
.btn--ghost:hover .mono { transform: translateX(3px); }
.btn--full { width: 100%; justify-content: center; padding: .9rem 1.25rem; }

/* ==========================================================
   SECTIONS
   ========================================================== */
.section {
  padding: 3rem 0 3.5rem;
  scroll-margin-top: 2rem;
}
.section__head {
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.section__num {
  color: var(--terracotta-dark);
  font-size: .8rem;
  font-weight: 500;
}
.section__title {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.9rem;
  color: var(--forest-ink);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 72;
}
.section__title::after {
  content: "";
  display: inline-block;
  width: 3rem;
  height: 1px;
  background: var(--forest-mid);
  margin-left: 1rem;
  vertical-align: middle;
  opacity: .5;
}
.section__intro {
  color: var(--forest-mid);
  max-width: 40em;
  margin-bottom: 1.75rem;
}

/* -------- Skills -------- */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem 2rem;
}
.skills__group {
  padding-top: 1rem;
  border-top: 1px solid var(--sand-line);
}
.skills__label {
  text-transform: lowercase;
  color: var(--terracotta-dark);
  font-size: .75rem;
  letter-spacing: .02em;
  font-weight: 500;
  margin-bottom: .75rem;
}
.skills__list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.skills__list li {
  font-size: var(--fs-sm);
  padding: .3rem .65rem;
  background: var(--sand-card);
  border: 1px solid var(--sand-line);
  border-radius: 2px;
  color: var(--forest-ink);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.skills__list li:hover {
  border-color: var(--terracotta);
  color: var(--terracotta-dark);
}

/* -------- Experience timeline -------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  border-left: 1px solid var(--sand-line);
  padding-left: 1.5rem;
  position: relative;
}
.role { position: relative; }
.role::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 5px);
  top: .55rem;
  width: 9px; height: 9px;
  background: var(--sand-bg);
  border: 2px solid var(--terracotta);
  border-radius: 50%;
}
.role__dates {
  color: var(--forest-soft);
  font-size: .75rem;
  margin-bottom: .35rem;
  letter-spacing: .01em;
}
.role__title {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--forest-ink);
  letter-spacing: -0.005em;
  margin-bottom: .75rem;
  line-height: 1.3;
}
.role__at {
  color: var(--terracotta-dark);
  font-weight: 400;
  font-style: italic;
}
.role__bullets { display: flex; flex-direction: column; gap: .55rem; }
.role__bullets li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--forest-mid);
  font-size: .95rem;
  line-height: 1.55;
}
.role__bullets li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--terracotta);
  font-family: var(--ff-mono);
  font-weight: 500;
}
.role__bullets em {
  color: var(--forest-ink);
  font-style: normal;
  font-weight: 500;
}

/* -------- Projects -------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.project {
  padding: 1.5rem;
  background: var(--sand-card);
  border: 1px solid var(--sand-line);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color .25s var(--ease), transform .25s var(--ease),
              box-shadow .25s var(--ease);
}
.project:hover {
  border-color: var(--terracotta);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px -12px rgba(27, 42, 34, 0.18);
}
.project__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.project__title {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--forest-ink);
  line-height: 1.3;
}
.project__link {
  color: var(--terracotta-dark);
  font-size: .75rem;
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
  white-space: nowrap;
}
.project__link:hover { border-color: var(--terracotta); }
.project__link span { transition: transform .2s var(--ease); display: inline-block; }
.project__link:hover span { transform: translateX(3px); }
.project__desc {
  font-size: .9rem;
  color: var(--forest-mid);
  line-height: 1.55;
}
.placeholder {
  display: inline-block;
  font-style: italic;
  color: var(--forest-soft);
  font-size: .8rem;
  margin-right: .25em;
  padding: .05em .4em;
  background: var(--sand-raised);
  border-radius: 2px;
}
.project__stack {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px dashed var(--sand-line);
}
.project__stack li {
  font-size: .7rem;
  color: var(--forest-soft);
  padding: .2rem .5rem;
  background: var(--sand-bg);
  border-radius: 2px;
}

/* -------- Writing -------- */
.writing {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--sand-line);
}
.post a {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--sand-line);
  transition: padding .2s var(--ease);
}
.post a:hover {
  padding-left: .75rem;
  padding-right: .25rem;
}
.post__platform {
  font-size: .7rem;
  color: var(--terracotta-dark);
  text-transform: lowercase;
  letter-spacing: .04em;
  font-weight: 500;
}
.post__title {
  font-size: var(--fs-md);
  color: var(--forest-ink);
  line-height: 1.4;
  transition: color .2s var(--ease);
}
.post a:hover .post__title { color: var(--terracotta-dark); }
.post__arrow {
  color: var(--forest-soft);
  transition: transform .2s var(--ease), color .2s var(--ease);
}
.post a:hover .post__arrow {
  transform: translate(3px, -3px);
  color: var(--terracotta);
}

/* -------- Contact -------- */
.contact__lead {
  color: var(--forest-mid);
  max-width: 40em;
  margin-bottom: 2rem;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 540px;
  margin-bottom: 2.5rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label {
  font-family: var(--ff-mono);
  font-size: .7rem;
  color: var(--forest-soft);
  text-transform: lowercase;
  letter-spacing: .03em;
}
.field input,
.field textarea {
  font-family: var(--ff-body);
  font-size: var(--fs-md);
  color: var(--forest-ink);
  padding: .7rem .85rem;
  background: var(--sand-card);
  border: 1px solid var(--sand-line);
  border-radius: 2px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
  width: 100%;
  resize: vertical;
  min-height: unset;
}
.field textarea { min-height: 120px; line-height: 1.5; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  background: #fff;
}
.contact-form__status {
  font-size: .85rem;
  color: var(--terracotta-dark);
  min-height: 1.2em;
  font-family: var(--ff-mono);
}
.contact-form__status.is-success { color: var(--forest-mid); }
.contact-form__status.is-error   { color: var(--terracotta-dark); }

.contact-direct {
  padding-top: 1.5rem;
  border-top: 1px dashed var(--sand-line);
}
.contact-direct p { color: var(--terracotta-dark); margin-bottom: .5rem; font-size: .8rem; }
.contact-direct ul { display: flex; flex-direction: column; gap: .3rem; }
.contact-direct a {
  color: var(--forest-ink);
  font-size: .95rem;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.contact-direct a:hover {
  color: var(--terracotta-dark);
  border-color: var(--terracotta-soft);
}

/* -------- Footer -------- */
.footer {
  padding: 2.5rem 0 1rem;
  margin-top: 3rem;
  border-top: 1px solid var(--sand-line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--forest-soft);
  font-size: .75rem;
}

/* ==========================================================
   MOBILE BAR
   ========================================================== */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--sand-raised);
  border-bottom: 1px solid var(--sand-line);
}
.mobile-bar__name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--forest-ink);
}
.mobile-bar__toggle {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--sand-line);
  border-radius: 2px;
  background: var(--sand-card);
}
.mobile-bar__toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--forest-ink);
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.mobile-bar__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.mobile-bar__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.mobile-bar__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */
@keyframes heroRise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(194, 96, 62, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(194, 96, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(194, 96, 62, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 960px) {
  :root { --sidebar-w: 260px; }
  .main { padding-top: 3.5rem; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .mobile-bar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 90vw);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    z-index: 60;
    box-shadow: 8px 0 28px rgba(27, 42, 34, 0.15);
  }
  .sidebar.is-open { transform: translateX(0); }

  .main {
    padding: 2.5rem 1.25rem 2rem;
    max-width: 100%;
  }

  .section { padding: 2.5rem 0; }
  .hero { padding-bottom: 3rem; margin-bottom: 3rem; }
  .section__title { font-size: 1.6rem; }
  .post a { grid-template-columns: 90px 1fr auto; gap: .75rem; }
  .post__title { font-size: .95rem; }
  .hero__cta { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }

  /* Scrim when sidebar open */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(27, 42, 34, 0.4);
    z-index: 55;
    animation: fadeIn .25s var(--ease) both;
  }
}

@media (max-width: 480px) {
  .hero__meta { flex-direction: column; gap: .5rem; }
  .section__head { flex-direction: column; gap: .25rem; align-items: flex-start; }
  .section__title::after { display: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
