/* yogya.dev
   Black and safety yellow. The page opens on a yellow block carrying the name in giant type and closes on
   another. Between them the story runs as chapters: rounded slabs on pure black, each with its tag and number,
   one line and one picture at a time. Yellow means "you can click this", except where a whole slab turns yellow
   to keep the rhythm. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 350 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #000000;
  --panel: #101010;
  --surface: #1a1a1a;
  --fg: #f5f5f5;
  --fg-2: #a9a9a9;
  --unlit: #707070;
  --accent: #f7d417;
  --accent-deep: #ffe45c;
  --on-accent: #000000;
  --rule: rgba(245, 245, 245, 0.12);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --say: clamp(2.35rem, 5.8vw, 5rem);

  --gutter: clamp(1.25rem, 4.5vw, 3rem);
  --wrap: 80rem;
  --radius: 12px;
  --radius-lg: 18px;

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- links and buttons ---------- */

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1.5px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s, color 0.2s;
}
a:hover { text-decoration-color: currentColor; color: var(--accent-deep); }

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

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font: 600 var(--step-0) / 1.2 var(--sans);
  text-decoration: none;
  border: 1.5px solid var(--fg);
  color: var(--fg);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); color: var(--fg); border-color: var(--accent); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.btn-small { min-height: 2.5rem; padding: 0.45rem 1.05rem; font-size: var(--step--1); }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  text-decoration: none;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 0.75rem); }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.3s, border-color 0.3s;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}
.brand {
  font: 800 1.35rem / 1 var(--sans);
  font-stretch: 80%;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.brand:hover { color: var(--fg); }
.site-nav { display: flex; align-items: center; gap: clamp(0.9rem, 2.4vw, 1.75rem); }
.site-nav a:not(.btn) { font-size: var(--step--1); font-weight: 600; text-decoration: none; color: var(--fg); }
.site-nav a:not(.btn):hover { text-decoration: underline; }
@media (max-width: 30rem) { .site-nav .nav-optional { display: none; } }

/* on the homepage the header sits on the colour block until you scroll */
.home .site-header:not(.is-scrolled) {
  background: transparent;
  border-bottom-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.home .site-header:not(.is-scrolled) .site-nav a:not(.btn) { color: var(--on-accent); }
.home .site-header:not(.is-scrolled) .btn-solid { background: var(--on-accent); border-color: var(--on-accent); color: var(--accent); }
/* the giant name is the brand; the small one arrives once it has scrolled away */
.js .home .brand { opacity: 0; transform: translateY(-0.4rem); pointer-events: none; }
.js .home .site-header.show-brand .brand { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- the colour block (landing and ending) ---------- */

.block {
  background: var(--accent);
  color: var(--on-accent);
}
.block a:not(.btn) { color: var(--on-accent); text-decoration-color: color-mix(in srgb, var(--on-accent) 45%, transparent); }
.block a:not(.btn):hover { color: var(--on-accent); text-decoration-color: var(--on-accent); }
.block :focus-visible { outline-color: var(--on-accent); }
.block .btn { border-color: var(--on-accent); color: var(--on-accent); }
.block .btn:hover { border-color: var(--on-accent); color: var(--on-accent); }
.block .btn-solid { background: var(--on-accent); color: var(--accent); }
.block .btn-solid:hover { background: var(--on-accent); color: var(--accent-deep); }

.landing { margin-top: -4.25rem; }
.landing .block {
  min-height: 62svh;
  display: flex;
  flex-direction: column;
  padding-top: 4.25rem;
}
.landing .block .wrap { margin-top: auto; padding-bottom: clamp(0.75rem, 2vw, 1.5rem); }

/* the name: each line is sized by script to run edge to edge */
.fit {
  margin: 0;
  font: 800 clamp(4.5rem, 21vw, 18rem) / 1.02 var(--sans);
  font-stretch: 75%;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.02em;
}
.fit .line { display: block; width: fit-content; white-space: nowrap; }
.fit .line + .line { margin-top: -0.2em; }
.fit.one { white-space: nowrap; }
.fit.one .line { display: inline-block; }
.fit.one .line + .line { margin: 0 0 0 0.2em; }

.landing-rest {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem 3rem;
  padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 7vw, 5rem);
}
.intro-line {
  margin: 0 0 0.9rem;
  font: 400 clamp(1.9rem, 3.6vw, 3.1rem) / 1.06 var(--serif);
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  max-width: 18ch;
  text-wrap: balance;
}
.intro-sub { margin: 0 0 1rem; color: var(--fg-2); font-size: var(--step-1); line-height: 1.45; max-width: 34rem; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: var(--step--1);
  font-weight: 600;
}
.status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #39d77a;
  box-shadow: 0 0 0 3px rgba(57, 215, 122, 0.25);
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.1rem; }

/* ---------- the story: chapters as slabs on black ---------- */

.story {
  display: grid;
  gap: clamp(0.5rem, 1.2vw, 0.9rem);
  padding-inline: clamp(0.5rem, 1.2vw, 0.9rem);
}
.scene {
  background: var(--panel);
  border-radius: clamp(22px, 3vw, 40px);
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3.5rem, 9vw, 7rem);
}
.chapter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 7vw, 5rem);
  font-size: var(--step--1);
  font-weight: 600;
}
.chapter .tag {
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  color: var(--accent);
}
.chapter .num {
  font: 800 1.5rem / 1 var(--sans);
  font-stretch: 75%;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
}

