/* =========================================================
   Nishritha Damera · portfolio
   Spine layout · Plus Jakarta Sans
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --paper: #f5f1e8;
  --paper-2: #ece6d9;
  --card: #fbf8f2;
  --spine-bg: #efe9dc;
  --ink: #1c1f26;
  --ink-2: #50535c;
  --rule: #d8cfbd;
  --accent: #a8431c;
  --accent-soft: #f3e3d5;
  --on-accent: #fbf8f2;
  --shadow: 0 1px 0 rgba(28, 31, 38, .04), 0 12px 32px -18px rgba(28, 31, 38, .25);

  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --chapter-gap: clamp(72px, 9vw, 112px);

  --spine-w: 18.5rem;
  --measure: 40rem;
  --content: 58rem;
  --gutter: 16px;
  --bar-h: 64px;
  --r-sm: 6px;
  --r-md: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161b;
    --paper-2: #1d2027;
    --card: #191c22;
    --spine-bg: #111317;
    --ink: #ece5d8;
    --ink-2: #a8a396;
    --rule: #2f333c;
    --accent: #e8875a;
    --accent-soft: #2e1e16;
    --on-accent: #14161b;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 36px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #14161b;
  --paper-2: #1d2027;
  --card: #191c22;
  --spine-bg: #111317;
  --ink: #ece5d8;
  --ink-2: #a8a396;
  --rule: #2f333c;
  --accent: #e8875a;
  --accent-soft: #2e1e16;
  --on-accent: #14161b;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 36px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + var(--s-4));
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 700; color: var(--ink); }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

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

::selection { background: var(--accent); color: var(--on-accent); }

.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: var(--s-4); top: -100px;
  z-index: 100;
  padding: 10px var(--s-4);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: var(--s-3); color: var(--paper); }

/* ---------- Frame: spine + page ---------- */
.frame { min-height: 100vh; }

/* Spine, small screens: a compact top bar with a contents panel */
.spine {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.spine__id {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: var(--s-3);
  align-items: center;
  min-height: var(--bar-h);
  padding: 10px var(--gutter);
}

.spine__name {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-decoration: none;
}
.spine__name:hover { color: var(--ink); }

.spine__role {
  grid-row: 2;
  font-size: .8125rem;
  color: var(--ink-2);
  line-height: 1.35;
}

.spine__toggle {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 var(--s-3) 0 14px;
  font: 600 .875rem/1 var(--font);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.spine__toggle svg { transition: transform .25s var(--ease); }
.spine__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.js .spine__toggle { display: inline-flex; }

.spine__panel { padding: var(--s-1) var(--gutter) var(--s-5); }
.js .spine__panel {
  display: none;
  position: absolute;
  left: 0; right: 0; top: 100%;
  max-height: calc(100vh - var(--bar-h));
  max-height: calc(100dvh - var(--bar-h));
  overflow-y: auto;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding-top: var(--s-5);
}
.js .spine.is-open .spine__panel { display: block; }

.spine__brief {
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 22rem;
}

/* Contents index */
.toc { margin-top: var(--s-6); }
.toc__title {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
  margin-bottom: var(--s-2);
}
.toc__list a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 7px 0;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .2s;
}
.toc__list a::after {
  content: "";
  height: 2px;
  width: 0;
  border-radius: 2px;
  background: var(--accent);
  transition: width .35s var(--ease);
}
.toc__list a:hover { color: var(--ink); }
.toc__list a:hover::after { width: var(--s-3); }
.toc__list a[aria-current] { color: var(--ink); font-weight: 700; }
.toc__list a[aria-current]::after { width: var(--s-5); }

.spine__foot { margin-top: var(--s-6); display: grid; gap: var(--s-4); }

.spine__open {
  font-size: .8125rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 16rem;
}

.spine__links { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); font-size: .875rem; font-weight: 600; }
.spine__links a { text-decoration: underline; text-decoration-color: var(--rule); }
.spine__links a:hover { text-decoration-color: var(--accent); }

