/* kurolight.dev v0.15 ("Kasa"): an umbrella and a raindrop, in ink on warm paper. One blue is the only colour, kept for water and for
   things you can press: the seal, the raindrop, rain and streams in the drawings, links, buttons, dots and rings.
   Two typefaces: EB Garamond for everything, Yuji Syuku only for the two characters on the seal. */

:root {
  --paper: #f3eee2;
  --ink: #1c1b18;
  --ink-2: #4f4b43;
  --ink-3: #847e72;
  --line: rgba(28, 27, 24, 0.16);
  --seal: #4b79c6;                       /* the stamp */
  --blue: #3a6cbf;                       /* accents: underlines on hover, rings, dots */
  --blue-ink: #2a559e;                   /* blue text on paper (hovered links), dark enough to read */
  --blue-line: rgba(58, 108, 191, 0.42); /* resting link underlines */
  --blue-wash: rgba(58, 108, 191, 0.08); /* hover backgrounds */
  --serif: "EB Garamond", Garamond, "Iowan Old Style", "Times New Roman", serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: clamp(18px, 4vw, 52px);
  --out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 9.5 9.5 2.5M4 2.5h5.5V8' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font: 400 19px/1.62 var(--serif);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* paper: a fine grain and a faint warm edge */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 10; }
body::before {
  opacity: 0.55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.37  0 0 0 0 0.3  0 0 0 0.22 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
}
body::after { background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(120, 96, 60, 0.09)); }
a { color: inherit; }
::selection { background: rgba(75, 121, 198, 0.24); }
:focus-visible { outline: 1.5px solid var(--blue); outline-offset: 4px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: 10px; transform: translateY(-160%); background: var(--ink); color: var(--paper); padding: 6px 12px; z-index: 5; text-decoration: none; }
.skip:focus { transform: none; }

/* ---------- header and footer ---------- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
  padding: 22px var(--gutter) 0;
}
.brand { font-size: 22px; letter-spacing: 0.005em; text-decoration: none; white-space: nowrap; }
.brand .dot { color: var(--blue); }
.brand .tld { color: var(--ink-2); }
/* desktop: the wordmark on the left, the menu in the middle */
@media (min-width: 721px) {
  .top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; }
  .top .brand { justify-self: start; }
  .top nav { justify-self: center; }
}
.top nav { display: flex; gap: 4px clamp(14px, 2.4vw, 30px); flex-wrap: wrap; }
.top nav a { position: relative; text-decoration: none; color: var(--ink-3); font-size: 17px; padding: 6px 0; transition: color 200ms var(--ease-out); }
.top nav a[aria-current="page"] { color: var(--ink); }
.top nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--ink); opacity: 0.55;
}
@media (hover: hover) and (pointer: fine) { .top nav a:hover { color: var(--ink); } }

/* footer: only the version number, small and quiet in the corner (it opens the dev page) */
.foot { position: relative; z-index: 1; display: flex; justify-content: flex-end; padding: 6px var(--gutter) 12px; font-size: 12px; }
.foot a { color: var(--ink-3); opacity: 0.7; text-decoration: none; letter-spacing: 0.04em; font-variant-numeric: lining-nums; transition: opacity 200ms var(--ease-out), color 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .foot a:hover { opacity: 1; color: var(--blue-ink); } }

/* touch: controls answer the press (there is no hover), and a double tap on them doesn't zoom */
a, button, [role="button"] { touch-action: manipulation; }
@media (hover: none) {
  a:active, .copy-inline:active, .email-copy:active .email-addr { opacity: 0.6; }
  .stone-hits g:active .ring { opacity: 1; stroke-dasharray: none; }
}

/* ---------- the seal (the only colour) ---------- */
.seal { width: 54px; height: 54px; flex: none; transform: rotate(-4deg); mix-blend-mode: multiply; opacity: 0.94; }
.seal text { font-family: "Yuji Syuku", "Hiragino Mincho ProN", serif; }

/* ---------- scenes ---------- */
.scene { margin: 0; position: relative; overflow: hidden; }
.scene svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.eyes { transform-box: fill-box; transform-origin: center; transition: transform 110ms var(--ease-out); }
.eyes.blink { transform: scaleY(0.12); }

