/* ─────────────────────────────────────────────────────────────
   Vidella — temporary notes
   Physical Japanese paperback feel, set in a coding mono font.
   blue-pen handwriting on the cover, double-rule page frame. Blue on white, or blue on black.
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jbmono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jbmono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-rgb: 255, 255, 255;
  --ink: #1e3f8a;       /* blue ink: printed text + handwriting */
  --pen: #1e3f8a;
  --muted: #5b6f9a;
  --line: #d5dcec;
  --line-strong: #a3b2d3;
  --backdrop: rgba(10, 20, 50, .4);
  --grain: none;

  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", monospace;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
}

html[data-theme="dark"] {
  --paper: #000000;
  --paper-rgb: 0, 0, 0;
  --ink: #8fb2ff;
  --pen: #8fb2ff;
  --muted: #6f8fcc;
  --line: #17254a;
  --line-strong: #2f4a8a;
  --backdrop: rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: .65; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; }
.tiny { font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── page frame: double rule, like a printed page area ── */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}
body::before { inset: 10px; border: 1px solid var(--line-strong); }
body::after  { inset: 15px; border: 1px solid var(--line); }

/* ── grass drawing (decorative, sits behind everything) ── */
.grass {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: clamp(100px, 14vw, 180px);
  aspect-ratio: 260 / 360;
  background: url("assets/grass.svg") no-repeat left bottom / contain;
  opacity: .5;
  z-index: -1;
  pointer-events: none;
  transform-origin: 12% 100%;
  animation: sway 8s ease-in-out infinite;
}
html[data-theme="dark"] .grass { opacity: .45; filter: brightness(1.15) saturate(1.1); }
@keyframes sway {
  0%, 100% {  }
  50%      { transform: rotate(1.4deg); }
}
@media (prefers-reduced-motion: reduce) { .grass { animation: none; } }

