/* nagabhairu.com
   One page. The signature is a cairn: every section is a stone. */

@font-face {
  font-family: "HN Display";
  src: url("fonts/display.woff2") format("woff2");
  font-weight: 800;
  font-display: block;
}

@font-face {
  font-family: "HN Grotesque";
  src: url("fonts/grotesque.woff2") format("woff2");
  font-weight: 300 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #e7e6e0;
  --ink: #191817;
  --muted: #595851;
  --rule: #c6c5bc;
  --blaze: #e2450e;
  --stone-a: #1d1c1a;
  --stone-b: #34332f;
  --stone-c: #4d4c47;

  --sans: "HN Grotesque", ui-sans-serif, system-ui, "Helvetica Neue", Arial, sans-serif;
  --display: "HN Display", "HN Grotesque", "Arial Narrow", Impact, sans-serif;

  --pad: clamp(1.25rem, 4.5vw, 4rem);
  --rail: 9.5rem;
  --dock: clamp(12.25rem, 15vw, 13.5rem);
  --out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121211;
    --ink: #eceae3;
    --muted: #a3a199;
    --rule: #32312d;
    --blaze: #ff6a2b;
    --stone-a: #eceae3;
    --stone-b: #cdcbc3;
    --stone-c: #aaa8a0;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-stretch: 100%;
  line-height: 1.5;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--blaze);
  color: #191817;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--blaze);
  text-underline-offset: 0.22em;
  transition: text-decoration-thickness 0.2s, text-underline-offset 0.2s;
}

a:hover {
  text-decoration-thickness: 3px;
  text-underline-offset: 0.28em;
}

a:focus-visible {
  outline: 2px solid var(--blaze);
  outline-offset: 4px;
  border-radius: 2px;
}