/* a yellow slab: everything flips to dark-on-yellow */
.scene.yellow { background: var(--accent); color: var(--on-accent); }
.scene.yellow .chapter .tag,
.scene.yellow .chapter .num { color: var(--on-accent); }
.scene.yellow .say { color: var(--on-accent); }
.js .scene.yellow .say:not(.lit-always) { color: color-mix(in srgb, var(--on-accent) 62%, var(--accent)); }
.js .scene.yellow .say.is-lit { color: var(--on-accent); }
.scene.yellow .aside { color: color-mix(in srgb, var(--on-accent) 78%, var(--accent)); }
.scene.yellow a { color: var(--on-accent); text-decoration-color: color-mix(in srgb, var(--on-accent) 45%, transparent); }
.scene.yellow :focus-visible { outline-color: var(--on-accent); }
.scene.yellow .diff { border-color: transparent; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.45); }

.say {
  margin: 0;
  font: 400 var(--say) / 1.02 var(--serif);
  font-optical-sizing: auto;
  letter-spacing: -0.022em;
  max-width: 15ch;
  text-wrap: balance;
  color: var(--fg);
}
.say-sm { font-size: clamp(1.9rem, 3.4vw, 2.9rem); max-width: 14ch; }
/* each line comes into focus as it reaches the middle of the screen */
.js .say:not(.lit-always) { color: var(--unlit); transition: color 0.9s var(--ease-out); }
.js .say.is-lit { color: var(--fg); }

.aside {
  margin: 1.1rem 0 0;
  max-width: 30rem;
  color: var(--fg-2);
  font-size: var(--step-1);
  line-height: 1.45;
}
.aside.small { font-size: var(--step-0); max-width: 42rem; line-height: 1.6; }
.go { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 1.5rem 0 0; font-weight: 600; }

.duo-cols {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2.25rem, 6vw, 5.5rem);
  align-items: center;
}
.duo-cols.flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
@media (max-width: 56rem) {
  .duo-cols,
  .duo-cols.flip { grid-template-columns: 1fr; }
  .duo-cols.flip > figure { order: 2; }
}

.photo img,
.photo-wide img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--rule), 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}

/* Vardhman: four phones fanned out */
.fan {
  display: flex;
  justify-content: center;
  margin: clamp(3rem, 7vw, 5.5rem) auto 0;
  max-width: 62rem;
  padding-inline: 4%;
}
.fan img {
  width: 27%;
  margin-inline: -1.6%;
  aspect-ratio: 400 / 853;
  object-fit: cover;
  border-radius: clamp(12px, 2.2vw, 24px);
  box-shadow: 0 0 0 1px var(--rule), 0 40px 70px -25px rgba(0, 0, 0, 0.8);
}
.fan img:nth-child(1) { transform: rotate(-7deg) translateY(1.5rem); }
.fan img:nth-child(2) { transform: rotate(-2.5deg); z-index: 1; }
.fan img:nth-child(3) { transform: rotate(2.5deg); z-index: 1; }
.fan img:nth-child(4) { transform: rotate(7deg) translateY(1.5rem); }
.then { margin-top: clamp(4rem, 9vw, 7rem); margin-left: auto; width: fit-content; max-width: 100%; }
@media (max-width: 40rem) { .then { margin-left: 0; } }

/* Meant2Bae and ScreenDemons side by side */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(4.5rem, 7vw, 6rem) clamp(2rem, 6vw, 5rem);
}
@media (max-width: 52rem) { .pair { grid-template-columns: 1fr; } }
.pair-item { position: relative; border-top: 2px solid var(--rule); padding-top: 2rem; }
.mark { width: 3rem; height: 3rem; border-radius: 12px; margin-bottom: 1.5rem; }
.pair-item .peek { position: absolute; right: 0; bottom: 100%; width: 7.5rem; height: auto; }

