/* Rice & Beams: a warm gradient, Playfair Display and DM Sans (self-hosted, OFL) */

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/playfair-display-500.woff2) format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/playfair-display-500-italic.woff2) format('woff2');
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/dm-sans-400.woff2) format('woff2');
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/dm-sans-500.woff2) format('woff2');
}

:root {
  color-scheme: light;
  /* Text. The accent is the deepest orange that still reads at 3:1 on every
     part of the gradient; the muted brown reads at 4.5:1 */
  --ink: #172335;
  --accent: #a33113;
  --muted: #45372a;
  /* Day: orange at the left edge, a peach glow, gold to the right */
  --g1: #f19d3c;
  --g2: #f3a852;
  --g3: #f5b768;
  --g4: #f6bf80;
  --g5: #f7cd82;
  --g6: #f7d689;
  --glow: rgb(246 186 128 / 0.75);
  /* The three gunas, top to bottom: sattva, a clear light veil; rajas, a
     warmer, livelier orange; tamas, deep earth. Each keeps the text
     contrast below in every light (tests/pages.test.js checks it) */
  --sattva: rgb(255 251 242 / 0.35);
  --rajas: rgb(255 154 60 / 0.25);
  --tamas: rgb(42 26 16 / 0.94);
  /* Stars come out at night only: a sparse, faint field, no animation */
  --stars: none;
  --tap-size: 44px;
  --section-gap: clamp(5rem, 11vw, 9.5rem);
  --gutter: clamp(1.25rem, 8vw, 6.5rem);
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

/* The light follows the sun over Mountain View (lib/sun.js sets data-light
   on <html>); day is the default above. Every palette keeps the same
   contrast for --ink, --muted and --accent. */
:root[data-light='dawn'] {
  --g1: #ee9b8a;
  --g2: #f2ac93;
  --g3: #f5bd9f;
  --g4: #f7caa8;
  --g5: #f8d6b3;
  --g6: #f9dfbd;
  --glow: rgb(243 185 166 / 0.7);
}

:root[data-light='dusk'] {
  --g1: #f29a63;
  --g2: #f4a774;
  --g3: #f5b383;
  --g4: #f6bf91;
  --g5: #f7c99c;
  --g6: #f8d1a5;
  --glow: rgb(241 169 149 / 0.7);
}

:root[data-light='night'] {
  color-scheme: dark;
  --ink: #f6ead6;
  --accent: #ff8f63;
  --muted: #cdbfa9;
  --g1: #0e1726;
  --g2: #132036;
  --g3: #182844;
  --g4: #1d304f;
  --g5: #223858;
  --g6: #273f60;
  --glow: rgb(43 47 82 / 0.8);
  --sattva: rgb(255 255 255 / 0.04);
  --rajas: rgb(255 120 70 / 0.05);
  --tamas: rgb(6 10 18 / 0.6);
  --stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='960' height='720' fill='%23f6ead6'%3E%3Ccircle cx='314' cy='114' r='1.0' opacity='0.36'/%3E%3Ccircle cx='783' cy='74' r='0.8' opacity='0.2'/%3E%3Ccircle cx='487' cy='34' r='0.8' opacity='0.31'/%3E%3Ccircle cx='235' cy='396' r='0.6' opacity='0.44'/%3E%3Ccircle cx='125' cy='165' r='1.0' opacity='0.5'/%3E%3Ccircle cx='66' cy='420' r='0.6' opacity='0.49'/%3E%3Ccircle cx='52' cy='612' r='0.7' opacity='0.31'/%3E%3Ccircle cx='518' cy='410' r='0.8' opacity='0.44'/%3E%3Ccircle cx='611' cy='270' r='0.8' opacity='0.41'/%3E%3Ccircle cx='742' cy='336' r='0.8' opacity='0.3'/%3E%3Ccircle cx='243' cy='135' r='1.2' opacity='0.41'/%3E%3Ccircle cx='834' cy='522' r='0.7' opacity='0.37'/%3E%3Ccircle cx='164' cy='249' r='0.8' opacity='0.31'/%3E%3Ccircle cx='916' cy='63' r='0.8' opacity='0.36'/%3E%3Ccircle cx='834' cy='229' r='1.0' opacity='0.44'/%3E%3Ccircle cx='477' cy='569' r='0.6' opacity='0.45'/%3E%3Ccircle cx='900' cy='342' r='1.0' opacity='0.37'/%3E%3Ccircle cx='698' cy='226' r='0.8' opacity='0.5'/%3E%3Ccircle cx='372' cy='479' r='0.6' opacity='0.48'/%3E%3Ccircle cx='474' cy='162' r='0.7' opacity='0.22'/%3E%3Ccircle cx='242' cy='283' r='1.2' opacity='0.47'/%3E%3Ccircle cx='414' cy='395' r='1.0' opacity='0.45'/%3E%3Ccircle cx='347' cy='630' r='0.6' opacity='0.23'/%3E%3Ccircle cx='564' cy='193' r='0.6' opacity='0.23'/%3E%3Ccircle cx='819' cy='677' r='1.0' opacity='0.52'/%3E%3Ccircle cx='744' cy='624' r='1.2' opacity='0.49'/%3E%3Ccircle cx='384' cy='285' r='0.8' opacity='0.38'/%3E%3Ccircle cx='67' cy='55' r='0.6' opacity='0.32'/%3E%3Ccircle cx='515' cy='676' r='0.8' opacity='0.19'/%3E%3Ccircle cx='833' cy='440' r='0.6' opacity='0.38'/%3E%3Ccircle cx='910' cy='432' r='0.8' opacity='0.22'/%3E%3Ccircle cx='331' cy='194' r='1.2' opacity='0.52'/%3E%3Ccircle cx='907' cy='263' r='1.0' opacity='0.49'/%3E%3Ccircle cx='932' cy='616' r='1.0' opacity='0.56'/%3E%3C/svg%3E");
}

html {
  background: var(--g6);
}

/* The gradient, a glow through the middle, and a fine grain over it all */
body {
  margin: 0;
  min-height: 100vh;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .2 0 0 0 0 .05 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--stars), linear-gradient(var(--sattva), transparent 75rem),
    radial-gradient(ellipse 34% 42% at 34% 48%, var(--glow), transparent 72%),
    linear-gradient(
      90deg,
      var(--g1) 0%,
      var(--g2) 16%,
      var(--g3) 27%,
      var(--g4) 38%,
      var(--g5) 52%,
      var(--g6) 66%
    );
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

.wrap {
  width: min(100% - 2 * var(--gutter), 74rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--g6);
}

.skip:focus {
  top: 1rem;
}

/* Header and footer: small, quiet, at the edges */

.top,
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 1.5rem;
  font-size: 1.0625rem;
}

