/* By Rime — shared styles for by-rime.html (white paper) and by-rime-watercolor.html */
@font-face { font-family: "Rime Print"; src: url("../fonts/RimePrint-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Rime Cursive"; src: url("../fonts/RimeCursive-Regular.woff2") format("woff2"); font-display: block; }

:root {
  /* spacing ladder: tight < gutter < box < page < section */
  --tight: 8px; --gutter: 16px; --box: 32px; --page: 48px; --section: 64px;
  --ink: #1b1a19; --soft: #6f6a62; --paper: #fdfcf9; --sheet: #fbfaf7;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .27  0 0 0 0 .2  0 0 0 .13 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --fibre: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='900' height='900'><filter id='f' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.006 .02' numOctaves='2' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .28  0 0 0 .1 0'/></filter><rect width='100%' height='100%' filter='url(%23f)'/></svg>");
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 400 24px/1.2 "Rime Print", cursive; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- the page itself: paper, or her painting washed out behind paper grain ---------- */
.bg { position: fixed; inset: 0; z-index: -1; background: var(--grain), var(--fibre), var(--paper); }
.watercolor .bg { background: var(--grain), linear-gradient(rgba(255, 254, 251, .74), rgba(255, 254, 251, .74)), url("watercolor.jpg") center / 100% 100% no-repeat, var(--paper); }

/* ---------- the page: name and menu along the top, the chosen tab below ---------- */
.site { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
/* one column on every screen: name, then subtitle, then the tabs straight underneath, all starting at the left */
.top { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; text-align: left; gap: var(--gutter); padding: var(--box) var(--page) 0; }
.top .menu { justify-self: stretch; }
.title { margin: 0; font: 400 min(14vw, 72px) / .95 "Rime Cursive", cursive; -webkit-text-stroke: .012em currentColor; white-space: nowrap; }
.sub { margin: var(--tight) 0 0; font-size: min(4.6vw, 24px); }
/* binder tabs: a row of coloured divider tabs standing on one line; the open one is taller and its words take its colour */
/* the tabs share the full width of the page equally; a long name like "Mixed Media" may go onto two lines when space is short */
.menu { --line: rgba(60, 50, 40, .4); flex: 1 0 100%; display: flex; flex-wrap: nowrap; justify-content: stretch; align-items: flex-end; gap: 4px; min-height: 64px; padding: 0; }
.menu a { --tab: #f7dde2; --pen: #c2405a; flex: 1 1 0; min-width: 0; display: inline-grid; place-items: center; padding: 8px 8px 6px; color: var(--ink); text-decoration: none; font-size: min(2.8vw, 28px); white-space: normal; text-align: center; line-height: 1.05;
  background: var(--tab); border: 0; border-radius: 14px 14px 0 0; transition: padding .15s ease, color .15s ease; }
/* tab words in her print handwriting, thickened with a pen outline (her font has no bold of its own) */
.menu a { font-family: "Rime Print", cursive; font-weight: 400; -webkit-text-stroke: .035em currentColor; paint-order: stroke fill; }
.menu a[data-room="drawings"] { --tab: #faefc6; --pen: #b06f00; }
.menu a[data-room="mixed"] { --tab: #fbe2cf; --pen: #c0602a; }
.menu a[data-room="stickers"] { --tab: #dcefd9; --pen: #2f8a4a; }
.menu a[data-room="other"] { --tab: #dbe8f5; --pen: #2f6fb5; }
.menu a[data-room="about"] { --tab: #e9e0f4; --pen: #7a4fb0; }
.menu a:hover { padding-top: 12px; }
.menu a[aria-current="page"] { padding-top: 16px; padding-bottom: 8px; color: var(--pen); box-shadow: none; }
.menu a:focus-visible { outline: 3px solid var(--ink); outline-offset: -6px; }
svg.crayon { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
svg.crayon path { fill: none; stroke: #161514; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; filter: url(#crayon); }

/* ---------- tabs ---------- */
.room { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); animation: room-in .28s ease-out; }
@keyframes room-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.year { margin: 0 0 var(--box); font-weight: 400; font-size: min(7vw, 40px); }

/* ---------- about ---------- */
.about { grid-row: 1 / -1; overflow: auto; max-width: 760px; width: 100%; margin: 0 auto; padding: var(--page) var(--page) var(--section); }
.words p { margin: 0 0 var(--box); font-family: "Rime Cursive", cursive; font-size: min(6vw, 30px); line-height: 1.35; }
.words .signed { margin-top: var(--page); text-align: right; }

/* her drawings around the words. Small screens: a little scene under the words. Wide screens: all around them. */
#room-about { position: relative; display: flex; flex-direction: column; overflow: auto; }
#room-about .about { position: relative; z-index: 1; flex: 0 0 auto; overflow: visible; padding-bottom: var(--box); }
.imagine { position: relative; flex: 1 0 240px; margin: 0 var(--page) calc(var(--gutter) + env(safe-area-inset-bottom, 0px)); }
.im { position: absolute; width: min(var(--w), var(--max)); rotate: var(--r, 0deg); cursor: pointer; user-select: none; -webkit-user-select: none;
  animation: im-in .5s cubic-bezier(.3, 1.4, .5, 1) var(--in, 0s) both, im-float var(--t, 6s) ease-in-out var(--d, 0s) infinite alternate; }
.im img { display: block; width: 100%; height: auto; pointer-events: none; }
.im.hop img { animation: im-hop .6s cubic-bezier(.3, 1.5, .5, 1); }
.im.roomy, .im.tall { display: none; }
/* the small scene: two in the air, three on the ground */
.bee   { --w: 22%; --max: 112px; --r: -8deg; --t: 9s; --in: .05s; left: 12%; top: 0;
  animation: im-in .5s cubic-bezier(.3, 1.4, .5, 1) var(--in) both, im-fly var(--t) linear infinite; }
.bird  { --w: 22%; --max: 120px; --r: 5deg;  --t: 6.4s; --d: -2s; --in: .15s; right: 10%; top: 8px; }
.bloom { --w: 20%; --max: 104px; --r: -3deg; --t: 5.2s; --d: -1s; --in: .25s; left: 0; bottom: 0; transform-origin: 50% 100%; animation-name: im-in, im-sway; }
.girl  { --w: 24%; --max: 120px; --t: 7s; --d: -3s; --in: .1s; left: 50%; bottom: 0; margin-left: calc(min(var(--w), var(--max)) / -2); }
.fox   { --w: 32%; --max: 176px; --r: 3deg; --t: 5.6s; --d: -4s; --in: .2s; right: 0; bottom: 0; }
@keyframes im-in    { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
@keyframes im-float { from { translate: 0 -5px; } to { translate: 0 7px; } }
@keyframes im-sway  { from { rotate: calc(var(--r, 0deg) - 3deg); } to { rotate: calc(var(--r, 0deg) + 3deg); } }
@keyframes im-fly   { 0% { translate: -10px 4px; } 25% { translate: 2px -8px; } 50% { translate: 12px 2px; } 75% { translate: 0 10px; } 100% { translate: -10px 4px; } }
@keyframes im-hop   { 0% { translate: 0 0; scale: 1; } 35% { translate: 0 -24px; scale: 1.08; } 100% { translate: 0 0; scale: 1; } }
/* a bit more room (tablets): the dinosaur and the yellow flower join in, and the scene gets taller */
@media (min-width: 760px) {
  .imagine { flex-basis: 384px; }
  .im.roomy { display: block; }
  .dino  { --w: 18%; --max: 136px; --r: -2deg; --t: 6.2s; --d: -2.5s; --in: .3s; left: 17%; bottom: 0; }
  .sun   { --w: 16%; --max: 120px; --r: 4deg;  --t: 5.8s; --d: -1.5s; --in: .35s; left: 56%; bottom: 0; transform-origin: 30% 100%; animation-name: im-in, im-sway; }
  .girl  { left: 38%; margin-left: 0; }
  .fox   { --w: 24%; }
}
/* wide screens: the drawings sit in the empty margins beside the words, never over the words.
   --m is the width of the margin beside the 760px column of words. */
@media (min-width: 1100px) and (min-height: 560px) {
  #room-about { overflow: hidden; }
  .imagine { --m: calc(50% - 380px); position: absolute; inset: 0; margin: 0; flex: none; pointer-events: none; }
  .im { pointer-events: auto; }
  .bee   { left: calc(var(--m) * .5); margin-left: calc(min(var(--w), var(--max)) / -2); }
  .dino  { left: calc(var(--m) * .5); margin-left: calc(min(var(--w), var(--max)) / -2); }
  .bird  { right: calc(var(--m) * .5); margin-right: calc(min(var(--w), var(--max)) / -2); }
  .fox   { right: calc(var(--m) * .5); margin-right: calc(min(var(--w), var(--max)) / -2); }
}
/* wide but short (a laptop window): only the four in the margins, sized to the height */
@media (min-width: 1100px) and (min-height: 560px) and (max-height: 699.98px) {
  .im.bloom, .im.girl, .im.sun { display: none; }
  .bee   { --w: 19vh; --max: 10vw;   top: 4%; }
  .bird  { --w: 19vh; --max: 10.5vw; top: 4%; }
  .dino  { --w: 21vh; --max: 11vw;   bottom: 4%; }
  .fox   { --w: 22vh; --max: 12.5vw; bottom: 4%; }
}
/* wide and tall: three more along the bottom, under the words */
@media (min-width: 1100px) and (min-height: 700px) {
  .bee   { --w: 9vw;    --max: 152px; top: 10%; }
  .bird  { --w: 9.5vw;  --max: 160px; top: 5%; }
  .dino  { --w: 10vw;   --max: 176px; bottom: 8%; }
  .fox   { --w: 11.5vw; --max: 200px; bottom: 4%; }
  .bloom { --w: 7vw;    --max: 120px; left: 28%; bottom: 2%; }
  .girl  { --w: 9.5vw;  --max: 160px; left: 45%; bottom: 4%; }
  .sun   { --w: 9vw;    --max: 152px; left: 64%; bottom: 9%; }
}
/* wide and very tall: the big empty middle gets a strawberry and a candy drifting below the words */
@media (min-width: 1100px) and (min-height: 900px) {
  .im.tall { display: block; }
  .berry { --w: 6vw; --max: 104px; --r: -6deg; --t: 6.8s; --d: -3.5s; --in: .4s; left: 24%; top: 42%; }
  .candy { --w: 7vw; --max: 120px; --r: 7deg;  --t: 5.4s; --d: -.5s;  --in: .45s; left: 68%; top: 48%; }
}

/* ---------- stickers: a real sticker sheet, each drawing with a white die-cut edge ---------- */
.desk { grid-row: 1 / -1; position: relative; margin: var(--box) var(--page); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); touch-action: none; user-select: none; -webkit-user-select: none; cursor: default; }
/* one big sheet like a shop-bought sticker pack: flat bright blue, each drawing kiss-cut with a white edge and a thin red cut line */
/* square corners and a matte, grainy paper backing, like a printed sheet lying on the table */
.sheet { display: grid; grid-template-rows: minmax(0, 1fr); padding: var(--tight); border-radius: 0;
  background: var(--grain), var(--grain) 130px 70px, var(--fibre), #36a3dd;
  box-shadow: 0 0 0 1px rgba(20, 60, 90, .18), 0 1px 1px rgba(0, 0, 0, .16), 0 10px 18px -10px rgba(20, 50, 80, .45); }
.slots { min-height: 0; }
.stk { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .28)); }
.stk img { display: block; width: 100%; height: 100%; -webkit-user-drag: none; }
.stk.fly { transition: transform .5s cubic-bezier(.3, .9, .3, 1), filter .5s; filter: drop-shadow(0 8px 8px rgba(30, 20, 10, .28)); }
/* where a sticker used to be: a clean, slightly shinier patch of the backing sheet */
.hole { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: rgba(255, 255, 255, .2); -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
canvas.peel { position: absolute; left: 0; top: 0; z-index: 900; pointer-events: none; }

/* ---------- paintings and drawings: a neat grid under each year ---------- */
.wall { grid-row: 1 / -1; overflow: auto; padding: var(--gutter) var(--page) var(--section); }
.year-block { max-width: 1200px; margin: 0 auto; }
.year-block + .year-block { margin-top: var(--section); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--page) var(--box); }
.pic { display: grid; gap: var(--gutter); justify-items: center; width: 100%; transition: scale .2s ease; }
.pic:hover, .pic:focus-visible { scale: 1.03; }
.pic:focus-visible { outline: 3px solid var(--ink); outline-offset: 8px; }
/* --shot is the height of each picture's spot; tall pictures are shrunk to fit inside it, never pushed out of the top */
.pic { --shot: 300px; }
.pic .shot { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: var(--shot); }
.pic img { display: block; flex: 0 1 auto; min-width: 0; max-width: 100%; max-height: var(--shot); width: auto; height: auto; object-fit: contain; background: #fff; box-shadow: 0 0 0 1px rgba(60, 50, 40, .05), 0 1px 2px rgba(0, 0, 0, .14), 0 14px 24px -12px rgba(40, 30, 20, .36); }
.look { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-rows: minmax(0, 1fr); gap: var(--gutter); justify-items: center; align-items: center; padding: var(--box); background: rgba(253, 252, 249, .96); cursor: zoom-out; animation: room-in .2s ease-out; }
.look img { max-width: 100%; max-height: 100%; min-height: 0; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 24px 48px -20px rgba(40, 30, 20, .45); }
/* stepping through pictures in the big view: swipe on a phone, arrows on a computer */
.look { grid-template-rows: minmax(0, 1fr) auto; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; outline: none; }
.look img { -webkit-user-drag: none; }
.look .count { font-size: 20px; line-height: 24px; color: var(--soft); }
.look .step { position: absolute; top: 50%; translate: 0 -50%; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.look .step svg { width: 44px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.look .prev { left: var(--gutter); }
.look .next { right: var(--gutter); }
.look .next svg { scale: -1 1; }
.look .step:hover { background: rgba(60, 50, 40, .08); }
.look .step:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .look { padding-left: 88px; padding-right: 88px; } }
@media (hover: none), (pointer: coarse) { .look .step { display: none; } }

/* ---------- small and tall screens ---------- */
@media (max-width: 760px) {
  :root { --page: 16px; --box: 16px; --section: 40px; }
  .top { flex-direction: column; text-align: left; gap: var(--tight); padding-top: calc(var(--gutter) + env(safe-area-inset-top, 0px)); padding-bottom: 0; }
  .menu { align-self: stretch; gap: 2px; min-height: 44px; }
  .menu a { flex: 1 1 0; min-width: 0; padding: 6px 2px 4px; font-size: min(3.6vw, 19px); border-radius: 10px 10px 0 0; white-space: normal; text-align: center; line-height: 1; }
  .menu a:hover { padding-top: 6px; }
  .menu a[aria-current="page"] { padding-top: 12px; padding-bottom: 6px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--box) var(--gutter); }
  .pic { --shot: 190px; }
  .about { grid-template-columns: minmax(0, 1fr); gap: var(--box); padding-top: var(--box); }
  .words p { font-size: 22px; }
}
@media (max-aspect-ratio: 1/1) {
  .desk { margin-bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .room, .look { animation: none; }
  .im, .im.hop img { animation: none; }
  .pic, .stk.fly { transition: none; }
}