/* ── shell: contents on the left, page on the right ── */
.sheet {
  width: min(1020px, calc(100% - 120px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 5vw;
  align-items: start;
  padding: 44px 0 80px;
}

.contents {
  position: sticky;
  top: 40px;
  padding-top: 8px;
}
.vertical {
  writing-mode: vertical-rl;
  position: absolute;
  left: 0;
  top: 4px;
  font-size: 11px;
  letter-spacing: .3em;
  color: var(--muted);
}
.contents-inner { margin-left: 34px; }
.mokuji {
  display: block;
  margin-bottom: 12px;
  font-size: 11px;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--muted);
}
.contents nav { display: grid; }
.contents nav a {
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  max-width: 130px;
}
.contents nav a.active { border-bottom-color: var(--ink); font-weight: 500; }
.contents nav a.say-hi { margin-top: 14px; border-bottom-color: var(--ink); }

.theme-btn {
  margin-top: 18px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 500 11px var(--mono);
  letter-spacing: .12em;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
}
.theme-btn:hover { border-color: var(--ink); }
.footnote {
  margin: 22px 0 0;
  max-width: 130px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.folio {
  position: fixed;
  bottom: 19px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.page-projects .folio { display: none; }
.folio span::before, .folio span::after { content: "—"; margin: 0 .6em; opacity: .6; }

/* ═══════════════ COVER ═══════════════ */
.page-cover .sheet {
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 24px;
}
.page-cover .contents { align-self: center; }

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.memo {
  --pw: 340px;                      /* photo width */
  --hw: max(17px, calc(var(--pw) * .062));  /* handwriting size */
  position: relative;
  width: var(--pw);
  margin: 0 calc(var(--pw) * .2) 40px 0;   /* room for the notes to spill out right + below */
}

.plate {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
}

/* the photo: plain, just grayscale */
.stamp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 38% 30%;
  display: block;
  filter: grayscale(1);
}

/* notes written over the photo's bottom-right and out onto the paper */
.writing {
  position: absolute;
  left: 60%;
  top: 64%;
  width: max-content;
  margin: 0;
  font-family: var(--hand);
  font-weight: 500;
  font-size: var(--hw);
  line-height: 1.12;
  letter-spacing: 0;
  color: var(--pen);
  text-shadow:
    0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper),
    0 0 8px var(--paper), 0 0 12px rgba(var(--paper-rgb), .8);
}
.writing p { margin: 0 0 3px; }
.writing .title { font-size: 1.2em; margin-bottom: 6px; }
.writing .aim { margin-top: 8px; font-size: .92em; }
.writing .turn { margin-top: 8px; }
.writing .turn a { display: inline-block; padding: 4px 0; border-bottom: 1px solid currentColor; }
.writing .sign { color: var(--muted); }

/* ═══════════════ PROJECTS ═══════════════ */
.pages { min-width: 0; }

.page-head { padding: 8px 0 22px; border-bottom: 1px solid var(--line); }
.label { font-size: 11px; letter-spacing: .16em; color: var(--muted); margin-bottom: 10px; }
.page-head h1 {
  margin: 0 0 12px;
  font: 500 28px/1.3 var(--mono);
  letter-spacing: .06em;
}
.lead { margin: 0; max-width: 460px; color: var(--muted); font-size: 13px; line-height: 1.8; }

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.flow-node { padding: 2px 12px; border: 1px solid var(--line-strong); border-radius: 999px; }
.flow-node.circled { border: 2px solid var(--pen); color: var(--pen); font-weight: 500;  }
.flow-arrow { opacity: .7; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: 40px 210px minmax(0, 1fr);
  grid-template-areas:
    "no plate head"
    "no plate text";
  grid-template-rows: auto 1fr;
  column-gap: 22px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.entry-promo { grid-template-areas: "no . head" "no . text"; }
.entry-no { grid-area: no; font-size: 12px; color: var(--muted); letter-spacing: .06em; padding-top: 3px; }
.entry .plate {
  grid-area: plate;
  margin: 0;
  aspect-ratio: 4 / 3;
  align-self: start;
  border: 1px solid var(--line-strong);
  padding: 5px;
}
.entry .plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  filter: grayscale(.3) contrast(.97);
  mix-blend-mode: multiply;
  transition: filter .3s ease;
}
html[data-theme="dark"] .entry .plate img { mix-blend-mode: normal; filter: grayscale(.3) brightness(.85); }
.entry:hover .plate img { filter: none; }

.entry-head { grid-area: head; }
.entry h3 { margin: 0; font: 500 16px/1.45 var(--mono); letter-spacing: .04em; }
.tag { margin: 0 0 10px; font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.entry-text { grid-area: text; }
.entry-text p { margin: 0 0 8px; max-width: 540px; font-size: 12px; line-height: 1.8; }

.margin-note {
  font-size: 12px !important;
  line-height: 1.7 !important;
  color: var(--pen);
  margin: 10px 0 12px !important;
  padding-left: 12px;
  border-left: 2px solid var(--pen);
}
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.links a {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .08em;
  padding: 6px 0;
  border-bottom: 1px solid var(--ink);
}
.links a:hover { opacity: .6; }
.fine { margin-top: 10px !important; font-size: 12px !important; color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 16px;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
}
footer a { padding: 8px 0; }

/* ── case-study modal ── */
#caseModal {
  width: min(720px, calc(100% - 28px));
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  background: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 26px 24px;
  font: 13px/1.8 var(--mono);
}
#caseModal::backdrop { background: var(--backdrop); }
#caseModal h2 { margin: 6px 0 4px; font: 500 17px/1.4 var(--mono); }
#caseModal p { color: var(--muted); margin: 0 0 8px; }
#caseModal .modal-close {
  float: right;
  width: 44px; height: 44px;
  margin: -12px -10px 0 0;
  border: 0;
  background: none;
  font: 24px/1 var(--mono);
  cursor: pointer;
  color: var(--ink);
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 12px; }
.modal-grid h4 { font: 400 11px var(--mono); color: var(--muted); margin: 12px 0 4px; letter-spacing: .12em; }
.modal-grid img, .modal-grid video {
  width: 100%; height: auto; display: block; margin: 8px 0;
  border: 1px solid var(--line-strong); padding: 4px;
}
.modal-product { display: inline-block; margin-top: 6px; padding: 6px 0; font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--ink); }