.top {
  padding-top: clamp(1.25rem, 3vw, 2.4rem);
}

.top p,
.foot p {
  margin: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
  font-weight: 500;
  text-decoration: none;
}

.hello {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
  color: var(--muted);
}

.foot {
  padding-block: clamp(8rem, 22vw, 20rem) 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* The headline */

.hero {
  padding-block: clamp(6rem, 22vw, 20rem) clamp(4rem, 9vw, 8rem);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.25rem, 7.6vw, 6.625rem);
  line-height: 1.12;
  letter-spacing: -0.055em;
}

h1 em {
  display: block;
  color: var(--accent);
}

em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.copy em {
  color: var(--accent);
}

/* "Beams" sits a size up from the sentence it starts, without opening the line */
.copy p > em {
  font-size: 1.2em;
  line-height: 1;
}

/* A label column and a text column */

.row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 52rem) {
  .row {
    grid-template-columns: 26.5% minmax(0, 1fr);
    gap: 0;
  }
}

.label {
  margin: 0;
  padding-top: 0.45em;
  color: var(--muted);
  font: 400 0.9375rem/1.5 var(--sans);
}

.copy {
  max-width: 21em;
  font-size: clamp(1.125rem, 1.95vw, 1.7rem);
  line-height: 1.48;
}

/* Balanced lines: each paragraph breaks into lines of even length */
.copy p {
  margin: 0 0 1.5em;
  text-wrap: balance;
}