/* ---------- the book ---------- */
/* header, page, turn bar, footer: the bar stays put however long a caption is */
body.is-book { display: grid; grid-template-rows: auto 1fr auto auto; }
.book { position: relative; z-index: 1; align-self: start; overflow-x: clip; }
body.is-book { touch-action: pan-y pinch-zoom; }   /* sideways swipes turn the book's pages (kasa.js) */
:root:has(body.is-book) { overscroll-behavior: none; }   /* the book fits the screen: no rubber-band stretch */
.page { display: flex; flex-direction: column; align-items: center; padding: 0 var(--gutter); outline: none; }
.js .page[hidden] { display: none; }
.page.enter { animation: page-in 260ms var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateX(var(--dx, 14px)); } }
.page .scene {
  width: min(1080px, 100%, calc((100svh - 372px) * 12 / 7));
  aspect-ratio: 12 / 7;
  min-width: min(100%, 520px);
}
.caption { max-width: 32em; text-align: center; margin: 4px auto 0; }
.caption p { margin: 0 0 0.45em; text-wrap: pretty; }
.caption .said { font-size: clamp(19px, 1.7vw, 22px); }
.caption .plain { color: var(--ink-2); }
.caption .small { font-size: 16px; color: var(--ink-3); }
.caption .more { font-size: 17px; margin-top: 10px; }
.caption .more a, .contents a { text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--blue-line); }
@media (hover: hover) and (pointer: fine) { .caption .more a:hover, .contents a:hover { color: var(--blue-ink); text-decoration-color: var(--blue); } }
.contents { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; font-size: 17px; }
.contents li + li::before { content: "·"; margin-right: 18px; color: var(--ink-3); }

/* the cover: "kurolight.dev" on the left, the umbrella and the raindrop on the right (like the LinkedIn card) */
.page.cover { flex-direction: row; justify-content: center; gap: clamp(24px, 6vw, 120px); min-height: calc(100svh - 190px); }
.wordmark { margin: 0; font-weight: 400; font-size: clamp(52px, 7vw, 104px); line-height: 1; letter-spacing: 0.005em; white-space: nowrap; }
.page.cover .scene { width: min(44vw, 560px, calc((100svh - 230px) * 640 / 520)); aspect-ratio: 640 / 520; min-width: 0; }
/* falling rain (the cover) is animated per streak in rain() in ink.js: it falls the whole way down its lane, from just
   above the picture to whatever it lands on, fading over the last few units; the loop restarts out of sight. */

.turn { position: relative; z-index: 1; display: flex; justify-content: center; align-items: center; gap: 26px; padding: 10px 0 0; }
.turn button {
  width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
  transition: transform 160ms var(--ease-out), opacity 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.turn button svg { width: 26px; height: 14px; }
.turn button:active:not(:disabled) { transform: scale(0.94); }
.turn button:disabled { opacity: 0.2; cursor: default; }
@media (hover: hover) and (pointer: fine) { .turn button:hover:not(:disabled) { background: var(--blue-wash); color: var(--blue-ink); } }
.folio { min-width: 4.5em; text-align: center; font-size: 15px; letter-spacing: 0.08em; color: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.no-js-note { display: none; }

/* the stepping stones on page 3: the stones are the buttons, the card shows the one picked */
.stone-hits g { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.stone-hits g[aria-pressed="true"] { cursor: default; }
.stone-hits .ring { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 2 4; stroke-linecap: round; opacity: 0; transition: opacity 200ms var(--ease-out); }
/* touch screens have no hover: every stone shows a faint ring, and the one the raindrop is on a solid one */
@media (hover: none) {
  .stone-hits .ring { opacity: 0.45; }
  .stone-hits g[aria-pressed="true"] .ring { opacity: 0.9; stroke-width: 1.8; stroke-dasharray: none; }
}
@media (hover: hover) and (pointer: fine) { .stone-hits g:hover:not([aria-pressed="true"]) .ring { opacity: 0.7; } }
.stone-hits g:focus-visible .ring { opacity: 1; }
.stone-card { margin: 16px auto 0; min-height: 7.4em; }
.stone-card .stone-name { margin: 0; font-weight: 500; font-size: clamp(26px, 2.6vw, 32px); line-height: 1.15; }
.stone-card .more { margin-top: 12px; }
html:not(.js) .pick { display: none; }
.stones-list[hidden], .stone-card[hidden] { display: none; }

/* painting on the last page of the book */
.paintable svg { touch-action: none; }
.drop-hit { cursor: pointer; outline: none; }
.drop-hit:focus-visible { stroke: var(--blue); stroke-width: 2; stroke-dasharray: 3 6; }
.paint-hint { margin: 18px auto 0; max-width: 30em; text-align: center; font-size: 16px; line-height: 1.7; color: var(--ink-3); text-wrap: balance; }
.swatch { display: inline-block; vertical-align: -0.02em; margin-right: 8px; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--line); transition: background-color 200ms var(--ease-out); }
.hint-touch { display: none; }
@media (hover: none) { .hint-fine { display: none; } .hint-touch { display: inline; } }
.paint-clear {
  display: inline-block; margin-left: 10px; padding: 0 12px; line-height: 1.6; vertical-align: 0.05em; border: 1px solid var(--line); border-radius: 999px; background: none;
  font: inherit; font-size: 15px; color: var(--ink-2); cursor: pointer; transition: transform 160ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.paint-clear[hidden] { display: none; }
.paint-clear:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .paint-clear:hover { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-wash); } }
html:not(.js) .paint-hint { display: none; }

/* ---------- chapter pages ---------- */
.chapter { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter) 40px; }
.opener { display: flex; flex-direction: column; align-items: center; text-align: center; }
.opener .scene { width: min(900px, 100%); aspect-ratio: 12 / 7; }
.opener .scene.strip { aspect-ratio: 1050 / 335; }   /* Works: a short strip, so the first project shows at once */
.opener .strip + h1 { margin-top: 12px; }
.chapter h1 { margin: 0; font-weight: 400; font-size: clamp(42px, 5.6vw, 68px); line-height: 1.05; letter-spacing: 0.01em; }
.rule { display: block; width: min(320px, 60%); height: 18px; margin: 46px auto; }

