/* ==========================================================================
   Vy — ink & lilac
   White paper, black ink, one pastel lilac accent used sparingly:
   --accent (pastel) for highlights, --accent-ink (deep lilac) for action / hover; ochre = labels, sage = the garden.
   ========================================================================== */

:root {
  --paper: #ffffff;
  --paper-warm: #faf7f3;
  --ink: #211d1a;
  --ink-soft: #6f675f;
  --ink-faint: #b3aaa1;
  --line: #ebe5de;

  --accent: #e6dcf5;      /* lavande, pastel: highlights, selection, soft fills */
  --accent-ink: #7a5ca8;  /* the same lavande, deep enough to read as text: links, hovers, hand notes */
  --accent-display: color-mix(in srgb, var(--accent-ink) 65%, var(--accent)); /* softer, for big letters like her name */
  --ochre: #b98a3a;
  --sage: #7c8c6a;
  --sand: #f3ece2;

  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --hand: "Grape Nuts", "Bradley Hand", cursive; /* a handwriting with full Vietnamese accents */

  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

[hidden] { display: none !important; } /* hidden means hidden, whatever display a class sets */

/* Going from page to page (or to her admin and back), the browser keeps the current page up
   until the next one is ready, then fades from one to the other: no blank or unstyled frame. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* 404: her corgi, asleep, in the middle of an empty page. */
.lost { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 0 var(--gutter); text-align: center; }
.lost-corgi { width: min(340px, 78vw); height: auto; aspect-ratio: 2 / 1; margin-bottom: 8px; }
.lost h1 { margin: 0; font-weight: 400; font-size: clamp(26px, 3.4vw, 34px); }
.lost .kicker:hover { color: var(--accent-ink); }

/* Only for Vy, while she's logged in: a small handwritten "edit" right after the logo,
   where the admin has its "View site". */
/* Only for Vy, while she's logged in: the bottom-left corner of the page, folded down like a
   notebook page. A sliver of the other side shows underneath; it lifts a little under the
   pointer (or finger), and turning it goes to the admin, or from the admin back to the site. */
.page-corner {
  --fold: clamp(28px, 2.4vw, 38px); /* phone to big screen */
  position: fixed;
  left: 0; bottom: 0;
  z-index: 70;
  width: 60px; height: 60px; /* a comfortable target; the fold itself is smaller */
}
/* drawn as a tiny picture: the sand of the other side underneath, the flap (the back of this
   page, lighter towards its tip) and the soft shadow it casts */
.page-corner::before {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: calc(var(--fold) * 1.2); height: calc(var(--fold) * 1.2);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cdefs%3E%3ClinearGradient id='u' gradientUnits='userSpaceOnUse' x1='50' y1='70' x2='0' y2='120'%3E%3Cstop offset='0' stop-color='%23cdbfad'/%3E%3Cstop offset='.28' stop-color='%23e6dccd'/%3E%3Cstop offset='1' stop-color='%23f4ede3'/%3E%3C/linearGradient%3E%3ClinearGradient id='f' gradientUnits='userSpaceOnUse' x1='50' y1='70' x2='100' y2='20'%3E%3Cstop offset='0' stop-color='%23ddd4c8'/%3E%3Cstop offset='.35' stop-color='%23eee8df'/%3E%3Cstop offset='1' stop-color='%23fdfcfa'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-40%25' y='-40%25' width='180%25' height='180%25'%3E%3CfeGaussianBlur stdDeviation='4'/%3E%3C/filter%3E%3CclipPath id='c'%3E%3Cpath d='M0 20 L0 120 L100 120 Z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cpath d='M0 20 L0 120 L100 120 Z' fill='url(%23u)'/%3E%3Cg clip-path='url(%23c)' stroke-width='.9' fill='none'%3E%3Cpath d='M0 58 H120 M0 76 H120 M0 94 H120 M0 112 H120' stroke='%23b9a691' stroke-opacity='.45'/%3E%3Cpath d='M14 0 V120' stroke='%237a5ca8' stroke-opacity='.4'/%3E%3C/g%3E%3Cpath d='M4 15 L99 15 Q106 15 106 22 L106 117 Z' fill='rgba(33,29,26,.26)' filter='url(%23s)'/%3E%3Cpath d='M0 20 L93 20 Q100 20 100 27 L100 120 Z' fill='url(%23f)'/%3E%3Cpath d='M1 20.6 L93 20.6 Q99.4 20.6 99.4 27 L99.4 119' fill='none' stroke='%23fff' stroke-opacity='.8' stroke-width='1.1'/%3E%3Cpath d='M0 20 L100 120' stroke='rgba(33,29,26,.16)' stroke-width='1'/%3E%3C/svg%3E") left bottom / 100% 100% no-repeat;
  transition: width .35s var(--ease), height .35s var(--ease);
}
.page-corner:hover, .page-corner:focus-visible { --fold: calc(clamp(28px, 2.4vw, 38px) + 14px); outline: none; } /* it lifts */
@media (hover: none) { .page-corner:active { --fold: 42px; } }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

/* for screen readers only: keeps a page heading without showing one */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

:focus-visible { outline: 1.5px solid var(--accent-ink); outline-offset: 3px; }

/* Doodles are exported with transparent paper, so they sit on any background. */
.doodle { user-select: none; -webkit-user-drag: none; }

/* --- Small type ---------------------------------------------------------- */

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.kicker b { color: var(--ochre); font-weight: 500; }

.hand {
  font-family: var(--hand);
  color: var(--accent-ink);
  font-size: 1.35em;
  line-height: 1;
}

/* --- Top bar (inner pages) ---------------------------------------------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
}

.mark {
  font-size: 26px;
  letter-spacing: -.01em;
  line-height: 1;
}


.nav { display: flex; gap: clamp(14px, 3vw, 32px); font-size: 16px; }

.nav a { position: relative; color: var(--ink-soft); transition: color .2s; }
.nav a sup { font-family: var(--mono); font-size: 9px; margin-left: 2px; color: var(--ink-faint); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
/* The current page gets a quick hand-drawn scratch under it. Each menu item has its own
   stroke, tilt and reach, like four separate pen marks. */
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--scratch-left, -3px); right: var(--scratch-right, -6px); bottom: -1px;
  height: 6px;
  transform: rotate(var(--scratch-tilt, -1deg)) scaleX(var(--scratch-flip, 1));
  background: var(--scratch) center/100% 100% no-repeat;
  animation: scratch .45s var(--ease) both;
}
.nav a:nth-child(4n + 1) { --scratch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath fill='%237a5ca8' opacity='1' d='M3 8.2C22 6.6 48 6.9 74 5.6S108 4.1 117 3.2c.9-.1 1.1 1 .2 1.2C104 6.6 80 7.7 55 8.7S16 10.4 4 10.1c-1.6 0-1.8-1.8-1-1.9Z'/%3E%3C/svg%3E"); --scratch-tilt: -1.5deg; --scratch-left: -3px; --scratch-right: -8px; }
.nav a:nth-child(4n + 2) { --scratch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath fill='%237a5ca8' opacity='1' d='M2 5.6C20 7.8 44 8.6 66 8S100 6.2 113 4.4c1.3-.2 2.4-1.4 3.4-1.1.8.3.4 1.4-.4 1.8C102 8.4 80 10 58 10.4S18 9.6 3 7.6c-1.4-.2-2-2.1-1-2Z'/%3E%3C/svg%3E"); --scratch-tilt: 0.8deg; --scratch-left: -2px; --scratch-right: -4px; }
.nav a:nth-child(4n + 3) { --scratch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath fill='%237a5ca8' opacity='1' d='M3 8.2C22 6.6 48 6.9 74 5.6S108 4.1 117 3.2c.9-.1 1.1 1 .2 1.2C104 6.6 80 7.7 55 8.7S16 10.4 4 10.1c-1.6 0-1.8-1.8-1-1.9Z'/%3E%3C/svg%3E"); --scratch-tilt: 1.2deg; --scratch-left: -6px; --scratch-right: -2px; --scratch-flip: -1; }
.nav a:nth-child(4n + 4) { --scratch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath fill='%237a5ca8' opacity='1' d='M2 5.6C20 7.8 44 8.6 66 8S100 6.2 113 4.4c1.3-.2 2.4-1.4 3.4-1.1.8.3.4 1.4-.4 1.8C102 8.4 80 10 58 10.4S18 9.6 3 7.6c-1.4-.2-2-2.1-1-2Z'/%3E%3C/svg%3E"); --scratch-tilt: -0.6deg; --scratch-left: -2px; --scratch-right: -4px; --scratch-flip: -1; }

@keyframes scratch { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

@media (max-width: 560px) { /* phones: one quiet line, "vy" on the left and the sections on the right */
  .bar { flex-wrap: wrap; align-items: baseline; row-gap: 8px; padding-block: 16px; }
  .bar .nav { margin-left: auto; font-size: 15px; gap: 14px; }
  .bar .mark { font-size: 22px; } /* ("ha-vy" and the four sections share one line) */
}
@media (max-width: 400px) {
  .bar .nav { font-size: 14px; gap: 11px; }
  .bar .mark { font-size: 21px; }
}
@media (max-width: 350px) {
  .bar .nav { font-size: 13px; gap: 9px; }
  .bar .mark { font-size: 19px; }
}
/* a finger needs more room than the words: each link reaches a little past its letters, invisibly */
@media (pointer: coarse) {
  .mark, .lost .kicker { position: relative; }
  .mark::before, .nav a::before { content: ""; position: absolute; inset: -12px -6px; }
  .lost .kicker::before { content: ""; position: absolute; inset: -14px -16px; } /* the 404's way home */
}
/* a phone on its side: a slimmer bar, so the page keeps its height */
@media (max-width: 1299px) and (max-height: 500px) and (orientation: landscape) {
  .bar { padding-block: 10px; }
}


/* ==========================================================================
   Home — the doodle doors
   ========================================================================== */

.home {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding-bottom: clamp(32px, 6vw, 64px);
}

.home-head {
  text-align: center;
  padding: clamp(40px, 8vh, 88px) var(--gutter) 0;
}

.home-name {
  display: inline-block;
  margin: 0;
  font-weight: 300;
  font-size: clamp(44px, 7vw, 76px);
  letter-spacing: -.02em;
  line-height: 1;
}

.doors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 48px);
  align-items: start;
  align-self: center;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(32px, 6vh, 72px) var(--gutter);
}

@media (max-width: 900px) { .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 56px; } }
/* laptops and up: room on both sides of the four drawings, and on a short window smaller drawings */
@media (min-width: 901px) {
  .doors { max-width: min(1180px, 80vw); }
  .door-art { max-width: clamp(170px, 26vh, 260px); }
}
/* on a phone, upright or on its side, her drawings a touch smaller */
@media (max-width: 560px), (max-width: 1299px) and (max-height: 500px) and (orientation: landscape) { .door .door-art { width: 87%; max-width: 226px; } }

.door { display: flex; flex-direction: column; align-items: center; text-align: center; }

.door-art { position: relative; width: 100%; max-width: 260px; aspect-ratio: 5 / 6; min-height: 0; } /* (min-height: 0, so a drawing never stretches its box: titles line up) */

.door-art img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform .5s var(--ease);
}

.door-note {
  position: absolute;
  top: var(--y); left: var(--x);
  transform: rotate(var(--tilt)) scale(.9);
  opacity: 0;
  transition: opacity .25s, transform .4s var(--ease);
  white-space: nowrap;
}

.door:hover .door-art img, .door:focus-visible .door-art img, .door.is-going .door-art img { transform: translateY(-6px) rotate(-1.5deg); }
.door:hover .door-note, .door:focus-visible .door-note, .door.is-going .door-note { opacity: 1; transform: rotate(var(--tilt)) scale(1); }
/* each note in an empty corner of its own drawing, clear of her, the corgi and the music */
/* Work's drawing is a wide scene (duck, corgi, her), so she comes out smaller than in the
   others: grow it from the feet up until she matches them. */
.door-art .art-work { scale: 1.16; transform-origin: 50% 100%; }
.note-about       { --x: 10%; --y: 17%; --tilt: -7deg; } /* by her face, left of the headphones, above the little note */
.note-inspiration { --x: 70%; --y: 7%; --tilt: -6deg; } /* up by her head, like a speech bubble */
.note-thoughts    { --x: 50%; --y: 19%; --tilt: -4deg; translate: -50% 0; } /* centred, high in the empty sky over the bath */
.note-work        { --x: 8%;  --y: 26%; --tilt: -8deg; } /* behind her, above the corgi and the duck */
/* on a phone her drawings are small: the notes shrink with them and step into the empty paper around her */
@media (max-width: 560px), (max-width: 1299px) and (max-height: 500px) and (orientation: landscape) {
  .door-note { font-size: 17px; }
  .note-about       { --x: 2%;  --y: 4%; }
  .note-inspiration { --x: 66%; --y: 2%; }
  .note-thoughts    { --y: 12%; }
  .note-work        { --x: 2%;  --y: 14%; }
}
@media (max-width: 1299px) and (max-height: 500px) and (orientation: landscape) { .door-note { font-size: 20px; } } /* (sideways, she's drawn bigger) */

.door h2 {
  margin: 18px 0 0;
  font-size: 21px;
  font-weight: 200; /* the font's lightest, a little small: the eye goes to her drawings first */
  line-height: 1.1;
}

/* ==========================================================================
   Work — one endless reel of her real pages; the strip underneath marks what's passing
   ========================================================================== */

.work {
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.reel {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  touch-action: pan-y; /* sideways is hers to drag; up and down still scrolls the page */
  user-select: none;
  cursor: grab;
  /* it goes on forever: the sides fade out instead of stopping */
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}
.reel.is-dragging { cursor: grabbing; }
.reel-track {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.2vw, 32px);
  height: min(85vh, 100%);
  padding-block: 2vh;
  will-change: transform;
}
.slide {
  flex: 0 0 auto;
  height: 100%;
  display: block;
  -webkit-user-drag: none;
}
.slide img {
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
  background: var(--paper-warm);
  box-shadow: 0 18px 40px -30px rgba(33, 29, 26, .45);
  -webkit-user-drag: none;
  pointer-events: none;
}
.slide.is-doodle img { box-shadow: none; } /* a doodle sits on the paper, a page floats a little */
.slide-blank { height: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 8%; background: var(--paper-warm); font-size: 22px; text-align: center; } /* a project with no picture yet */
.slide:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 6px; }