.copy .pull {
  margin: 1.4em 0 0;
  color: var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.25rem, 4.4vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.copy .pull:first-child {
  margin: 0 0 0.35em;
}

/* The work */

/* Every section after The Studio */
.later {
  margin-top: var(--section-gap);
}

.projects {
  margin: 0;
  padding: 0;
  list-style: none;
}

.projects li + li {
  margin-top: 2.5em;
}

.projects h3 {
  margin: 0 0 0.35em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6em;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.projects h3 a {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: var(--tap-size);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

.projects h3 a:hover {
  text-decoration-color: currentColor;
}

.projects h3 span {
  font-family: var(--sans);
  font-size: 0.6em;
}

.projects p {
  margin: 0 0 0.5em;
}

.projects .fine {
  color: var(--muted);
  font-size: max(0.8125rem, 0.62em);
}

/* Short items read better unbalanced: whole lines, no lone last word */
.projects p,
.recipe p,
.log p {
  text-wrap: pretty;
}

/* 404 */

.lost {
  padding-block: clamp(6rem, 18vw, 14rem) 2rem;
}

.lost p {
  margin: 1.5rem 0 0;
  font-size: clamp(1.125rem, 1.9vw, 1.625rem);
}

.lost a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
}

/* The plain line under the headline */

.lede {
  max-width: 24em;
  margin: 1.4em 0 0;
  font-size: clamp(1.125rem, 1.95vw, 1.7rem);
  line-height: 1.4;
  text-wrap: balance;
}

/* Links inside sentences: a taller hit area, the same line */

.copy p a {
  padding-block: calc((var(--tap-size) - 1.2em) / 2);
}

/* The Work: what is live and what is next */

.projects .status {
  margin: 0 0 0.2em;
  color: var(--muted);
  font-size: max(0.8125rem, 0.6em);
  font-weight: 500;
}

.status.live::before {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--accent);
}

/* The Principles: numbered */

.recipe {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.recipe li {
  counter-increment: step;
}

.recipe li + li {
  margin-top: 1.3em;
}

.recipe h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3em;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.recipe h3::before {
  content: counter(step, decimal-leading-zero);
  margin-right: 0.7em;
  color: var(--muted);
  font: 500 0.55em/1 var(--sans);
  letter-spacing: 0;
  vertical-align: 0.3em;
}

.recipe p {
  margin: 0.15em 0 0;
}

/* A dated log, newest first (for when there is news again) */

.log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log li + li {
  margin-top: 1em;
}

.log time {
  display: block;
  color: var(--muted);
  font-size: max(0.8125rem, 0.6em);
  font-weight: 500;
}

.log p {
  margin: 0;
}

/* The footer's sky line, above the small print */

.foot .sky {
  flex-basis: 100%;
}

/* Links to see the page in another light; the one showing is marked */
.foot .lights {
  flex-basis: 100%;
  margin-bottom: 0.5rem;
}

.foot .lights [aria-current] {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
}

/* The mandala: a star of eight rice grains at the centre, a lotus of eight
   petals, two squares for the four quarters, a circle, a ring of beads and
   rays of light, drawn once (index.html's <symbol>) in hairlines and used twice. It is decoration only, behind the headline and
   beside The Principles; it turns once every six minutes, and holds still when the
   device asks for less motion. A light touch: hover over or tap the big
   one and it spins like a toy. */

main {
  overflow-x: clip;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.mandala {
  color: var(--accent);
  pointer-events: none;
}

.hero {
  position: relative;
}

.hero > :not(.mandala) {
  position: relative;
}

.mandala.turning {
  position: absolute;
  top: 50%;
  right: -10%;
  width: clamp(18rem, 52vw, 44rem);
  height: clamp(18rem, 52vw, 44rem);
  translate: 0 -50%;
  opacity: 0.32;
  stroke-width: 1.5;
  animation: turn 360s linear infinite;
  pointer-events: auto;
  transition: transform 8s cubic-bezier(0.37, 0, 0.23, 1);
}

.mandala.turning:hover,
.mandala.turning:active {
  transform: rotate(1turn);
}

@keyframes turn {
  to {
    rotate: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mandala.turning {
    animation: none;
    transition: none;
  }

  .mandala.turning:hover,
  .mandala.turning:active {
    transform: none;
  }
}

.label-text {
  margin: 0;
  font: inherit;
}

.mandala.small {
  display: none;
}

@media (min-width: 52rem) {
  .mandala.small {
    display: block;
    width: 5.5rem;
    height: 5.5rem;
    margin-top: 1.25rem;
    opacity: 0.7;
    stroke-width: 1;
  }
}

/* Sattva, rajas, tamas: the page goes from clear and light at the top (the
   veil on <body>), to warm and lively in the middle (The Work, The Principles),
   to deep and grounded at the bottom (Say Hello, the footer).
   Each band fades in over its top padding, where there is no text. */

.band {
  padding-top: var(--section-gap);
}

.band > .later:first-child {
  margin-top: 0;
}

.rajas {
  background: linear-gradient(transparent, var(--rajas) var(--section-gap));
}

.tamas,
.ground {
  --ink: #f6ead6;
  --muted: #cdbfa9;
  --accent: #ff8f63;
  color: var(--ink);
}

.tamas {
  padding-top: calc(var(--section-gap) * 1.6);
  background: linear-gradient(var(--rajas), var(--tamas) calc(var(--section-gap) * 1.6));
}

.ground {
  background: var(--tamas);
}
