/* ═══════════════════════════════════════════════════════════════════
   Manjil Aryal — portfolio
   Layout idea: an annotated page. Wide reading column for prose,
   narrow margin column beside it carrying the portrait and the facts.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --stone:    #E6E4DE;   /* page */
  --paper:    #F3F2EE;   /* raised surface */
  --ink:      #000000;   /* text */
  --graphite: #56544E;   /* secondary text */
  --hairline: #C9C6BD;   /* rules */
  --marigold: #E0A21A;   /* the one accent */

  --measure: 34rem;      /* ~68 characters of Newsreader */
  --gutter:  clamp(1.25rem, 4vw, 4.5rem);
  --margin-col: 15rem;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.6rem, 1.35rem + 1.2vw, 2.4rem);
  --step-3:  clamp(2.2rem, 1.6rem + 2.8vw, 4rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --stone:    #121210;
  --paper:    #1B1B18;
  --ink:      #F2F1ED;
  --graphite: #9A978E;
  --hairline: #343330;
  --marigold: #F0B537;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

body {
  background: var(--stone);
  color: var(--ink);
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-size: var(--step-0);
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

p + p { margin-top: 1.1em; }

a { color: inherit; }

::selection { background: var(--marigold); color: #000; }

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--stone);
  padding: .6rem 1rem; z-index: 100;
  font-family: Archivo, system-ui, sans-serif; font-size: var(--step--1);
}
.skip:focus { left: 1rem; top: 1rem; }

:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 3px;
}

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .85rem var(--gutter);
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  font-variation-settings: 'wdth' 100, 'wght' 500;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color .35s linear, background-color .35s var(--ease);
}
/* Over the hero the bar is bare; past it, it gains a surface. */
.topbar.is-visible {
  background: color-mix(in srgb, var(--stone) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--hairline);
}

.topbar__name { text-decoration: none; font-variation-settings: 'wdth' 100, 'wght' 700; }

.topbar__nav { display: flex; gap: 1.25rem; margin-left: auto; }
.topbar__nav a {
  text-decoration: none; color: var(--graphite);
  position: relative; padding-bottom: 2px;
  transition: color .2s linear;
}
.topbar__nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.topbar__nav a:hover, .topbar__nav a.is-current { color: var(--ink); }
.topbar__nav a:hover::after, .topbar__nav a.is-current::after { transform: none; }

.theme {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; color: var(--graphite);
  background: none; border: 0; padding: .2rem .1rem; cursor: pointer;
}
.theme:hover { color: var(--ink); }
.theme__dot {
  width: .72rem; height: .72rem; border-radius: 50%;
  border: 1px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* ── Shared layout: the annotated sheet ──────────────────────────── */
.band { padding: clamp(3.5rem, 8vw, 7rem) var(--gutter); }
.band--rule { border-top: 1px solid var(--hairline); }

/* Keep anchored headings clear of the fixed bar */
:target, [id] { scroll-margin-top: 5.5rem; }

.band__title {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-1);
  font-variation-settings: 'wdth' 94, 'wght' 600;
  letter-spacing: -0.01em;
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
  max-width: 60rem; margin-inline: auto;
  display: flex; align-items: baseline; gap: .9rem;
}
.band__num {
  font-size: var(--step--1);
  font-variation-settings: 'wdth' 100, 'wght' 600;
  font-variant-numeric: tabular-nums;
  /* graphite, not marigold: this is text, and marigold fails contrast as text */
  color: var(--graphite);
}

.sheet {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, var(--measure));
  gap: clamp(1.5rem, 4vw, 3.5rem);
  max-width: 60rem; margin-inline: auto;
  align-items: start;
}
.sheet + .sheet { margin-top: clamp(3rem, 6vw, 5rem); }

.column > * + * { margin-top: 1.1em; }

/* ── Margin column ───────────────────────────────────────────────── */
.margin {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--graphite);
  position: sticky; top: 5rem;
}
.margin > * + * { margin-top: .85rem; }

.margin__role {
  color: var(--ink);
  font-variation-settings: 'wdth' 100, 'wght' 650;
}
.margin__note { text-wrap: pretty; }

