/* aaryans.page. One serif column on a warm near-black (night) or cream (paper).
   Colours live in :root; paper mode only overrides them. */

:root {
  --bg: #11110e;
  --text: #d8d3c1;
  --dim: #948f7f;
  --faint: #5f5c51;
  --rule: #2a2a23;
  --accent: #dda65f;
  --code-bg: #1c1c17;
  --photo-bg: #1c1c17;
  --ph: #e6c769;
  --ph-line: #8a7430;
  --chip-hover: brightness(1.25);
  --bfly-ink: #e9e1c8;
  --bfly-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .7));
  --dots: rgb(216 211 193 / .045);  /* halftone screen behind everything */
  --trail: 233 225 200;              /* flight path ink, as "r g b" (flight.js sets the alpha) */
  --trail-strength: 1;
  --trail-gold: 221 166 95;          /* the one gold orbit */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

/* paper: the butterflies come out in pen-black ink, as drawn */
:root[data-theme="paper"] {
  --bg: #f2ede1;
  --text: #2a251b;
  --dim: #675f4e;
  --faint: #aea591;
  --rule: #ddd5c3;
  --accent: #9b4f12;
  --code-bg: #e8e1d1;
  --photo-bg: #e2dbcb;
  --ph: #7d5300;
  --ph-line: #b8913a;
  --chip-hover: brightness(.95);
  --bfly-ink: #241e15;
  --bfly-shadow: none;
  --dots: rgb(72 69 60 / .075);
  --trail: 36 30 21;
  --trail-strength: 1.35;
  --trail-gold: 155 79 18;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* A fine dot screen fixed to the window (after the Backrooms wiki's liminal theme). */
html { background: var(--bg) radial-gradient(circle, var(--dots) 50%, transparent 0) 0 0 / 4px 4px fixed;
  color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); font: 17px/1.65 var(--serif); }

/* flight path (flight.js) sits between the dot screen and the page */
.flight { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.top, .page, .foot { position: relative; z-index: 1; }

a { color: inherit; text-decoration: underline 1px var(--faint); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
.dim { color: var(--dim); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; padding: 4px 8px; background: #000; }

/* Text not yet written: ochre with a dashed underline. */
.ph { color: var(--ph); border-bottom: 1px dashed var(--ph-line); }

/* ---------- pen marks (build.py sketch()) ----------
   Three versions of each drawing, shown in turn three times a second like a hand-drawn animation's boil;
   the flight path in the background (flight.js) boils at the same rate. */

.boil { overflow: visible; fill: rgb(var(--trail) / .75); stroke: rgb(var(--trail) / .62); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.boil path { fill: none; }
.boil .gold { stroke: rgb(var(--trail-gold) / .9); }
.boil g { animation: boil 1s step-end infinite; }
.boil g:nth-child(2) { animation-delay: -.667s; }
.boil g:nth-child(3) { animation-delay: -.333s; }
@keyframes boil { 0% { opacity: 1 } 33.333%, 100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) {
  .boil g { animation: none; }
  .boil g + g { display: none; }
}

/* ---------- header and footer ---------- */

.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 22px 28px; font-size: 16px; }
.name { position: relative; justify-self: start; text-decoration: none; }
.nav { display: flex; gap: 28px; }
.nav a { position: relative; color: var(--dim); text-decoration: none; padding-bottom: 2px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current] { color: var(--text); }
.underline { position: absolute; left: -3px; bottom: -5px; width: calc(100% + 6px); height: 6px; }
.underline path { vector-effect: non-scaling-stroke; }
.right { justify-self: end; display: flex; align-items: center; gap: 20px; }
.elsewhere { display: flex; gap: 18px; font-size: 15px; }
.elsewhere a { color: var(--dim); text-decoration: none; }
.elsewhere a:hover { color: var(--text); }
.theme { display: grid; place-items: center; padding: 4px; margin: -4px; background: none; border: 0; border-radius: 50%;
  color: var(--dim); cursor: pointer; }
.theme:hover { color: var(--text); }
.theme[hidden] { display: none; }
@media (max-width: 640px) {
  .top { grid-template-columns: 1fr auto auto; gap: 14px; padding: 16px; }
  .nav { gap: 16px; }
  .elsewhere { display: none; }
}

.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 640px; margin: 0 auto; padding: 48px 20px 40px;
  font: 13px var(--mono); color: var(--dim); }
.foot a { color: var(--dim); text-decoration: none; }
.foot a:hover { color: var(--text); }

/* ---------- main column ---------- */

.page { max-width: 640px; margin: 0 auto; padding: 24px 20px 0; }
.page--wide, .foot--wide { max-width: 860px; }

.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: .2em; }
.prose li::marker { color: var(--faint); }
.prose h2 { margin: 1.8em 0 .5em; font-size: 1.15em; font-weight: 600; }
.prose h3 { margin: 1.5em 0 .4em; font-size: 1em; font-weight: 600; }
.prose blockquote { padding-left: 1em; border-left: 2px solid var(--rule); color: var(--dim); }
.prose code { font: .85em var(--mono); background: var(--code-bg); padding: .1em .3em; border-radius: 3px; }
.prose pre { overflow-x: auto; padding: 12px 14px; background: var(--code-bg); border-radius: 4px; font-size: 14px; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose img { margin: 1.4em 0; }

figcaption { margin-top: 7px; font: 12px/1.5 var(--mono); color: var(--dim); }

/* ---------- about ---------- */

/* text first; the photo sits beside it on wide screens and after it on phones */
.about--photo { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 30px; }
.about-photo { margin: 6px 0 0; }
.about-photo a { position: relative; display: block; }
.about-photo img { width: 100%; border-radius: 2px; }
.corner { position: absolute; width: 40px; height: 40px; }
.corner--tl { left: -9px; top: -9px; }
.corner--br { right: -9px; bottom: -9px; }
@media (max-width: 640px) {
  .about--photo { grid-template-columns: 1fr; gap: 8px; }
  .about-photo { max-width: 240px; }
}

/* ---------- under construction (build.py crane()) ---------- */

.building { text-align: center; padding-top: 12px; }
.building .prose h2 { margin-top: .4em; font-size: 1.4em; font-weight: 400; }
.crane { position: relative; width: min(280px, 78vw); margin: 0 auto 10px; }
.crane svg { display: block; width: 100%; height: auto; }
.crane-frame { stroke: rgb(var(--trail) / .78); fill: rgb(var(--trail) / .9); }
/* the hook hangs from the trolley, at (196, 60) of the 260x230 drawing, and sways */
.crane-hook { position: absolute; inset: 0; height: 100% !important; transform-origin: 75.4% 26.1%;
  animation: sway 5s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .crane-hook { animation: none; } }

/* ---------- blog ---------- */

.blog { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 40px; }
.legend { position: sticky; top: 24px; align-self: start; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.legend button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 3px 0; background: none; border: 0;
  color: var(--dim); font: inherit; text-align: left; cursor: pointer; }
.legend button:hover, .legend button[aria-pressed="true"] { color: var(--text); }
.legend .n { margin-left: auto; font: 12px var(--mono); color: var(--faint); }
.swatch { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--c); filter: brightness(1.9) saturate(.9); }
@media (max-width: 700px) {
  .blog { grid-template-columns: 1fr; gap: 18px; }
  .legend { position: static; display: flex; flex-wrap: wrap; gap: 2px 20px; }
  .legend button { width: auto; }
  .legend .n { margin-left: 2px; }
}

.posts { margin: 0; padding: 0; list-style: none; }
.posts li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 4px 0; }
.posts li[hidden] { display: none; }
.posts time { font: 13px var(--mono); color: var(--dim); }
.posts a { justify-self: start; padding: 2px 9px 3px; border-radius: 3px; background: var(--c); text-decoration: none;
  font-size: 16px; line-height: 1.45; }
.posts a:hover { color: var(--text); filter: var(--chip-hover); }

/* Paper mode: the category colours are dark and muted for night, so keep each hue
   but make chips a light tint and swatches a mid tone, with the colour boosted. */
[data-theme="paper"] .posts a { background: color-mix(in srgb, var(--c) 24%, var(--bg)); }
[data-theme="paper"] .swatch { filter: none; }
@supports (color: oklch(from red l c h)) {
  [data-theme="paper"] .posts a { background: oklch(from var(--c) .88 calc(c * 1.15) h); }
  [data-theme="paper"] .swatch { background: oklch(from var(--c) .56 calc(c * 1.5) h); }
}
@media (max-width: 480px) { .posts li { grid-template-columns: 1fr; gap: 2px; padding: 6px 0; } }

/* placeholders inside coloured chips keep the chip's text colour */
.posts .ph, .post-head .ph { color: inherit; border-bottom-color: var(--ph); }

.post-head { margin-bottom: 1.6em; }
.post-head h1 { margin: 0 0 .35em; font-size: 1.6em; line-height: 1.25; font-weight: 600; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font: 13px var(--mono); color: var(--dim); }
.tag { display: inline-flex; align-items: center; gap: 7px; }
.back { margin-top: 2.4em; font-size: 15px; }

/* ---------- flowers ---------- */

.intro { max-width: 640px; margin-bottom: 30px; }
.flowers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.flowers a { position: relative; display: block; }
.flowers img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; background: var(--photo-bg); }
.flowers a:hover img { opacity: .85; }
@media (max-width: 480px) { .flowers { grid-template-columns: repeat(3, 1fr); gap: 5px; } }

.specimen { max-width: 760px; margin: 0 auto; }
.specimen img { width: 100%; border-radius: 2px; background: var(--photo-bg); }
.pager { display: flex; justify-content: space-between; max-width: 760px; margin: 22px auto 0; font-size: 15px; color: var(--dim); }

/* ---------- butterflies ----------
   The drawing is only a mask: its shape, filled with --bfly-ink,
   so pen-on-paper scans read as light ink on the dark page. */

.bfly { position: absolute; z-index: 2; display: block; width: 30px; aspect-ratio: 5 / 4; pointer-events: none;
  transform: rotate(var(--rot, 0deg)) scaleX(var(--flip, 1)); filter: var(--bfly-shadow); }
.bfly i { display: block; width: 100%; height: 100%; background: var(--bfly-ink);
  -webkit-mask: var(--bf) center / contain no-repeat; mask: var(--bf) center / contain no-repeat; }
.bfly--name { left: 100%; top: -15px; margin-left: 3px; }
.bfly--perch { right: 6%; top: -16px; width: 38px; }