/* Django diff */
.diff {
  border-radius: var(--radius-lg);
  background: #0a0a0a;
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}
.diff-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: #a9a9ad;
}
.diff pre { margin: 0; padding: 1rem 0; overflow-x: auto; font: 0.8125rem / 1.75 var(--mono); }
.diff code { display: block; min-width: max-content; }
.diff .ln { display: block; padding-inline: 1.1rem; white-space: pre; color: #a9a9ad; }
.diff .add { background: rgba(57, 215, 122, 0.08); color: #c6eccf; }
.diff .add::before { content: "+ "; color: #39d77a; }
.diff .ctx::before { content: "  "; }
.diff .hunk { color: #8e8e93; }
.scene-django .duo-cols { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
@media (max-width: 56rem) { .scene-django .duo-cols { grid-template-columns: 1fr; } }

/* laptop: the photo runs wide and the line settles beside its bottom edge */
.scene-laptop .wrap + .wrap {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end;
}
.photo-wide { grid-column: 2; grid-row: 1; }
.over { grid-column: 1; grid-row: 1; }
@media (max-width: 56rem) {
  .scene-laptop .wrap + .wrap { grid-template-columns: 1fr; }
  .photo-wide,
  .over { grid-column: 1; grid-row: auto; }
}

.tilt img { transform: rotate(1.5deg); }

/* notes */
.notes { list-style: none; margin: 2.5rem 0 3rem; padding: 0; max-width: 46rem; }
.notes li { border-top: 1px solid var(--rule); }
.notes li:last-child { border-bottom: 1px solid var(--rule); }
.notes a {
  display: block;
  padding-block: 1.15rem;
  font: 400 var(--step-2) / 1.25 var(--serif);
  text-decoration: none;
}
.notes a:hover { text-decoration: underline; }

/* ---------- ending: the colour block again ---------- */

.ending {
  margin: clamp(0.5rem, 1.2vw, 0.9rem);
  border-radius: clamp(22px, 3vw, 40px);
  padding-block: clamp(4rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem);
}
.ending .fit { margin-bottom: clamp(2rem, 4vw, 3rem); }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin: 0 0 2rem; }
.email { font: 400 clamp(1.6rem, 4.6vw, 3rem) / 1.1 var(--serif); overflow-wrap: anywhere; }
.copy-status { font-size: var(--step--1); min-width: 4rem; }
.elsewhere { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; font-weight: 600; }
.ending .where { margin: 0; font-size: var(--step-0); opacity: 0.8; }

.site-footer { padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px)); color: var(--fg-2); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
.site-footer p { margin: 0; }

/* ---------- note pages ---------- */

.article { padding-block: clamp(3rem, 8vw, 5.5rem) clamp(4rem, 10vw, 7rem); }
.article .wrap { max-width: 46rem; }
.crumb { display: inline-block; margin-bottom: 2.5rem; font-size: var(--step--1); font-weight: 600; }
.article h1 {
  margin: 0 0 1.25rem;
  font: 400 clamp(2.6rem, 7.5vw, 4.75rem) / 0.98 var(--serif);
  font-optical-sizing: auto;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.article .meta { margin: 0 0 2.5rem; color: var(--fg-2); font-size: var(--step--1); }
.article-art { margin: 0 0 3rem; }
.article-art.wide { width: min(100vw - 2 * var(--gutter), 62rem); margin-left: 50%; translate: -50% 0; }
.article-art .fan { margin-top: 0; padding-bottom: 1.5rem; }
.prose { font: 400 1.25rem / 1.7 var(--serif); }
.prose p { margin: 0 0 1.3em; }
.prose h2 { margin: 2.1em 0 0.55em; font: 450 var(--step-2) / 1.2 var(--serif); }
.prose ul { margin: 0 0 1.3em; padding-left: 1.2em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--fg-2); }
.prose strong { font-weight: 600; }
.prose .lead { font-size: 1.5rem; line-height: 1.5; }
main code { font: 0.85em var(--mono); background: var(--surface); padding: 0.1em 0.35em; border-radius: 5px; }
.diff code { font: inherit; background: none; padding: 0; border-radius: 0; }
.article-end {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-weight: 600;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation: none !important; }
  .js .say:not(.lit-always) { color: var(--fg); }
}