.margin__facts { display: grid; gap: .4rem; }
.margin__facts li {
  padding-left: .85rem; position: relative;
  font-variant-numeric: tabular-nums;
}
.margin__facts li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: .3rem; height: .3rem; background: var(--marigold);
}
.margin__facts b {
  color: var(--ink);
  font-variation-settings: 'wdth' 100, 'wght' 700;
}

.margin__stack {
  padding-top: .75rem;
  border-top: 1px solid var(--hairline);
  line-height: 1.7;
}

/* ── Portrait ────────────────────────────────────────────────────── */
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--hairline);
  filter: grayscale(1) contrast(1.02);
}
/* Grayscale on a dark page wants a touch less glare. */
html[data-theme="dark"] .portrait img { filter: grayscale(1) brightness(.88) contrast(1.05); }

/* ── Project images ──────────────────────────────────────────────── */
.shot {
  margin-top: 1.6rem !important;
  background: var(--paper);
  border: 1px solid var(--hairline);
  padding: clamp(.9rem, 3vw, 1.6rem);
}
.shot img { width: 100%; }
.shot figcaption {
  margin-top: .9rem;
  padding-top: .7rem;
  border-top: 1px solid var(--hairline);
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--graphite);
  text-wrap: pretty;
}

/* A slot waiting for an image. Deliberate, not broken. */
.shot__empty {
  display: grid; place-content: center; gap: .5rem; justify-items: center;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--hairline);
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  color: var(--graphite);
  text-align: center; padding: 1rem;
}
.shot__empty span { font-variation-settings: 'wdth' 100, 'wght' 600; color: var(--ink); }
.shot__empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  padding: .2rem .45rem;
  border: 1px solid var(--hairline);
  background: var(--stone);
}

/* ── Prose ───────────────────────────────────────────────────────── */
.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  text-wrap: pretty;
}

/* ── Work entries ────────────────────────────────────────────────── */
.entry__name {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-2);
  font-variation-settings: 'wdth' 100, 'wght' 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.entry__sub {
  font-size: var(--step-1);
  color: var(--graphite);
  font-style: italic;
  text-wrap: pretty;
  margin-top: .45em !important;
}
.entry .column > p:not(.entry__sub) { margin-top: 1.1em; }

.entry__aside {
  font-size: var(--step--1);
  font-family: Archivo, system-ui, sans-serif;
  color: var(--graphite);
  border-left: 2px solid var(--marigold);
  padding-left: .9rem;
  margin-top: 1.6em !important;
}

/* ── Smaller pieces ──────────────────────────────────────────────── */
.also { display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.also__item { padding: 1.4rem 0; border-bottom: 1px solid var(--hairline); }
.also__name {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-1);
  font-variation-settings: 'wdth' 100, 'wght' 650;
  line-height: 1.2;
  margin-bottom: .35rem;
}

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  min-height: 100svh;
  padding: clamp(5rem, 12vh, 9rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 3rem;
}

.hero__name {
  font-family: Archivo, system-ui, sans-serif;
  /* Sized to stay inside the gutters at Archivo's widest (wdth 125). */
  font-size: clamp(3rem, 15.5vw, 13.5rem);
  line-height: .88;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-top: auto;
}
.hero__word { display: block; overflow: hidden; }
.hero__word > span {
  display: block;
  font-variation-settings: 'wdth' 125, 'wght' 700;
}

/* pre-animation state, removed by JS once the sequence has played */
.js .hero__word > span {
  transform: translateY(102%);
  font-variation-settings: 'wdth' 62, 'wght' 700;
}
.js .hero__word.is-in > span {
  transform: none;
  font-variation-settings: 'wdth' 125, 'wght' 700;
  transition: transform 1s var(--ease),
              font-variation-settings 1.4s var(--ease);
}
.hero__word:nth-child(2).is-in > span { transition-delay: .09s; }

.hero__foot {
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  border-top: 1px solid var(--hairline);
  padding-top: 1.5rem;
}

.hero__line {
  font-size: var(--step-1);
  line-height: 1.45;
  text-wrap: pretty;
  max-width: 24rem;
}

.hero__meta {
  display: grid; gap: .7rem;
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  justify-self: end;
  text-align: right;
}
.hero__meta dt { color: var(--graphite); }
.hero__meta dd { font-variation-settings: 'wdth' 100, 'wght' 600; }