.strip {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  padding: 16px var(--gutter) 20px;
  scrollbar-width: none;
  /* it goes on forever: the ends fade out instead of stopping */
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}
.strip::-webkit-scrollbar { display: none; }

.strip button {
  flex: 0 0 auto;
  display: grid;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-faint);
  transition: color .2s;
}
.strip button small { font-size: 11.5px; }
.strip button:hover { color: var(--ink-soft); }
.strip button[aria-current="true"] { color: var(--ink); }

.work-foot { min-width: 0; }

/* Smaller screens and tablets: a page never runs off the screen. Each card is as tall as the reel
   allows, but no wider than most of the screen (its proportions, --r, come from work.js), so the
   next and previous ones always peek in at the sides. */
@media (max-width: 1299px), (pointer: coarse) {
  .work { --card-max: 82vw; }
  .slide { height: min(100%, calc(var(--card-max) / var(--r, 1.3333))); }
  .slide img, .slide-blank { max-width: var(--card-max); }
}
@media (max-width: 1100px) and (orientation: portrait) { .work { --card-max: 72vw; } } /* upright tablets */
@media (max-width: 760px) and (orientation: portrait) { .work { --card-max: 80vw; } } /* upright phones */
/* her project names: bigger to read on a phone, and tall enough for a finger */
@media (pointer: coarse) { .strip button { padding-block: 6px; } }
@media (max-width: 560px) {
  .strip { gap: 20px; }
  .strip button { font-size: 14px; }
  .strip button small { font-size: 12.5px; }
}
/* a phone on its side: less paper around the names, more room for the pages */
@media (max-width: 1299px) and (max-height: 500px) and (orientation: landscape) { .strip { padding-block: 6px 10px; } }