abbr[title] {
  text-decoration: underline dotted var(--muted) 1px;
  text-underline-offset: 0.22em;
  cursor: help;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.skip:focus {
  top: 1rem;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Hero */

.hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  min-height: min(100vh, 165vw);
  min-height: min(100svh, 165vw);
  padding: clamp(1.25rem, 3.5vw, 2.5rem) var(--pad) clamp(1.25rem, 3vw, 2.25rem);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.tagline {
  font-size: clamp(1.3125rem, 0.9rem + 1.9vw, 2.25rem);
  font-weight: 400;
  font-stretch: 88%;
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.where {
  color: var(--muted);
}

.name-box {
  container-type: inline-size;
  width: 100%;
  max-width: 96rem;
}

.name-fit {
  position: relative;
  width: max-content;
  max-width: 100%;
  font-size: min(15.9vw, 27vh);
  font-size: min(calc(100cqw / 6.27), 27svh);
}

.name {
  font-family: var(--display);
  font-size: 1em;
  font-weight: 800;
  line-height: 1;
}

.name .line {
  display: block;
  white-space: nowrap;
}

.name .line + .line {
  margin-top: 0.16em;
}

.name .l {
  display: inline-block;
  transform-origin: 50% 100%;
}

.slot {
  aspect-ratio: 260 / 364;
}

.slot-hero {
  position: absolute;
  right: -0.12em;
  bottom: 1em;
  z-index: 5;
  height: min(4.35em, 44vh);
  height: min(4.35em, 44svh);
}

/* The cairn */

.cairn {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 50% 100%;
}

.cairn svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cairn path {
  stroke: var(--paper);
  stroke-width: 2.5;
  transition: fill 0.35s;
}

.tone-a {
  fill: var(--stone-a);
}

.tone-b {
  fill: var(--stone-b);
}

.tone-c {
  fill: var(--stone-c);
}

.cairn .st.lit path,
.block.is-active .stone path {
  fill: var(--blaze);
}

.cairn a {
  cursor: pointer;
  outline: none;
}

.cairn a:focus-visible path {
  stroke: var(--blaze);
  stroke-width: 6;
  paint-order: stroke;
}

.cairn-tip {
  position: absolute;
  right: 50%;
  top: 0;
  padding: 0.3rem 0.6rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-0.5rem, -50%);
  transition: opacity 0.15s;
}

.cairn-tip.on {
  opacity: 1;
}

.dock {
  position: fixed;
  top: 0.625rem;
  right: 0.625rem;
  z-index: 10;
  height: 3.75rem;
  pointer-events: none;
}

.dock::before {
  content: "";
  position: absolute;
  inset: -0.4rem -0.45rem -0.35rem;
  border-radius: 0.5rem;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule);
  opacity: 0;
  transition: opacity 0.3s;
}

[data-cairn="dock"] .dock::before {
  opacity: 0.94;
}

.dock .cairn-tip {
  display: none;
}

.dock-top {
  position: absolute;
  inset: -0.4rem -0.45rem -0.35rem;
  display: none;
  border-radius: 0.5rem;
  pointer-events: auto;
}

.dock-top:focus-visible {
  outline-offset: 2px;
}

[data-cairn="dock"] .dock-top {
  display: block;
}

.dock .cairn,
.dock .cairn a {
  pointer-events: none;
}

/* Sections */

main {
  padding-inline: var(--pad);
}

.block {
  position: relative;
  padding-block: clamp(2.75rem, 7vw, 5.5rem);
  scroll-margin-top: 1rem;
}

.block::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

main > .block:first-child::before {
  display: none;
}

.rail {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.stone {
  display: block;
  flex: none;
  width: calc(var(--w) * var(--k, 0.3) * 1px);
  height: auto;
  overflow: visible;
  transform-origin: 50% 100%;
}

.stone path {
  transition: fill 0.35s;
}

.rail .label {
  color: var(--muted);
}

.lead .stone {
  --k: 0.42;
}

.lead h2 {
  font-size: clamp(2.375rem, 1.2rem + 5.2vw, 5rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 0.96;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.lead h2 .thin,
.claim {
  font-weight: 300;
}

.nb {
  white-space: nowrap;
}

.claim {
  font-size: clamp(2.375rem, 1.2rem + 5.2vw, 5rem);
  font-stretch: 75%;
  line-height: 0.96;
  letter-spacing: -0.018em;
  font-variant-numeric: lining-nums;
}

.lead h2 + .claim {
  margin-top: 0.06em;
}

.lead .copy {
  max-width: 34rem;
  margin-top: 1.5rem;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.45;
}

.lead .copy b {
  font-weight: 650;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.25rem;
  color: var(--muted);
}

.meta a {
  color: var(--ink);
}

.items > * + * {
  margin-top: 2rem;
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1.5rem;
}

.item h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 700;
  font-stretch: 88%;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.item h3.paper {
  font-weight: 500;
  text-wrap: pretty;
}

.when {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.item-head + p {
  max-width: 36rem;
  margin-top: 0.375rem;
}

.sub {
  color: var(--muted);
}

.sub a {
  color: var(--ink);
  white-space: nowrap;
}

.ledger li {
  display: grid;
  gap: 0 1.5rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--rule);
}

.ledger li:first-child {
  padding-top: 0;
  border-top: 0;
}

.ledger li:last-child {
  padding-bottom: 0;
}

.ledger .what {
  font-weight: 600;
}

.ledger .detail {
  color: var(--muted);
}

/* Finale */

.end {
  padding-bottom: 0;
}

.end-grid {
  display: grid;
  align-items: end;
  gap: 2.5rem;
}

.end-links {
  display: grid;
  gap: 0.4rem;
  justify-items: start;
  padding-bottom: clamp(1.5rem, 4vw, 3rem);
}

.big {
  font-size: clamp(2.375rem, 1.2rem + 5.2vw, 5rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1;
  letter-spacing: -0.018em;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
}

.big:hover {
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.14em;
}

.big .thin {
  font-weight: 300;
}

.slot-end {
  position: relative;
  z-index: 5;
  justify-self: center;
  height: min(22rem, 48vh);
  height: min(22rem, 48svh);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-inline: var(--pad);
  padding-block: 1.25rem 2rem;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* 404 */

.lost {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--pad);
}

.lost .name-fit {
  font-size: 12.5vw;
  font-size: calc(100cqw / 7.94);
}

.lost svg {
  display: block;
  width: min(100%, 40rem);
  height: auto;
  margin-bottom: 0.4rem;
  overflow: visible;
}

.lost .lit {
  fill: var(--blaze);
}

.lost p {
  margin-top: 1.5rem;
  font-size: 1.25rem;
}

/* Layout: wider screens */

@media (min-width: 40rem) {
  .ledger li {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .ledger li > .what:only-child {
    grid-column: 1 / -1;
  }

  .end-grid {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .end .rail {
    grid-column: 1 / -1;
  }

  .slot-end {
    justify-self: end;
  }

  .where {
    text-align: right;
  }
}

@media (min-width: 72rem) {
  main {
    padding-right: calc(var(--pad) + var(--dock) + 2rem);
  }

  .block {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 44rem);
    column-gap: 2.5rem;
  }

  .rail {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0;
  }

  .lead .stone {
    --k: 0.62;
  }

  .stone {
    --k: 0.36;
  }

  .end {
    display: block;
    margin-right: calc(-1 * (var(--dock) + 2rem));
  }

  .end-grid {
    grid-template-columns: var(--rail) minmax(0, 1fr) auto;
    column-gap: 2.5rem;
  }

  .end .rail {
    grid-column: auto;
    align-self: start;
  }

  .dock {
    top: auto;
    right: var(--pad);
    bottom: 2rem;
    width: var(--dock);
    height: auto;
  }

  .dock::before {
    display: none;
  }

  .dock .cairn-tip {
    display: block;
  }

  .dock .cairn,
  .dock .cairn a {
    pointer-events: auto;
  }

  [data-cairn] .dock-top {
    display: none;
  }
}

/* Motion. Everything below only applies when the visitor has not asked for
   reduced motion and the script is running; without either, the page is
   simply in its final state. */

@media screen and (prefers-reduced-motion: no-preference) {
  .smooth {
    scroll-behavior: smooth;
  }

  .motion .name .l {
    animation: land 0.62s both;
    animation-delay: calc(var(--i) * 34ms + 60ms);
  }

  .motion .hero-top > * {
    animation: rise 0.9s var(--out) both;
    animation-delay: 0.15s;
  }

  .motion .hero-top > * + * {
    animation-delay: 0.3s;
  }

  .motion .cairn:not(.ready) .st {
    opacity: 0;
  }

  .motion .block::before {
    transform: scaleX(0);
    transition: transform 1.1s var(--out);
  }

  .motion .block.in::before {
    transform: none;
  }

  .motion .block .stone {
    opacity: 0;
  }

  .motion .block.in .stone {
    opacity: 1;
    animation: drop 0.85s both;
  }

  .motion .block .rail .label,
  .motion .block .rise {
    opacity: 0;
    transform: translateY(1.25rem);
    transition: opacity 0.7s var(--out), transform 0.9s var(--out);
    transition-delay: calc(var(--n, 0) * 70ms + 120ms);
  }

  .motion .block.in .rail .label,
  .motion .block.in .rise {
    opacity: 1;
    transform: none;
  }

  .motion .w {
    display: inline-block;
    overflow: hidden;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
    vertical-align: bottom;
  }

  .motion .w > span {
    display: inline-block;
    transform: translateY(115%);
    transition: transform 0.95s var(--out);
    transition-delay: calc(var(--n, 0) * 45ms + 80ms);
  }

  .motion .block.in .w > span {
    transform: none;
  }

  @keyframes land {
    0% {
      opacity: 0;
      transform: translateY(-135%);
      animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.5);
    }
    15% {
      opacity: 1;
    }
    58% {
      transform: translateY(0) scale(1.07, 0.86);
      animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
    }
    76% {
      transform: translateY(-5%) scale(0.98, 1.04);
      animation-timing-function: ease-in;
    }
    90% {
      transform: translateY(0) scale(1.01, 0.98);
    }
    100% {
      transform: none;
    }
  }

  @keyframes drop {
    0% {
      transform: translateY(-190%) rotate(-9deg);
      animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.5);
    }
    46% {
      transform: translateY(0) rotate(2.5deg) scale(1.06, 0.84);
      animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
    }
    64% {
      transform: translateY(-9%) rotate(-2deg) scale(0.98, 1.04);
      animation-timing-function: ease-in;
    }
    80% {
      transform: translateY(0) rotate(1deg) scale(1.02, 0.97);
    }
    100% {
      transform: none;
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(1rem);
    }
  }
}

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

@media print {
  :root {
    --paper: #fff;
    --ink: #000;
    --muted: #444;
    --rule: #bbb;
  }

  .skip,
  .dock,
  .slot-hero,
  .slot-end {
    display: none;
  }

  .hero {
    min-height: 0;
  }

  .block {
    break-inside: avoid;
  }
}