.work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px clamp(28px, 5vw, 72px); align-items: center; scroll-margin-top: 24px; }
.work:nth-of-type(even) .vig { order: 2; }
.vig { margin: 0; }
.vig .scene { aspect-ratio: 3 / 2; }
.vig figcaption { text-align: center; font-size: 17px; color: var(--ink-2); margin-top: 2px; }
.work h2 { margin: 0 0 12px; font-weight: 500; font-size: clamp(30px, 3vw, 38px); line-height: 1.1; }
.work p { margin: 0 0 12px; max-width: 34em; text-wrap: pretty; }
.links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 4px; }
.links a, .prose a, .elsewhere a { text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--blue-line); transition: text-decoration-color 200ms var(--ease-out), color 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .links a:hover, .prose a:hover, .elsewhere a:hover, .chapter-next a:hover, .dev a:hover { color: var(--blue-ink); text-decoration-color: var(--blue); }
}
.links a::after, .elsewhere a::after {
  content: ""; display: inline-block; width: 0.6em; height: 0.6em; margin-left: 0.32em; vertical-align: 0.06em;
  background: var(--blue); opacity: 0.8;
  -webkit-mask: var(--out) center / contain no-repeat; mask: var(--out) center / contain no-repeat;
}

.prose { max-width: 28em; margin: 0 auto; }   /* about 65 characters a line */
.prose p { margin: 0 0 1em; text-wrap: pretty; }
.chapter-next { margin: 44px auto 0; max-width: 34em; display: flex; justify-content: space-between; gap: 12px; font-size: 17px; }
.chapter-next a { text-underline-offset: 4px; text-decoration-color: var(--blue-line); }
.chapter-next.row { justify-content: center; gap: 12px 32px; flex-wrap: wrap; }

.email-row { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 18px 0 6px; }
.email-label { margin: 0; font-size: 17px; color: var(--ink-3); }
.email-copy {
  display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 18px; max-width: 100%;
  padding: 2px 6px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.email-addr {
  font-size: clamp(28px, 4.4vw, 46px); letter-spacing: 0.01em; overflow-wrap: anywhere;
  text-decoration: underline 1px transparent; text-underline-offset: 7px;
  transition: color 200ms var(--ease-out), text-decoration-color 200ms var(--ease-out);
}
.copy {
  display: inline-block;
  font: inherit; font-size: 15px; letter-spacing: 0.06em; font-variant: small-caps; text-transform: lowercase;
  padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--ink-2); cursor: pointer;
  min-width: 78px; text-align: center;   /* "Copy" and "Copied" take the same room, so the address doesn't shift */
  transition: transform 160ms var(--ease-out), border-color 200ms var(--ease-out);
}
.email-copy:active .copy { transform: scale(0.96); }
.email-copy.is-copied .copy { border-color: var(--blue); color: var(--blue-ink); }
@media (hover: hover) and (pointer: fine) {
  .email-copy:hover .email-addr { color: var(--blue-ink); text-decoration-color: var(--blue-line); }
  .email-copy:hover .copy { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-wash); }
}
/* the address on the book's letter page: looks like a link, copies, and says so underneath */
.more-label { color: var(--ink-3); margin-right: 0.2em; }
.copy-inline {
  position: relative; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline 1px var(--blue-line); text-underline-offset: 4px; -webkit-tap-highlight-color: transparent;
  transition: color 200ms var(--ease-out), text-decoration-color 200ms var(--ease-out);
}
.copy-inline::after {
  content: "Copied"; position: absolute; left: 50%; top: 100%; transform: translate(-50%, 0); white-space: nowrap;
  font-size: 14px; color: var(--blue-ink); opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.copy-inline.is-copied::after { opacity: 1; transform: translate(-50%, 4px); }
@media (hover: hover) and (pointer: fine) { .copy-inline:hover { color: var(--blue-ink); text-decoration-color: var(--blue); } }
.elsewhere { list-style: none; margin: 30px auto 0; padding: 0; max-width: 30em; }
.elsewhere li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.elsewhere li:last-child { border-bottom: 1px solid var(--line); }
.elsewhere span { color: var(--ink-3); }
.signed { display: flex; justify-content: center; margin-top: 40px; }


/* ---------- picture slides (works page): the drawing, then framed pictures ---------- */
.vig .slides {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: none; outline-offset: 6px;
}
.vig .slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; position: relative; aspect-ratio: 3 / 2; scroll-snap-align: center; scroll-snap-stop: always; }
.slide > .scene { position: absolute; inset: 0; }
/* the picture sits inside the brushed frame drawn by the "frame" scene (box 44,40 to 556,360 of 600 x 400) */
.shot img {
  position: absolute; left: 7.333%; top: 10%; width: 85.334%; height: 80%;
  display: block; object-fit: cover; background: #e9e3d6;
}
.shot .frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.slide-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; }
.slide-bar button {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
  transition: transform 160ms var(--ease-out), opacity 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.slide-bar button svg { width: 22px; height: 12px; }
.slide-bar button:active:not(:disabled) { transform: scale(0.94); }
.slide-bar button:disabled { opacity: 0.2; cursor: default; }
@media (hover: hover) and (pointer: fine) { .slide-bar button:hover:not(:disabled) { background: var(--blue-wash); color: var(--blue-ink); } }
.sl-dots { display: flex; gap: 9px; }
.sl-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: 0.2; transition: opacity 200ms var(--ease-out); }
.sl-dots i.on { opacity: 1; background: var(--blue); }
html:not(.js) .slide-bar { display: none; }