/* ═══════════════ TABLET / MOBILE ═══════════════ */
@media (max-width: 900px) {
  .sheet { width: min(1020px, calc(100% - 80px)); gap: 28px; grid-template-columns: 130px minmax(0, 1fr); }
  .entry { grid-template-columns: 34px 170px minmax(0, 1fr); column-gap: 18px; }
}

@media (max-width: 760px) {
  body { font-size: 13px; }
  body::before { inset: 7px; }
  body::after  { display: none; }
  .grass { left: 12px; bottom: 12px; width: 84px; opacity: .32; }
  .folio { bottom: 12px; }

  .sheet {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 26px 26px 64px;
  }

  /* contents becomes a slim table-of-contents bar on top */
  .contents { position: static; padding: 0 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .vertical { display: none; }
  .contents-inner {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
  }
  .mokuji { width: 100%; margin: 0 0 2px; }
  .contents nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
  .contents nav a { border-bottom: 0; padding: 10px 0 6px; max-width: none; font-size: 13px; position: relative; }
  .contents nav a.active { border-bottom: 0; box-shadow: inset 0 -1px 0 var(--ink); }
  .contents nav a.say-hi { margin: 0; box-shadow: inset 0 -1px 0 var(--ink); }
  .theme-btn { margin: 0 0 0 auto; min-height: 36px; }
  .footnote { display: none; }

  /* cover */
  .page-cover .sheet { min-height: 100vh; min-height: 100svh; justify-content: flex-start; }
  .stage { flex: 1; padding: 16px 0 28px; justify-content: flex-start; }
  .memo {
    --pw: min(64vw, 270px);
    margin: 0 0 56px 2px;
    /* group is photo + spill; centre it a little */
  }
  .writing { left: 58%; top: 64%; }

  /* projects */
  .page-head h1 { font-size: 24px; }
  .entry {
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
      "no head"
      "plate plate"
      "text text";
    grid-template-rows: auto;
    column-gap: 10px;
    padding: 24px 0;
  }
  .entry-promo { grid-template-areas: "no head" "text text"; }
  .entry .plate { margin: 4px 0 16px; aspect-ratio: 16 / 10; }
  .entry-head .tag { margin-bottom: 0; }
  .entry-text p { max-width: none; }
  .entry:hover .plate img { filter: grayscale(.3) contrast(.97); }
  .modal-grid { grid-template-columns: 1fr; }
  #caseModal { padding: 22px 18px; }

  /* long scrolling page: keep text clear of fixed decoration */
  .page-projects .grass,
  .page-projects .folio { display: none; }
  .flow { gap: 6px 6px; font-size: 11px; }
  .flow-node { padding: 2px 9px; }
}

/* very small phones */
@media (max-width: 380px) {
  .sheet { padding-left: 24px; padding-right: 24px; }
  .memo { --pw: 58vw; --hw: 16px; }
  .writing { left: 56%; }
  .contents nav { gap: 0 14px; }
}

/* short landscape screens: don't force full-height cover */
@media (max-height: 520px) and (min-width: 761px) {
  .page-cover .sheet { min-height: 0; }
}

.writing .sign {
  display: block !important;
  width: 100% !important;
  text-align: right !important;
  margin-top: 25px !important;
  padding-right: 5px;
  color: var(--muted);
}

/* ── handwritten cover note: original pen strokes, recoloured blue ── */
.page-cover .memo {
  overflow: visible;
  margin-bottom: 88px;
}
.page-cover .writing.handwritten-layout {
  /* Keep the original notebook placement: spilling from the lower-right
     area of the photograph, just like the previous typed note. */
  left: 66%;
  top: 64%;
  width: min(560px, 68vw);
  max-width: none;
  z-index: 4;
  margin: 0;
  padding: 0;
  color: transparent;
  text-shadow: none;
  font-size: 0;
  line-height: 0;
  transform: rotate(-0.5deg);
}
.handwritten-intro {
  display: block;
  width: 100%;
  height: auto;
  filter: none;
}
.handwritten-turn {
  display: block;
  width: 43%;
  margin: 12px 0 0 2%;
  padding: 0;
  border: 0;
  line-height: 0;
  transform: rotate(-0.7deg);
  transition: opacity .2s ease, transform .2s ease;
}
.handwritten-turn img {
  display: block;
  width: 100%;
  height: auto;
}
.handwritten-turn:hover {
  opacity: .75;
  transform: rotate(-0.7deg) translateX(4px);
}
html[data-theme="dark"] .handwritten-intro,
html[data-theme="dark"] .handwritten-turn img {
  filter: brightness(2.45) saturate(1.12);
}

@media (max-width: 760px) {
  .page-cover .memo {
    margin-bottom: 88px;
  }
  .page-cover .writing.handwritten-layout {
    left: 62%;
    top: 64%;
    width: min(76vw, 400px);
  }
  .handwritten-turn {
    width: 44%;
    margin-top: 10px;
  }
}
@media (max-width: 380px) {
  .page-cover .writing.handwritten-layout {
    width: min(82vw, 340px);
  }
  .handwritten-turn {
    width: 48%;
  }
}


/* Final cover polish: remove the viewport frame and reduce handwriting scale. */
body::before,
body::after {
  display: none !important;
}

.page-cover .writing.handwritten-layout {
  /* Keep the existing lower-right overlap; only reduce the artwork size. */
  left: 66%;
  top: 64%;
  width: min(420px, 50vw);
}

.handwritten-turn {
  width: 40%;
  margin-top: 9px;
}

@media (max-width: 760px) {
  .page-cover .writing.handwritten-layout {
    left: 62%;
    top: 64%;
    width: min(64vw, 330px);
  }
  .handwritten-turn {
    width: 40%;
  }
}

@media (max-width: 380px) {
  .page-cover .writing.handwritten-layout {
    width: min(70vw, 290px);
  }
}


/* ═══════════ SCRAPBOOK COVER COMPOSITION ═══════════ */
body.page-cover {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 18% 22%, rgba(125, 105, 76, .055), transparent 34%),
    radial-gradient(ellipse at 82% 78%, rgba(125, 105, 76, .045), transparent 36%),
    repeating-linear-gradient(0deg, rgba(95, 78, 55, .018) 0, rgba(95, 78, 55, .018) 1px, transparent 1px, transparent 4px);
}
html[data-theme="dark"] body.page-cover {
  background-image:
    radial-gradient(ellipse at 18% 22%, rgba(215, 196, 159, .045), transparent 34%),
    radial-gradient(ellipse at 82% 78%, rgba(215, 196, 159, .035), transparent 36%),
    repeating-linear-gradient(0deg, rgba(235, 220, 190, .018) 0, rgba(235, 220, 190, .018) 1px, transparent 1px, transparent 4px);
}
.page-cover .stage {
  justify-content: center;
  align-items: flex-start;
  padding: 20px 0 50px;
}
.page-cover .memo.scrapbook-memo {
  position: relative;
  width: min(650px, 100%);
  min-height: 650px;
  margin: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}