/* phones and upright tablets: the reel a bit shorter, the page can scroll */
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  .work { height: auto; min-height: 100svh; }
  .reel-track { height: 68svh; }
}
/* upright, the screen is taller than her pages need: the reel and its names sit together in the
   middle, the reel only as tall as an upright page at full width */
@media (max-width: 1100px) and (orientation: portrait) {
  .work { grid-template-rows: auto 1fr auto auto 1fr; }
  .reel { grid-row: 3; }
  .work-foot { grid-row: 4; }
  .reel-track { height: min(68svh, var(--card-max) * 1.42); }
}

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-soft);
}


/* ==========================================================================
   About
   ========================================================================== */

.about {
  padding: clamp(24px, 5vw, 64px) var(--gutter) 40px;
}

/* A letter from her: one narrow column, written to you, signed */
.letter { max-width: 640px; margin: 0 auto; padding-top: 12px; }
.letter-dear { font-size: 30px; margin: 0 0 22px; }
.letter-body p, .letter-ps p { margin: 0 0 20px; }
.letter-body { font-size: 18px; line-height: 1.7; }
.letter a { border-bottom: 1px solid var(--line); transition: color .2s, border-color .2s; }
.letter a:hover { color: var(--accent-ink); border-color: var(--accent-ink); }
.letter-sign { font-size: 44px; margin: 30px 0 34px; color: var(--accent-display); transform: rotate(-4deg); transform-origin: left; }
.letter-ps { font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
.letter-ps a { color: var(--ink); }
/* on a phone the letter reads a touch smaller: more of it fits beside the dive */
@media (max-width: 560px) {
  .letter-dear { font-size: 25px; }
  .letter-body { font-size: 15.5px; line-height: 1.65; }
  .letter-sign { font-size: 37px; }
  .letter-ps { font-size: 14px; }
}
.highlight { background: linear-gradient(transparent 62%, var(--accent) 62%); }

/* About, while Vy edits it inside the admin: just the page, her words outlined faintly, and a
   little bar over what she selects (bold, italic, highlighter, link) */
.is-editing-words .bar { display: none; }
.is-editing-words [data-edit] { outline: 1px dashed color-mix(in srgb, var(--accent-ink) 45%, transparent); outline-offset: 5px; border-radius: 2px; cursor: text; }
.is-editing-words [data-edit]:focus { outline-style: solid; }
.is-editing-words [data-edit]:empty::before { content: "…"; color: var(--ink-faint); }
.word-tools {
  position: absolute; z-index: 30; display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .08); font: 14px/1 var(--sans); color: var(--ink);
}
.word-tools[hidden] { display: none; }
.word-tools button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; }
.word-tools button:hover, .word-tools button[aria-pressed="true"] { background: var(--accent); }
.word-tools .wt-b { font-weight: 700; }
.word-tools .wt-i { font-style: italic; font-family: Georgia, serif; }
.word-tools .wt-hl span { background: linear-gradient(transparent 55%, color-mix(in srgb, var(--accent-ink) 35%, var(--accent)) 55%); padding: 0 2px; }
.word-tools input { width: 230px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; font: 13px var(--mono); }
.word-tools input:focus { outline: none; border-color: var(--accent-ink); }
.word-tools input.is-wrong { border-color: #c4574b; }
.word-tools .wt-buttons, .word-tools .wt-link { display: flex; align-items: center; gap: 2px; }
.word-tools .wt-buttons[hidden], .word-tools .wt-link[hidden], .word-tools button[hidden] { display: none; }
/* editing on a phone or tablet: fingertip-sized buttons, a link box that fits the screen (and at
   16px, so the phone doesn't zoom into it), and no hover colour left behind by a tap */
@media (pointer: coarse) {
  .word-tools { max-width: calc(100vw - 16px); }
  .word-tools button { min-width: 44px; height: 44px; }
  .word-tools .wt-link { flex: 1 1 auto; min-width: 0; }
  .word-tools input { flex: 1 1 auto; min-width: 0; height: 44px; font-size: 16px; }
}
@media (hover: none) { .word-tools button:hover:not([aria-pressed="true"]) { background: none; } }
.is-editing-words .dive { display: none; } /* (the admin's frame is as tall as the page: no sea to pin) */
.is-editing-words .deep { padding-right: 0; } /* (and no lane kept for it: her letter gets the whole width) */

/* --- The dive: the About page is the sea, and Vy freedives down it as you scroll ---
   A rope runs down a lane on the right, from a buoy at the top of the page to a seabed below the
   last words. dive.js moves her down it with your scroll, from the buoy at the top of the page to
   the seabed at the bottom (a little faster than the page, so you see her dive), duck dives from the surface, kicks (faster the
   faster you scroll), glides when you stop, rolls round to swim up when you scroll back, and lets bubbles out. */
.about { overflow-x: clip; } /* stray bubbles never make the page scroll sideways */
.deep {
  --dive-w: clamp(170px, 20vw, 260px);           /* the lane */
  --diver-h: clamp(170px, 28vh, 240px);
  --body-w: calc(var(--diver-h) * .245);          /* her drawing's own proportions */
  --kick: calc(var(--diver-h) * .07);             /* room either side for her legs to wave */
  --diver-w: calc(var(--body-w) + var(--kick) * 2);
  --octo-w: calc(var(--dive-w) * .32);             /* smaller than Vy */
  --rope-w: calc(var(--dive-w) * .0246);          /* the rope (the octopus's own bit of rope is cut out of its drawing) */
  --rope-line: calc(var(--dive-w) * .01);         /* the same weight as the buoy and seabed drawings (~2px) */
  --buoy-w: calc(var(--dive-w) * .8);
  --buoy-h: calc(var(--buoy-w) * 232 / 509);
  --sea-w: calc(var(--dive-w) * 1.5);
  --sea-h: calc(var(--sea-w) * 151 / 1359);
  --rope-x: 40%;                                  /* octopus on the left of the rope, Vy on the right */
  --bar-h: 65px;                                  /* the sticky top bar */
  position: relative;
  max-width: calc(1180px - 2 * var(--gutter));
  margin: 0 auto;
  padding-right: calc(var(--dive-w) + 12px);
  padding-bottom: 96px;                           /* the sea is pinned beside the words: no deep water needed under them */
}
/* Wide screens: the words sit centred on the page, and the whole dive (buoy, rope, Vy, octopus,
   seabed) sits in the letter's right margin, like a doodle beside it. */
@media (min-width: 1300px) {
  .deep {
    --dive-w: 190px;
    --diver-h: clamp(160px, 24vh, 210px);
    max-width: 900px;
    padding-right: 0;
  }
  /* a doodle in the letter's margin: just past its right edge (the letter is 640px, centred) */
  .deep .dive { left: calc(50% + 320px + 36px); right: auto; }
}
.dive { position: absolute; top: 0; right: 0; bottom: 0; width: var(--dive-w); pointer-events: none; overflow-y: clip; } /* her canvas, bubbles and specks never make the page taller */
/* the sea itself stays in view beside the words, under the top bar: buoy at the top of the screen,
   seabed at the bottom; she travels down it as you go down the page */
/* pinned: the whole height under the top bar, and it never moves while the words scroll past
   (dive.js sets --lane-left, where the lane is across the page) */
.dive-view { position: fixed; top: calc(var(--bar-h) + 22px); left: var(--lane-left, auto); width: var(--dive-w); height: calc(100vh - var(--bar-h) - 44px); height: calc(100svh - var(--bar-h) - 44px); } /* (svh: a phone's address bar coming and going never stretches the sea) */
.dive img { max-width: none; } /* the seabed is wider than the lane */
/* the scenery in pencil, so only she is drawn in full ink */
.dive-buoy, .dive-rope, .dive-seabed { opacity: .42; } /* (the octopus is a character: full ink, like her) */
.dive-buoy { position: absolute; top: 0; width: var(--buoy-w); left: calc(var(--rope-x) + var(--rope-w) / 2 - var(--buoy-w) * .501); z-index: 1; }
.dive-rope {
  position: absolute; left: var(--rope-x);
  top: calc(var(--buoy-h) - 3px); bottom: calc(var(--sea-h) - 4px);
  width: var(--rope-w);
  border-inline: var(--rope-line) solid var(--ink);
}
.dive-octopus {
  position: absolute; top: 50%; width: var(--octo-w);
  left: calc(var(--rope-x) + var(--rope-w) / 2 - var(--octo-w) * .8667); /* where its tentacles wrap, centred on our rope */
  transform-origin: 83% 55%;
}
.dive-seabed { position: absolute; bottom: 0; width: var(--sea-w); left: calc(var(--rope-x) + var(--rope-w) / 2 - var(--sea-w) * .3113); } /* its sand runs off away from the words */
.dive-water { position: absolute; left: 0; right: 0; top: calc(var(--buoy-h) + 8px); bottom: calc(var(--sea-h) + 4px); }
.dive-diver {
  position: absolute; top: 0; left: 0; will-change: transform; /* dive.js moves her down the rope */
  width: var(--diver-w); height: var(--diver-h);
  margin-left: calc(var(--rope-x) + var(--rope-w) - var(--body-w) * .015 - var(--kick)); /* right by the rope */
}
.dive-sway { width: 100%; height: 100%; animation: dive-sway 6s ease-in-out infinite; }
/* dive.js draws her on a canvas three times her height each way, centred on her box: lying on the
   surface, piking in the duck dive or folding in a roll, she reaches well outside her box */
.dive-turn { position: absolute; top: calc(50% - var(--diver-h) * 1.5); left: calc(50% - var(--diver-h) * 1.5); display: block; width: calc(var(--diver-h) * 3); height: calc(var(--diver-h) * 3); transition: opacity .16s; }
/* the moments at the surface and on the seabed: other drawings of her, faded in over the swimmer */
.dive-sway { position: relative; }
.dive.is-posed .dive-turn { opacity: 0; }
.dive-pose { position: absolute; opacity: 0; transition: opacity .16s, transform .3s ease-out; }
.dive-pose.is-on { opacity: 1; }
/* a touch bigger than her side drawing (5%: folded up she reads small next to her swimming), straight below where she swims: no sideways slide landing or leaving */
.dive-crouch { bottom: calc(var(--sea-h) * -.8 - 4px); /* feet on the sand line, below the water's edge */ left: calc(var(--kick) + var(--body-w) * .67 - var(--diver-h) * .127); height: calc(var(--diver-h) * .69); transform: translate(-50%, 6%) scaleY(.92); transform-origin: 50% 100%; }
.dive-crouch.is-on { transform: translate(-50%, 0); }
.dive-crouch.is-on.is-loading { transform: translate(-50%, 0) scaleY(.94); transition: opacity .16s, transform .22s ease-in; } /* sinking into the push */
.dive-bubble {
  position: absolute; width: var(--b, 8px); height: var(--b, 8px);
  border: 1.5px solid var(--ink-soft); border-radius: 50%;
  animation: dive-bubble var(--t, 1.8s) ease-out forwards;
}
.dive-speck { /* a speck in the water, drifting up past her as she sinks */
  position: absolute; width: var(--s, 2px); height: var(--s, 2px);
  border-radius: 50%; background: var(--ink); opacity: 0;
  animation: dive-speck var(--t, 3s) linear forwards;
  pointer-events: none;
}
@keyframes dive-speck {
  0% { transform: translate(0, 0); opacity: 0; }
  20% { opacity: .35; }
  80% { opacity: .25; }
  100% { transform: translate(var(--dx, 4px), calc(var(--rise, 120px) * -1)); opacity: 0; }
}
@keyframes dive-sway {
  0%, 100% { transform: translate(0, 0) rotate(-1deg); }
  50% { transform: translate(2px, 4px) rotate(1deg); }
}
@keyframes dive-bubble {
  0% { transform: translate(0, 0) scale(.6); opacity: 0; }
  15% { opacity: 1; }
  50% { transform: translate(var(--dx, 6px), calc(var(--rise, 180px) * -.5)) scale(1); }
  100% { transform: translate(calc(var(--dx, 6px) * -.5), calc(var(--rise, 180px) * -1)) scale(1.1); opacity: 0; }
}
@media (max-width: 860px) {
  .deep { --dive-w: 120px; --diver-h: 170px; padding-right: 106px; }
  .dive { right: -10px; }
}
@media (max-width: 560px) {
  .deep { --dive-w: 90px; --diver-h: 92px; padding-right: 80px; } /* (lying on the surface she's about as long as the lane, not longer) */
  .dive { right: calc(var(--gutter) * -1 + 4px); }
  .dive-seabed { left: calc(var(--rope-x) + var(--rope-w) / 2 - var(--sea-w) * .2); } /* its sand stays clear of the words */
}
/* a phone on its side: the sea is short, so she's drawn smaller, with water left to swim down */
@media (max-width: 1299px) and (max-height: 500px) {
  .deep { --diver-h: clamp(96px, 28svh, 170px); }
}
@media (prefers-reduced-motion: reduce) {
  .dive-sway { animation: none; }
  .dive-turn, .dive-pose { transition: none; }
  .dive-bubble, .dive-speck { display: none; }
}
@media print { .dive { display: none; } .deep { padding: 0; } }

/* ==========================================================================
   Garden — a playful gate, then notes floating on a pond (or a sphere)
   ========================================================================== */

.gate {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.gate main { display: grid; place-items: center; padding: var(--gutter); padding-bottom: 12svh; text-align: center; }

.gate form { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 360px; }
.gate-corgi { width: min(300px, 70vw); height: auto; aspect-ratio: 2 / 1; margin-bottom: 4px; }
.gate h1 { margin: 0; font-weight: 400; font-size: 34px; }

.gate input {
  width: 100%;
  margin-top: 8px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  font: inherit;
  font-size: 20px;
  text-align: center;
  outline: none;
}
.gate input:focus { border-color: var(--sage); }

.gate-hint { min-height: 1.4em; }
/* a phone on its side: a smaller corgi, so the question, the answer and her hint all fit above the fold */
@media (max-width: 1299px) and (max-height: 500px) {
  .gate main { padding-block: 8px; }
  .gate-corgi { width: min(300px, 40svh); }
  .gate h1 { font-size: 28px; }
}
.gate.is-wrong form { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

.garden { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
.garden[hidden] { display: none; }
.garden .bar { position: absolute; inset: 0 0 auto; z-index: 20; background: transparent; backdrop-filter: none; }
.garden:has(.garden-list:not([hidden])) .bar { background: var(--paper); } /* the list scrolls under the top line: paper behind it, so the two never overlap */

/* the sphere: every note sits at the centre and garden.js moves it in 3D */
.garden .stage { position: absolute; inset: 0; z-index: 0; touch-action: none; overflow: hidden; } /* (Work has its own .stage) */
.sphere { cursor: grab; }
.sphere.is-dragging { cursor: grabbing; }



.seed {
  position: absolute;
  left: 50%; top: 50%;
  width: 210px;
  text-align: left;
  will-change: transform, opacity;
  transform-origin: center;
}

/* Sphere titles: just words floating in space. A soft paper-coloured halo keeps them
   readable when they drift in front of a doodle. */
.seed-note { padding: 6px 4px; background: none; text-align: center; }
.seed-note h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  text-shadow: 0 0 6px var(--paper), 0 0 12px var(--paper);
  transition: color .2s;
}
.seed-note:hover h3 { color: var(--accent-ink); }

.seed-doodle { width: 170px; }
.seed-doodle img { width: 100%; }

/* The pond: titles float on still water, newest in ink, older ones a little paler,
   as if further out. */
.pond .ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; } /* (a canvas keeps its pixel size unless told: on a phone that doubled the ink's position) */
.pond .ink-cloud { filter: blur(5px); } /* ink spreading in water: soft edges, no lines */
/* with a mouse or trackpad, the pointer becomes her quill, nib at the tip (not on touch screens) */
@media (pointer: fine) {
  .garden:not(.is-reading) .pond {
    cursor: url("/assets/cursors/plume.png") 2 30, crosshair;
    cursor: -webkit-image-set(url("/assets/cursors/plume.png") 1x, url("/assets/cursors/plume@2x.png") 2x) 2 30, crosshair;
    cursor: image-set(url("/assets/cursors/plume.png") 1x, url("/assets/cursors/plume@2x.png") 2x) 2 30, crosshair;
  }
}
.leaf {
  position: absolute;
  left: 0; top: 0;
  max-width: 230px;
  padding: 4px 6px;
  text-align: center;
  will-change: transform;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.pond.is-ready .leaf { opacity: calc(1 - var(--age) * .45); }
.leaf h3 {
  margin: 0;
  font-size: calc(23px - var(--age) * 4px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  transition: color .2s;
}
.leaf:hover h3, .leaf:focus-visible h3 { color: var(--accent-ink); }
/* with a finger, each title answers a little around its words too (the pond keeps them apart) */
@media (pointer: coarse) { .leaf::before { content: ""; position: absolute; inset: -6px -2px; } }

/* Pond / list: one small pencil icon in the corner, showing the other view; a tap swaps them. */
.mode {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink-faint);
  transition: color .2s;
}
.mode:hover { color: var(--ink-soft); }
.mode svg {
  grid-area: 1 / 1;
  width: 26px; height: 26px;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
  transition: opacity .25s, transform .4s var(--ease);
}
.mode .icon-pond, .mode.is-list .icon-list { opacity: 0; transform: rotate(-40deg) scale(.6); }
.mode.is-list .icon-pond { opacity: 1; transform: none; }

.garden-list { position: absolute; inset: 0; overflow-y: auto; padding: 110px var(--gutter) 120px; }
.garden-list[hidden] { display: none; }
/* two columns of notes side by side (one on phones), filled row by row so newest stay on top */
.garden-list ol { list-style: none; margin: 0 auto; padding: 0; max-width: 1080px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(28px, 5vw, 72px); }
@media (max-width: 700px) { .garden-list ol { grid-template-columns: 1fr; } }
.garden-list li button {
  width: 100%;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 20px;
}
.garden-list li button:hover { color: var(--sage); }


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

/* ==========================================================================
   Project — the case study: pages stacked like a printed portfolio
   ========================================================================== */

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: 2px;
  background: var(--accent-ink);
  transform: scaleX(0);
  transform-origin: left;
}

.case { padding: 0 var(--gutter) 40px; }
.case-missing { text-align: center; padding: 120px 0; }

/* one quiet line above the pages: title, client and year, then the summary; it wraps only when it must */
.case-head { max-width: 1240px; margin: 0 auto; padding: clamp(20px, 3vw, 36px) 0 clamp(14px, 1.6vw, 22px); display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 18px; row-gap: 4px; }
.case-head h1 { margin: 0; font-weight: 400; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -.015em; }
.case-head .kicker { white-space: nowrap; }
.case-head p { margin: 0 0 0 auto; color: var(--ink-soft); font-size: 15px; }

/* pages sit edge to edge, so a deck reads as one continuous piece */
.case-stack { display: flex; flex-direction: column; max-width: 1240px; margin: 0 auto; }
.case-stack > .case-media + .case-media { margin-top: -1px; } /* hides hairline seams from sub-pixel rounding */

.case-media { margin: 0; opacity: 0; transition: opacity .7s var(--ease); } /* fade only: sliding would open gaps */
.case-media.is-in, .case-text.is-in { opacity: 1; transform: none; }
.case-media img.full { position: relative; width: 100%; height: auto; opacity: 0; transition: opacity .5s var(--ease); }
.case-media.is-loaded img.full { opacity: 1; }
.case-media img.lqip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px); transform: scale(1.04); }
.case-media { overflow: hidden; background: var(--paper-warm); }
.case-media.is-loaded { background: none; }
.case-video video { width: 100%; display: block; background: var(--ink); }
.case-embed { position: relative; aspect-ratio: 16 / 9; }
.case-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.case-text { max-width: 640px; margin: clamp(24px, 5vw, 64px) auto; opacity: 0; transition: opacity .7s var(--ease); }
.case-text p { margin: 0 0 16px; font-size: clamp(19px, 1.8vw, 22px); line-height: 1.5; }