.js .hero__foot > * { opacity: 0; transform: translateY(12px); }
.js .hero.is-ready .hero__foot > * {
  opacity: 1; transform: none;
  transition: opacity .8s var(--ease) .55s, transform .8s var(--ease) .55s;
}
.js .hero.is-ready .hero__foot > *:nth-child(2) { transition-delay: .68s; }

/* ── Roles ───────────────────────────────────────────────────────── */
.roles { display: grid; gap: 2.25rem; }
.role__name {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-1);
  font-variation-settings: 'wdth' 100, 'wght' 650;
  line-height: 1.2;
}
.role__meta {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  color: var(--graphite);
  margin: .3rem 0 .7rem;
}

/* ── WordCamp progression (a real sequence, so it gets numbers) ──── */
.progression {
  display: grid; gap: 0;
  margin-top: 2rem !important;
  counter-reset: step;
}
.step {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--hairline);
}
.step:last-child { border-bottom: 1px solid var(--hairline); }
.step__year {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  font-variation-settings: 'wdth' 100, 'wght' 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding-top: .35em;
}
.step__role {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-1);
  font-variation-settings: 'wdth' 100, 'wght' 600;
  line-height: 1.25;
  margin-bottom: .35rem;
}

/* ── Toolkit ─────────────────────────────────────────────────────── */
.kit { display: grid; gap: 1.6rem; }
.kit__group h3 {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  font-variation-settings: 'wdth' 100, 'wght' 650;
  margin-bottom: .25rem;
}
.kit__group p { color: var(--graphite); }

/* ── Contact ─────────────────────────────────────────────────────── */
.contact { padding-bottom: clamp(4rem, 9vw, 8rem); }
.contact__head {
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-2);
  font-variation-settings: 'wdth' 94, 'wght' 650;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 22ch;
}

.links {
  display: grid;
  margin-top: 2.25rem !important;
  border-top: 1px solid var(--hairline);
}
.links a {
  display: block;
  padding: .9rem 0;
  border-bottom: 1px solid var(--hairline);
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step-1);
  font-variation-settings: 'wdth' 100, 'wght' 500;
  text-decoration: none;
  transition: padding-left .35s var(--ease), border-color .2s linear;
}
/* Hover shifts the link rather than recolouring it, so the cue does not
   depend on colour and the text keeps full contrast. */
.links a:hover, .links a:focus-visible {
  padding-left: .8rem;
  border-bottom-color: var(--marigold);
}
.links .is-placeholder { color: var(--graphite); font-style: italic; }

/* ── Footer ──────────────────────────────────────────────────────── */
.foot {
  display: flex; flex-wrap: wrap; gap: .5rem 2rem;
  justify-content: space-between;
  padding: 1.6rem var(--gutter);
  border-top: 1px solid var(--hairline);
  font-family: Archivo, system-ui, sans-serif;
  font-size: var(--step--1);
  color: var(--graphite);
}

/* ── Scroll reveal, kept deliberately small ──────────────────────── */
.js [data-reveal] { opacity: 0; transform: translateY(14px); }
.js [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 62rem) {
  :root { --margin-col: 11rem; }
}

@media (max-width: 48rem) {
  .sheet { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .margin {
    position: static;
    order: 2;
    border-top: 1px solid var(--hairline);
    padding-top: 1rem;
    display: grid; gap: .8rem;
  }
  .column { order: 1; }
  /* The portrait leads the page on small screens rather than trailing it. */
  .margin--lead { order: 0; border-top: 0; padding-top: 0; }
  .portrait { max-width: 16rem; }
  .hero__foot { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero__meta { justify-self: start; text-align: left; }
  .topbar__nav { display: none; }
  .theme { margin-left: auto; }
  .step { grid-template-columns: 3.25rem minmax(0, 1fr); gap: .9rem; }
}

/* ── Motion preferences ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .js .hero__word > span {
    transform: none;
    font-variation-settings: 'wdth' 125, 'wght' 700;
  }
  .js .hero__foot > *, .js [data-reveal] { opacity: 1; transform: none; }
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  .topbar, .theme, .foot, .shot__empty { display: none; }
  body { background: #fff; color: #000; }
  .sheet { grid-template-columns: 12rem 1fr; }
  .band { padding: 1.5rem 0; break-inside: avoid; }
  .shot, .portrait, .entry, .step, .also__item { break-inside: avoid; }
  .shot { border-color: #ccc; background: none; padding: 0; }
}