.page-cover .scrapbook-photo {
  position: absolute;
  left: 3%;
  top: 0;
  width: min(300px, 47%);
  aspect-ratio: 4 / 5;
  padding: 8px;
  background: #f5f0e6;
  box-shadow: 0 2px 7px rgba(38, 32, 24, .18), 0 12px 24px rgba(38, 32, 24, .08);
  transform: rotate(-1.1deg);
}
.page-cover .scrapbook-photo::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -17px;
  left: 34%;
  width: 92px;
  height: 30px;
  background: rgba(218, 210, 187, .58);
  border-left: 1px solid rgba(255,255,255,.24);
  border-right: 1px solid rgba(120,110,90,.12);
  transform: rotate(-2deg);
}
.page-cover .scrapbook-photo .stamp {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 38% 30%;
  filter: grayscale(1) contrast(.94);
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  position: absolute;
  left: 29%;
  top: 49%;
  width: min(440px, 69%);
  max-width: none;
  margin: 0;
  padding: 0;
  z-index: 4;
  color: transparent;
  font-size: 0;
  line-height: 0;
  text-shadow: none;
  transform: rotate(-.6deg);
}
.page-cover .handwritten-intro {
  display: block;
  width: 100%;
  height: auto;
  filter: none;
}
.page-cover .handwritten-turn {
  display: block;
  width: 58%;
  margin: 8px 0 0 8%;
  border: 0;
  transform: rotate(-1deg);
}
.page-cover .handwritten-turn img {
  display: block;
  width: 100%;
  height: auto;
}
.page-cover .handwritten-turn:hover {
  opacity: .72;
  transform: rotate(-1deg) translateX(3px);
}
html[data-theme="dark"] .page-cover .handwritten-intro,
html[data-theme="dark"] .page-cover .handwritten-turn img {
  filter: brightness(2.2) saturate(1.1);
}
html[data-theme="dark"] .page-cover .scrapbook-photo {
  background: #e6dfd1;
  box-shadow: 0 2px 7px rgba(0,0,0,.4), 0 12px 24px rgba(0,0,0,.24);
}
html[data-theme="dark"] .page-cover .scrapbook-photo::before {
  background: rgba(205, 195, 171, .48);
}