/* Saving the pages takes a bit more effort: a clear layer sits over each one. */
.protect { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.protect img { pointer-events: none; }
.protect:not(.case-video)::after { content: ""; position: absolute; inset: 0; }
@media print { .case-stack { display: none; } }

.case-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  max-width: 1240px;
  margin: clamp(48px, 8vw, 104px) auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.case-foot a:hover { color: var(--accent-ink); }
.case-prev, .case-next { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: clamp(22px, 3vw, 34px); }
.case-prev { align-items: flex-start; text-align: left; }
.case-next { align-items: flex-end; text-align: right; margin-left: auto; }
.case-foot > .kicker { white-space: nowrap; }
@media (max-width: 620px) { /* phones: previous and next on their own lines */
  .case-foot { flex-direction: column; align-items: stretch; gap: 22px; }
  .case-next { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .case-media, .case-text { opacity: 1; transform: none; }
}

/* ==========================================================================
   Thought garden article — her blog: a calm column with room for her voice
   ========================================================================== */

.article { padding: 0 var(--gutter) 40px; }
.article { --col: 760px; }

.article-head { max-width: var(--col); margin: clamp(28px, 5vw, 64px) auto 0; }
.article-head .kicker { color: var(--sage); }
.article-head h1 { margin: 14px 0 0; max-width: 16ch; font-weight: 400; font-size: clamp(40px, 5.6vw, 72px); line-height: 1.02; letter-spacing: -.025em; text-wrap: balance; }

.article-cover { max-width: 860px; margin: clamp(22px, 3vw, 40px) auto 0; }
/* Pictures size themselves, whatever she uploads. Wide ones use the column, tall ones and
   drawings stay narrower, nothing is shown bigger than it is. The cover keeps to about 45% of
   the screen, so the title, the picture and the first words all fit on the first screen
   (laptop or phone); pictures in the text always fit the screen whole when you reach them. */
.article-cover { display: flex; justify-content: center; }
.article-cover img { width: auto; max-width: 100%; height: auto; max-height: min(45svh, 560px); }

.article-body { max-width: var(--col); margin: clamp(26px, 4vw, 48px) auto 0; font-size: 21px; line-height: 1.7; }
.article-body > * { margin: 0 0 26px; }
.article-body h2 { margin: 56px 0 14px; font-weight: 500; font-size: 32px; line-height: 1.15; letter-spacing: -.01em; }
.article-body h3 { margin: 36px 0 10px; font-weight: 500; font-size: 22px; }
.article-body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-ink) 60%, transparent); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.article-body a:hover { color: var(--accent-ink); }
.article-body mark { background: color-mix(in srgb, var(--accent) 70%, transparent); color: inherit; padding: 1px 3px; border-radius: 3px; }
.article-body ul, .article-body ol { padding-left: 1.2em; }
.article-body li { margin-bottom: 8px; }
.article-body li::marker { color: var(--sage); }
.article-body blockquote {
  margin: 48px 0;
  padding: 0 0 0 28px;
  border-left: 1.5px solid var(--accent-ink);
  font-size: clamp(25px, 2.8vw, 32px);
  line-height: 1.35;
}
.article-body .scratch-rule { height: 10px; width: 120px; margin: 48px auto; border: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath fill='%237a5ca8' opacity='1' d='M2 5.6C20 7.8 44 8.6 66 8S100 6.2 113 4.4c1.3-.2 2.4-1.4 3.4-1.1.8.3.4 1.4-.4 1.8C102 8.4 80 10 58 10.4S18 9.6 3 7.6c-1.4-.2-2-2.1-1-2Z'/%3E%3C/svg%3E") center/100% 100% no-repeat; }

/* her handwriting: a little note in the margin of her own text */
.hand-note { font-family: var(--hand); font-size: 28px; line-height: 1.15; color: var(--accent-ink); transform: rotate(-2deg); padding-left: 12px; }
@media (min-width: 1360px) {
  .hand-note { float: right; clear: right; width: 220px; margin: 0 -260px 16px 24px !important; padding: 0; transform: rotate(-3deg); }
  .hand-note.is-left { float: left; clear: left; margin: 0 24px 16px -260px !important; text-align: right; transform: rotate(2.5deg); }
}
.hand-inline { font-family: var(--hand); font-size: 1.3em; line-height: 1; color: var(--accent-ink); }

/* images may step a little outside the text column */
.article-body figure { margin: 36px -90px; }
.article-body figure img { width: auto; max-width: 100%; max-height: min(75svh, 820px); height: auto; margin: 0 auto; border-radius: 2px; }
.article-body figcaption { margin-top: 10px; padding: 0 90px; font-size: 15px; color: var(--ink-soft); text-align: center; }
.post-gallery { display: grid; gap: 12px; margin: 36px -90px !important; }
.post-gallery.cols-2 { grid-template-columns: 1fr 1fr; }
.post-gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.post-gallery figure { margin: 0; }
.post-gallery figure img { max-height: 60vh; }
.post-gallery figcaption { padding: 0; }
@media (max-width: 900px) {
  .article-body figure, .post-gallery { margin-left: 0 !important; margin-right: 0 !important; }
  .article-body figcaption { padding: 0; }
}

.article-foot { display: flex; justify-content: space-between; gap: 24px; max-width: var(--col); margin: 96px auto 0; padding-top: 0; }
.article-foot a { display: flex; flex-direction: column; gap: 4px; max-width: 45%; font-size: 20px; line-height: 1.25; }
.article-foot a.newer { text-align: right; align-items: flex-end; }
.article-foot a:hover { color: var(--sage); }

/* ==========================================================================
   Inspiration — a jam-packed mood board: pictures and notes, edge to edge
   ========================================================================== */

.notes {
  --seam: 3px;
  display: flex;
  gap: var(--seam);
  padding: 0 var(--seam) var(--seam);
}
.notes > .kicker { padding: 40px var(--gutter); }
.notes-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--seam); }
/* pictures keep their exact shape; notes grow a little so every column ends on one line */
.notes-col > figure { flex: none; }
.notes-col > .note-text { flex: 1 0 auto; }