/* Theme: Auto / Light / Dark */
.mode {
  display: inline-flex;
  justify-self: start;
  padding: 3px;
  gap: 2px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.mode__btn {
  min-height: 34px;
  padding: 0 var(--s-3);
  font: 600 .8125rem/1 var(--font);
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.mode__btn:hover { color: var(--ink); }
.mode__btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Spine, wide screens: a fixed identity column */
@media (min-width: 1024px) {
  :root { --gutter: 32px; }
  html { scroll-padding-top: var(--s-6); }

  .frame {
    display: grid;
    grid-template-columns: var(--spine-w) minmax(0, 1fr);
  }

  .spine {
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--spine-bg);
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    padding: 40px var(--s-6) var(--s-6);
  }

  .spine__id { display: block; flex-shrink: 0; min-height: 0; padding: 0; }
  .spine__name { font-size: 1.375rem; line-height: 1.15; display: inline-block; }
  .spine__role { margin-top: 6px; font-size: .875rem; }
  .js .spine__toggle { display: none; }

  .spine__panel,
  .js .spine__panel {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .spine__brief { margin-top: var(--s-4); font-size: .875rem; }
  .toc { margin-top: var(--s-6); }
  .toc__list a { padding: 5px 0; }
  .spine__foot { margin-top: auto; padding-top: var(--s-6); gap: 14px; }
}
@media (min-width: 1024px) and (max-height: 760px) {
  .spine { padding-top: 28px; padding-bottom: var(--s-5); }
  .spine__brief { display: none; }
}

/* ---------- Page column ---------- */
.page {
  padding: 0 var(--gutter);
  min-width: 0;
}
.page > * { max-width: var(--content); }

@media (min-width: 1024px) {
  .page { padding: 0 clamp(40px, 6vw, 96px); }
}

/* ---------- Opening ---------- */
.opening {
  padding: clamp(56px, 11vw, 136px) 0 0;
}
.opening__title {
  font-size: clamp(2.125rem, 1.4rem + 3.2vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.035em;
  max-width: 20ch;
  text-wrap: balance;
}
.opening__lede {
  margin-top: var(--s-5);
  max-width: var(--measure);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.7;
  color: var(--ink-2);
}
.opening__actions {
  margin-top: var(--s-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 20px;
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--ink);
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:hover { color: var(--accent); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }

/* ---------- Chapters ---------- */
.chapter { padding-top: var(--chapter-gap); }
.chapter--last { padding-bottom: var(--chapter-gap); }

.chapter__head {
  margin-bottom: var(--s-6);
  max-width: var(--measure);
}
.chapter__head h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -.03em;
}
.chapter__dek {
  margin-top: var(--s-2);
  color: var(--ink-2);
  font-size: 1rem;
}

/* ---------- Margin notes ---------- */
.noted { display: grid; gap: var(--s-5); }

.note {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  padding-left: var(--s-4);
  border-left: 2px solid var(--accent);
  max-width: 28rem;
}
.note__fig {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--accent);
  margin-bottom: var(--s-2);
}

@media (min-width: 1280px) {
  .noted {
    grid-template-columns: minmax(0, 1fr) 12rem;
    column-gap: var(--s-7);
    align-items: start;
  }
  .note {
    border-left: 0;
    padding: var(--s-3) 0 0;
    border-top: 2px solid var(--accent);
    font-size: .9375rem;
    position: sticky;
    top: 40px;
  }
}

/* ---------- Practice ---------- */
.prose { max-width: var(--measure); display: grid; gap: var(--s-4); color: var(--ink-2); }
.prose__big {
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: var(--s-1);
}

/* The layers a release is checked at */
.layers { margin-top: var(--s-7); }
.layers__cap {
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: var(--s-4);
}
.layers__list {
  display: grid;
  grid-template-columns: 1fr;
  border-left: 2px solid var(--rule);
}
.layers__list li {
  position: relative;
  display: grid;
  gap: 2px;
  padding: var(--s-3) 0 var(--s-3) 20px;
}
.layers__list li::before {
  content: "";
  position: absolute;
  left: -6px; top: 20px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.layers__list li:last-child::before { background: var(--accent); }
.layers__name { font-size: 1rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.layers__what { font-size: .875rem; color: var(--ink-2); line-height: 1.5; }

@media (min-width: 640px) {
  .layers__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-left: 0;
    gap: 28px 20px;
  }
  .layers__list li {
    padding: 18px 0 0;
    border-top: 2px solid var(--rule);
  }
  .layers__list li::before { left: 0; top: -6px; }
}
@media (min-width: 1400px) {
  .layers__list { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
  .layers__list li { padding-right: 18px; }
}

/* ---------- Shared card ---------- */
.project,
.kit__set,
.build,
.cert,
.reach__item {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

/* ---------- Experience ---------- */
.exp { display: grid; gap: var(--s-8); }

/* One block per company */
.company { display: grid; gap: var(--s-5); }
.company__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 2px solid var(--ink);
}
.company__name {
  font-size: clamp(1.375rem, 1.2rem + .7vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -.025em;
}
.company__role {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
}
.company__when {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* One card per project */
.project {
  display: grid;
  gap: var(--s-5);
  padding: var(--s-5);
}
@media (min-width: 640px) {
  .project { padding: var(--s-6); }
}
.project__tag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--accent);
}
.badge {
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}
.project__name {
  margin-top: 6px;
  font-size: clamp(1.1875rem, 1.1rem + .3vw, 1.375rem);
  line-height: 1.3;
  letter-spacing: -.02em;
}
.project__about {
  margin-top: var(--s-3);
  color: var(--ink-2);
  max-width: var(--measure);
}

.project__scale {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-6);
}
.project__scale span {
  display: grid;
  font-size: .8125rem;
  color: var(--ink-2);
}
.project__scale strong {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* Project points: a plain bulleted list */
.points {
  display: grid;
  gap: var(--s-3);
  padding-left: 1.25rem;
  list-style: disc;
  color: var(--ink-2);
}
.points li { padding-left: 4px; max-width: var(--measure); }
.points li::marker { color: var(--accent); }
.points strong { color: var(--ink); font-weight: 700; }

.project .tags { padding-top: var(--s-4); border-top: 1px solid var(--rule); }

/* ---------- Skills ---------- */
.kit { display: grid; gap: var(--s-4); }
.kit__set { padding: 20px; }
.kit__set h3 {
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin-bottom: var(--s-3);
}
.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tags li {
  padding: 4px 10px;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper-2);
  border-radius: var(--r-sm);
}
@media (min-width: 700px) {
  .kit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Side builds ---------- */
.builds { display: grid; gap: var(--s-4); }
.build {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  color: var(--ink-2);
}
.build__name {
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -.02em;
}
.build__stack { font-size: .8125rem; font-weight: 600; color: var(--accent); }
.build__stack span { color: var(--ink-2); margin: 0 2px; }
.build__links {
  margin-top: auto;
  padding-top: var(--s-2);
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: .9375rem;
}
.build__links a { color: var(--ink); text-decoration: none; }
.build__links a::after { content: " \2192"; color: var(--accent); }
.build__links a:hover { color: var(--accent); text-decoration: underline; }

@media (min-width: 1100px) {
  .builds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Accreditation: an even grid of identical cards ---------- */
.certs {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  gap: var(--s-4);
}
.cert {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-5);
}
.cert__issuer { font-size: .8125rem; font-weight: 600; color: var(--accent); }
.cert__name {
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -.015em;
}
.cert__date { font-size: .875rem; color: var(--ink-2); line-height: 1.5; }
.cert__link {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  transition: border-color .2s, color .2s;
}
.cert__link::after { content: "\2192"; color: var(--accent); }
.cert__link:hover { color: var(--accent); border-color: var(--accent); }
/* Breathing room above the link even when a card has no date line */
.cert > :nth-last-child(2) { margin-bottom: var(--s-4); }

@media (min-width: 640px) {
  /* Two columns: every card shares one height */
  .certs { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
}

/* ---------- Study ---------- */
.degree {
  display: grid;
  gap: 6px;
  max-width: var(--measure);
}
.degree__years {
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.degree__name {
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  line-height: 1.3;
  letter-spacing: -.02em;
}
.degree__school { margin-top: var(--s-1); color: var(--ink-2); }
.degree__honour {
  display: inline-block;
  margin-top: var(--s-3);
  padding: 4px var(--s-3);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-2);
  border-radius: var(--r-sm);
}

/* ---------- Write to me ---------- */
.invite {
  font-size: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.025em;
  max-width: 30ch;
  text-wrap: balance;
}

.reach {
  margin-top: var(--s-6);
  display: grid;
  gap: var(--s-3);
}
.reach__item {
  display: grid;
  gap: var(--s-1);
  height: 100%;
  padding: 20px;
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.reach__item:hover { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.reach__via { font-size: .8125rem; font-weight: 600; color: var(--accent); }
.reach__addr {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
@media (min-width: 900px) {
  .reach { grid-template-columns: 1.4fr 1fr 1fr; }
}

/* ---------- Colophon ---------- */
.colophon {
  display: grid;
  gap: var(--s-1);
  padding: 28px 0 40px;
  border-top: 1px solid var(--rule);
  font-size: .8125rem;
  color: var(--ink-2);
}

/* ---------- Motion ---------- */
.js .rise {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.js .rise.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
  .js .rise { opacity: 1; transform: none; }
  .product:hover { transform: none; }
}