@media (max-width: 760px) {
  .page-cover .stage { padding: 24px 0 60px; }
  .page-cover .memo.scrapbook-memo {
    width: 100%;
    min-height: 590px;
  }
  .page-cover .scrapbook-photo {
    left: 3%;
    width: min(240px, 52%);
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 20%;
    top: 43%;
    width: 78%;
  }
  .page-cover .handwritten-turn { width: 56%; }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo { min-height: 520px; }
  .page-cover .scrapbook-photo { width: 58%; }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 14%;
    top: 42%;
    width: 84%;
  }
}

.page-cover .scrapbook-memo::before,
.page-cover .scrapbook-memo::after {
  content: none !important;
}


/* Final layout adjustment: handwritten note sits beside the photo, at a smaller scale. */
.page-cover .memo.scrapbook-memo {
  width: min(760px, 100%);
  min-height: 440px;
}
.page-cover .scrapbook-photo {
  left: 2%;
  top: 12px;
  width: min(280px, 40%);
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 45%;
  top: 18%;
  width: min(270px, 42%);
}
.page-cover .handwritten-intro {
  width: 100%;
}
.page-cover .handwritten-turn {
  width: 58%;
  margin: 10px 0 0 5%;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    width: 100%;
    min-height: 610px;
  }
  .page-cover .scrapbook-photo {
    left: 2%;
    top: 10px;
    width: min(230px, 48%);
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 51%;
    top: 13%;
    width: 46%;
  }
  .page-cover .handwritten-turn {
    width: 68%;
    margin-left: 0;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 560px;
  }
  .page-cover .scrapbook-photo {
    width: 46%;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 49%;
    top: 12%;
    width: 49%;
  }
}


/* Cover refinement: small unframed photo with the handwriting crossing its edge. */
.page-cover .memo.scrapbook-memo {
  width: min(760px, 100%);
  min-height: 470px;
}
.page-cover .scrapbook-photo {
  left: 2%;
  top: 14px;
  width: min(230px, 31%);
  aspect-ratio: 4 / 5;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
  transform: rotate(-1deg);
  z-index: 1;
}
.page-cover .scrapbook-photo::before {
  display: none !important;
  content: none !important;
}
.page-cover .scrapbook-photo .stamp {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(.96);
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 15%;
  top: 20%;
  width: min(305px, 41%);
  z-index: 4;
  transform: rotate(-.6deg);
}
.page-cover .handwritten-intro {
  width: 100%;
}
.page-cover .handwritten-turn {
  width: 54%;
  margin: 8px 0 0 7%;
}
html[data-theme="dark"] .page-cover .scrapbook-photo {
  background: transparent;
  box-shadow: none;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 590px;
  }
  .page-cover .scrapbook-photo {
    left: 2%;
    top: 12px;
    width: min(190px, 43%);
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 14%;
    top: 19%;
    width: 70%;
  }
  .page-cover .handwritten-turn {
    width: 54%;
    margin-left: 7%;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 530px;
  }
  .page-cover .scrapbook-photo {
    width: 43%;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 13%;
    top: 18%;
    width: 72%;
  }
}