.note { margin: 0; overflow: hidden; animation: settle .7s var(--ease) both; }
@keyframes settle { from { opacity: 0; transform: translateY(10px); } }
figure.note { display: flex; background: var(--paper-warm); cursor: zoom-in; }
/* until a picture arrives, its tiny blurred preview holds the spot (the picture paints over it) */
figure.note { position: relative; }
.notes .note img.doodle { position: relative; z-index: 1; }
.notes .play-badge { z-index: 2; }
.notes .note img.lqip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px); transform: scale(1.06); }
.note img { width: 100%; height: auto; transition: transform .6s var(--ease); }
figure.note:hover img { transform: scale(1.03); }
/* written notes zoom the same way: paper and words grow together, inside the note's edges */
.notes .note-text { clip-path: inset(0); }
/* "a square at least" without aspect-ratio: Safari turned a stretched note's new height into its
   width too, so notes burst out of their columns (WebKit bug 315254). An invisible strut as tall as the
   note is wide (padding % is of the width) does the same job in every browser. */
.notes-col > .note-text { aspect-ratio: auto; } /* (.notes-col: the hidden ruler measures them the same way) */
.notes-col > .note-text::after { content: ""; flex: none; width: 0; padding-bottom: 100%; }
.notes .note-text p, .notes .note-text::before { transition: transform .6s var(--ease); }
.notes .note-text:hover p, .notes .note-text:hover::before { transform: scale(1.03); }
/* on a touch screen a tap would leave a note zoomed in: they stay still */
@media (hover: none) {
  figure.note:hover img, .notes .note-text:hover p, .notes .note-text:hover::before { transform: none; }
}