/* ---------- dev page ---------- */
.dev { max-width: 28em; margin: 0 auto; }
.dev h2 { margin: 40px 0 10px; font-weight: 500; font-size: 24px; }
.dev .count { margin: 0; font-size: clamp(40px, 6vw, 60px); line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.dev .note { margin: 2px 0 0; color: var(--ink-3); font-size: 16px; }
.dev ul { margin: 0; padding-left: 1.1em; }
.dev li { margin: 0 0 6px; }
.dev h3 { margin: 22px 0 6px; font-weight: 500; font-size: 19px; font-variant-numeric: lining-nums; }
.dev a { text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--blue-line); }

/* the letter page's links: one line on wide screens; on phones the email and the other links each get a line,
   with room under the address for "Copied" */
.letter-links .more-email { white-space: nowrap; }
/* ---------- phones ---------- */
@media (max-width: 720px) {
  body { font-size: 18px; }
  .top { padding-top: 16px; }
  .top nav a { font-size: 16px; }
  .page .scene { width: 100%; min-width: 0; aspect-ratio: 4 / 3; }
  .letter-links { display: flex; flex-direction: column; align-items: center; row-gap: 1.5em; }
  .letter-links .sep { display: none; }
  .contents { gap: 6px 20px; }
  .contents li + li::before { content: none; }
  .caption .said { font-size: 18px; }
  /* the turn bar stays under the thumb */
  .turn { position: sticky; bottom: 0; z-index: 3; padding: 14px 0 max(8px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(243, 238, 226, 0), var(--paper) 38%); }
  .opener .scene { aspect-ratio: 4 / 3; }
  .opener .scene.strip { aspect-ratio: 1050 / 335; }
  .rule { margin: 26px auto; }
  .work { grid-template-columns: 1fr; }
  .work:nth-of-type(even) .vig { order: 0; }
  .page.cover { flex-direction: column; justify-content: center; gap: 4px; min-height: 0; padding-top: 0; }
  /* centre the cover between the menu and the page arrows */
  .book:has(> .cover:not([hidden])) { align-self: center; }
  .wordmark { font-size: clamp(44px, 13.5vw, 64px); }
  .page.cover .scene { width: min(100%, 55svh); aspect-ratio: 640 / 520; }
  .seal { width: 44px; height: 44px; }
  .chapter-next { flex-direction: column; }
  .chapter-next.row { flex-direction: row; }
}
@media (prefers-reduced-motion: reduce) {
  .falling { transform: translate(calc(var(--fx) * var(--p)), calc(var(--fy) * var(--p))); }  /* still rain, partway down each lane */
  .page.enter { animation: none; }
  .eyes { transition: none; }
}
html:not(.js) .turn { display: none; }

/* phones (after the phone rules so it wins): no wordmark in the header, just the menu, centred */
@media (max-width: 720px) {
  .top { justify-content: center; }
  .top .brand { display: none; }
}
@media (max-width: 359px) { .top nav { gap: 4px 14px; } .top nav a { font-size: 15px; } }