/* Readable scrapbook cover: photo and handwriting share a clean two-column layout. */
.page-cover .memo.scrapbook-memo {
  width: min(760px, 100%);
  min-height: 430px;
  margin: 0;
}
.page-cover .scrapbook-photo {
  left: 2%;
  top: 18px;
  width: min(220px, 30%);
  aspect-ratio: 4 / 5;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: rotate(-1deg);
  z-index: 1;
}
.page-cover .scrapbook-photo::before {
  display: none !important;
  content: none !important;
}
.page-cover .scrapbook-photo .stamp {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(.96);
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 35%;
  top: 8%;
  width: min(390px, 62%);
  max-width: none;
  z-index: 4;
  margin: 0;
  padding: 0;
  transform: rotate(-.35deg);
}
.page-cover .handwritten-intro {
  display: block;
  width: 100%;
  height: auto;
}
.page-cover .handwritten-turn {
  width: 58%;
  margin: 12px 0 0 5%;
}
html[data-theme="dark"] .page-cover .handwritten-intro,
html[data-theme="dark"] .page-cover .handwritten-turn img {
  filter: brightness(2.2) saturate(1.1);
}

@media (max-width: 760px) {
  .page-cover .stage {
    padding: 22px 0 55px;
  }
  .page-cover .memo.scrapbook-memo {
    width: 100%;
    min-height: 620px;
  }
  .page-cover .scrapbook-photo {
    left: 4%;
    top: 8px;
    width: min(205px, 47%);
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 4%;
    top: 295px;
    width: 91%;
  }
  .page-cover .handwritten-turn {
    width: 48%;
    margin-top: 10px;
    margin-left: 4%;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 570px;
  }
  .page-cover .scrapbook-photo {
    width: 48%;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    top: 260px;
    width: 94%;
  }
  .page-cover .handwritten-turn {
    width: 50%;
  }
}


/* Match handwritten lettering to the scale of the site's small UI text. */
.page-cover .writing.handwritten-layout.scrapbook-caption {
  width: min(285px, 48%) !important;
}
.page-cover .handwritten-intro {
  width: 100% !important;
}
.page-cover .handwritten-turn {
  width: 48% !important;
  margin-top: 9px !important;
}

@media (max-width: 760px) {
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    width: min(285px, 88%) !important;
  }
  .page-cover .handwritten-turn {
    width: 48% !important;
  }
}
@media (max-width: 420px) {
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    width: min(270px, 90%) !important;
  }
}


/* Final placement: smaller handwritten note tucked over the photo's lower-right corner. */
.page-cover .memo.scrapbook-memo {
  min-height: 440px;
}
.page-cover .scrapbook-photo {
  left: 2%;
  top: 18px;
  width: min(220px, 30%);
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 17%;
  top: 145px;
  width: min(195px, 27%);
  z-index: 5;
}
.page-cover .handwritten-intro {
  width: 100% !important;
}
.page-cover .handwritten-turn {
  width: 46% !important;
  margin: 6px 0 0 5% !important;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 560px;
  }
  .page-cover .scrapbook-photo {
    left: 4%;
    top: 8px;
    width: min(185px, 47%);
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 16%;
    top: 118px;
    width: min(175px, 45%);
  }
  .page-cover .handwritten-turn {
    width: 46% !important;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 510px;
  }
  .page-cover .scrapbook-photo {
    width: 46%;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 15%;
    top: 108px;
    width: min(160px, 46%);
  }
}


/* Center the photograph on the cover while keeping the note tucked at its lower-right. */
.page-cover .memo.scrapbook-memo {
  width: min(760px, 100%);
  min-height: 520px;
}
.page-cover .scrapbook-photo {
  left: 50% !important;
  top: 18px !important;
  width: min(220px, 34%) !important;
  transform: translateX(-50%) rotate(-1deg) !important;
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: calc(50% + 12px) !important;
  top: 155px !important;
  width: min(195px, 29%) !important;
  transform: rotate(-.35deg) !important;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 570px;
  }
  .page-cover .scrapbook-photo {
    left: 50% !important;
    top: 10px !important;
    width: min(190px, 52%) !important;
    transform: translateX(-50%) rotate(-1deg) !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: calc(50% + 4px) !important;
    top: 130px !important;
    width: min(165px, 44%) !important;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 530px;
  }
  .page-cover .scrapbook-photo {
    width: 52% !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: calc(50% + 2px) !important;
    top: 118px !important;
    width: min(150px, 45%) !important;
  }
}