/* notes are little squares of coloured paper; she picks the colour and the paper */
.note-text {
  position: relative;
  display: flex;
  align-items: center;
  overflow: visible; /* a square at least; taller when the words need it */
  aspect-ratio: 1;
  padding: clamp(16px, 2vw, 28px);
  background: var(--sand);
  color: var(--ink);
}
.note-text p { position: relative; z-index: 1; margin: 0; }

/* How her words sit on the note: font, size, place (3x3) and alignment.
   S, M and L are even steps (each 1/3 bigger than the one below), the same in every font. */
.note-text {
  --note-font: var(--sans); --note-style: normal; --k: 1;
  --m: clamp(16px, 1.5vw, 21px); --step: 1; --base: calc(var(--m) * var(--step)); --note-width: 84%;
  justify-content: flex-start;
}
.note-text p, .note-text textarea[data-autogrow], .note-text .note-words {
  width: var(--note-width);
  font: var(--note-style) calc(var(--base) * var(--k) * var(--fit, 1)) / 1.3 var(--note-font);
  text-align: var(--note-align, left);
}
.note-text.font-hand { --note-font: var(--hand); --note-style: normal; --k: 1.35; }
/* marks on chosen words */
.note-text strong { font-weight: 600; }
.note-text u { text-decoration-thickness: 1px; text-underline-offset: .18em; }
.note-text s { text-decoration-thickness: 1px; }
.note-text.font-mono { --note-font: var(--mono); --note-style: normal; --k: .8; }
.note-text.font-mono p { letter-spacing: .01em; }
.note-text.size-s { --step: .75; }
.note-text.size-l { --step: 1.333; }
.note-text.pos-tl, .note-text.pos-tc, .note-text.pos-tr { align-items: flex-start; }
.note-text.pos-bl, .note-text.pos-bc, .note-text.pos-br { align-items: flex-end; }
.note-text.pos-tc, .note-text.pos-mc, .note-text.pos-bc { justify-content: center; }
.note-text.pos-tr, .note-text.pos-mr, .note-text.pos-br { justify-content: flex-end; }
.note-text.align-center { --note-align: center; }
.note-text.align-right { --note-align: right; }
.tone-sand { background: #f3ece2; }
.tone-clay { background: #efe2d8; }
.tone-sage { background: #d8ddd0; }
.tone-ochre { background: #eedcc0; }
.tone-mist { background: #e1e6e5; }
.tone-ink { background: var(--ink); color: var(--paper); }
.note-text[class*="paper-"]::before { content: ""; position: absolute; inset: 0; background-size: 512px; mix-blend-mode: multiply; pointer-events: none; }
.paper-rice::before { background-image: url("../paper/rice.webp"); }
.paper-linen::before { background-image: url("../paper/linen.webp"); }
.paper-recycled::before { background-image: url("../paper/recycled.webp"); }
.paper-cotton::before { background-image: url("../paper/cotton.webp"); }
.tone-ink[class*="paper-"]::before { filter: invert(1); mix-blend-mode: screen; opacity: .8; } /* light fibres on dark paper */

/* a picture, full screen, on its own */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.lightbox.is-open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox { margin: 0; grid-template-rows: minmax(0, 1fr) auto; gap: 16px; }
/* the picture fills exactly the first row and scale-down draws it inside (never enlarged, centred):
   Safari resolved max-height:100% against the whole box, so tall pictures ran over their caption */
.lightbox img { justify-self: stretch; align-self: stretch; width: auto; height: auto; min-width: 0; min-height: 0; max-width: none; max-height: none; margin: 0; object-fit: scale-down; pointer-events: none; user-select: none; }
.lightbox figcaption { max-width: 46ch; text-align: center; font-size: 17px; line-height: 1.4; color: var(--ink-soft); }

/* a video on the wall is its cover picture, with a small ▶ tucked in a corner */
.note-video { position: relative; }
.play-badge { /* barely there: a small white triangle in the corner */
  position: absolute;
  right: clamp(10px, 1.1vw, 16px); bottom: clamp(10px, 1.1vw, 16px);
  width: clamp(10px, .9vw, 13px);
  opacity: .88;
  filter: drop-shadow(0 0 4px rgba(33, 29, 26, .35));
  pointer-events: none;
  transition: opacity .4s var(--ease), scale .4s var(--ease);
}
.play-badge svg { display: block; width: 100%; height: auto; fill: #fff; }
figure.note-video:hover .play-badge { opacity: 1; scale: 1.15; }

/* …and opened, its real player: the cover's shape (tall for Shorts, Reels, TikToks), within the screen */
.lightbox.is-video { grid-template-rows: minmax(0, 1fr); grid-auto-rows: auto; }
.lightbox-player {
  --ratio: 1.7778; /* 16:9 until the cover says otherwise */
  position: relative;
  width: min(100%, 1280px, calc((100svh - 200px) * var(--ratio)));
  aspect-ratio: var(--ratio);
  margin: auto;
  overflow: hidden;
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 30px 60px -40px rgba(33, 29, 26, .45);
  cursor: default;
}
.lightbox-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Instagram and Pinterest embed a card (header, picture, words), not a bare player */
.lightbox-player.player-instagram, .lightbox-player.player-pinterest {
  width: min(100%, 420px);
  height: min(calc(100svh - 200px), 780px);
  aspect-ratio: auto;
  background: var(--paper);
  border: 1px solid var(--line);
}
.lightbox-out {
  font-size: 15px; color: var(--ink-soft);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px;
  cursor: pointer;
}
.lightbox-out:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
.lightbox-close {
  position: absolute;
  top: clamp(8px, 2vw, 20px); right: clamp(8px, 2vw, 20px);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.lightbox-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.lightbox-close:hover { background: var(--accent); color: var(--accent-ink); }
.lightbox-close:focus-visible { outline: 1.5px solid var(--accent-ink); outline-offset: 2px; }

/* ==========================================================================
   Smoothness: page transitions, the garden's fade-in, and its reading layer
   ========================================================================== */

/* Moving between pages cross-fades instead of flashing white (Chrome, Edge, Safari). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; animation-timing-function: var(--ease); }

/* The gate or the garden appear only once the server has answered, softly. */
.gate:not([hidden]), .garden:not([hidden]) { animation: softIn .5s var(--ease) both; }
@keyframes softIn { from { opacity: 0; } }

/* A post rises over the garden; the pond dims and rests behind it. */
.reader {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 64px;
  background: var(--paper);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .35s var(--ease), transform .45s var(--ease);
  outline: none;
}
.reader.is-open { opacity: 1; transform: none; }
.reader[hidden] { display: none; }
.reader .progress { z-index: 45; }

.garden .stage, .garden .mode { transition: opacity .4s var(--ease), filter .4s var(--ease), transform .5s var(--ease), color .2s; }
.garden.is-reading .stage { opacity: .25; filter: blur(4px); transform: scale(.96); }
.garden.is-reading .mode { opacity: 0; pointer-events: none; }
.garden.is-reading .bar { z-index: 40; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .reader { transform: none; }
}

/* selected words stay visible on every note colour (the default clay would vanish on a clay note) */
.note-text ::selection, .note-text textarea::selection { background: rgba(33, 29, 26, .18); color: inherit; }
.note-text.tone-ink ::selection, .note-text.tone-ink textarea::selection { background: rgba(250, 247, 243, .3); }

/* a note, opened on its own: the same note, big */
.note-text { cursor: zoom-in; }
.lightbox .note-big {
  width: min(78vmin, 640px);
  margin: auto;
  cursor: zoom-out;
  animation: none;
  --m: clamp(20px, 3.4vmin, 34px);
  box-shadow: 0 30px 60px -40px rgba(33, 29, 26, .45);
}
.lightbox img[hidden] { display: none; }

/* --- Her own clips, opened: the MP4 plays right here, at the clip's own shape --- */
.lightbox-player.player-file { border-radius: 0; }
.lightbox-player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink); }