/* Keep the photo and handwriting side by side, with the writing comfortably readable. */
.page-cover .memo.scrapbook-memo {
  width: min(700px, 100%);
  min-height: 390px;
  margin: 0 auto;
}
.page-cover .scrapbook-photo {
  left: 8% !important;
  top: 35px !important;
  width: min(205px, 30%) !important;
  transform: rotate(-1deg) !important;
}
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 43% !important;
  top: 82px !important;
  width: min(225px, 34%) !important;
  transform: rotate(-.35deg) !important;
  z-index: 4;
}
.page-cover .handwritten-intro {
  display: block;
  width: 100% !important;
  height: auto;
}
.page-cover .handwritten-turn {
  display: block;
  width: 52% !important;
  margin: 8px 0 0 3% !important;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    width: 100%;
    min-height: 440px;
  }
  .page-cover .scrapbook-photo {
    left: 3% !important;
    top: 35px !important;
    width: min(175px, 42%) !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 48% !important;
    top: 62px !important;
    width: 48% !important;
  }
  .page-cover .handwritten-turn {
    width: 55% !important;
  }
}
@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 410px;
  }
  .page-cover .scrapbook-photo {
    left: 2% !important;
    width: 42% !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 47% !important;
    top: 58px !important;
    width: 50% !important;
  }
  .page-cover .handwritten-turn {
    width: 58% !important;
  }
}


/* Bring the handwritten note closer to the photo without letting the two overlap. */
.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 45% !important;
  width: 52% !important;
}

@media (max-width: 760px) {
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 46% !important;
    width: 51% !important;
  }
}

@media (max-width: 420px) {
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 45% !important;
    width: 52% !important;
  }
}


/* Final cover composition: a tidy photo-and-note spread. */
.page-cover .memo.scrapbook-memo {
  position: relative !important;
  width: min(760px, 100%) !important;
  min-height: 390px !important;
  margin: 0 auto !important;
}

.page-cover .scrapbook-photo {
  left: 3% !important;
  top: 28px !important;
  width: 230px !important;
  max-width: 32% !important;
  padding: 6px !important;
  transform: none !important;
}

.page-cover .scrapbook-photo::before {
  display: none !important;
}

.page-cover .writing.handwritten-layout.scrapbook-caption {
  left: 37% !important;
  top: 38px !important;
  width: 43% !important;
  max-width: 330px !important;
  transform: none !important;
}

.page-cover .handwritten-intro {
  width: 100% !important;
  height: auto !important;
}

.page-cover .handwritten-turn {
  width: 42% !important;
  margin: 10px 0 0 2% !important;
  transform: none !important;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    width: 100% !important;
    min-height: 500px !important;
  }
  .page-cover .scrapbook-photo {
    left: 3% !important;
    top: 12px !important;
    width: min(190px, 42%) !important;
    max-width: none !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 48% !important;
    top: 20px !important;
    width: 48% !important;
    max-width: none !important;
  }
  .page-cover .handwritten-turn {
    width: 48% !important;
    margin-top: 8px !important;
  }
}

@media (max-width: 420px) {
  .page-cover .memo.scrapbook-memo {
    min-height: 460px !important;
  }
  .page-cover .scrapbook-photo {
    left: 2% !important;
    width: 42% !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 47% !important;
    top: 16px !important;
    width: 50% !important;
  }
}


/* Nudge the whole cover composition slightly lower on the page. */
.page-cover .memo.scrapbook-memo {
  top: 38px !important;
}

@media (max-width: 760px) {
  .page-cover .memo.scrapbook-memo {
    top: 22px !important;
  }
}


/* Rebalance the cover: bring the portrait toward the visual centre. */
@media (min-width: 761px) {
  .page-cover .memo.scrapbook-memo {
    width: min(760px, 100%) !important;
  }
  .page-cover .scrapbook-photo {
    left: 18% !important;
    top: 28px !important;
    width: 230px !important;
    max-width: 32% !important;
  }
  .page-cover .writing.handwritten-layout.scrapbook-caption {
    left: 53% !important;
    top: 38px !important;
    width: 40% !important;
    max-width: 310px !important;
  }
}
/* Temporarily hide the product promotion entry */
.entry-promo[hidden] {
  display: none !important;
}
