/* Tiny Town Jobs — "sunny town", taken from the cover:
   blue sky with puffy clouds, a little town on green grass, chunky yellow lettering with a navy outline,
   red ribbon, traffic-cone orange, a number Sudoku on paper. */

body[data-book="tiny-town"] {
  --paper: #fffbef; --paper-2: #ffffff; --ink: #102a5c; --ink-soft: #3f5679; --line: #102a5c1f;
  --c1: #e8442e; --c2: #2f7fd6; --c3: #5bb544; --c4: #ffc928; --c5: #ff8a1f;
  --btn: #e8442e; --btn-ink: #fff; --spine: #2f7fd6;
  --sky: #49a8f2; --sky-soft: #d6efff; --grass: #5bb544;
}

/* ---------- logo: studio blue turns fire-truck red and bounces ---------- */
.brand .logo { position: relative; display: inline-grid; }
.brand .logo img { transition: filter .4s ease; }
.spark { display: none; }
.brand .logo::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid #ffc928; opacity: 0; transform: scale(.6); pointer-events: none; }
.brand:hover .logo img, .brand:focus-visible .logo img { animation: boing .7s cubic-bezier(.3, 1.6, .5, 1); filter: hue-rotate(150deg) saturate(1.6) brightness(1.05) drop-shadow(0 3px 0 #ffc928); }
.brand:hover .logo::after, .brand:focus-visible .logo::after { animation: ring .7s ease-out; }
@keyframes boing { 0% { transform: scale(1); } 25% { transform: scale(1.18, .82) translateY(3px); } 50% { transform: scale(.9, 1.14) translateY(-6px); } 75% { transform: scale(1.05, .95); } 100% { transform: scale(1); } }
@keyframes ring { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.5); } }
.brand .word b { color: #e8442e; }

/* ---------- header ---------- */
body[data-book="tiny-town"] .top { background: rgba(255, 251, 239, .86); }
body[data-book="tiny-town"] .top nav a:hover { background: #fff1c2; color: var(--ink); }

/* ---------- buttons: chunky toy buttons ---------- */
body[data-book="tiny-town"] .btn { border-radius: 16px; }
body[data-book="tiny-town"] .btn-main { background: #e8442e; box-shadow: 0 5px 0 #a3261a; }
body[data-book="tiny-town"] .btn-main:hover { box-shadow: 0 7px 0 #a3261a; }
body[data-book="tiny-town"] .btn-main:active { box-shadow: 0 1px 0 #a3261a; }
body[data-book="tiny-town"] .btn-line { border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
body[data-book="tiny-town"] .btn-line:hover { background: #fff1c2; transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
body[data-book="tiny-town"] .btn-small { border-radius: 12px; }
body[data-book="tiny-town"] .langs { border-radius: 12px; } body[data-book="tiny-town"] .langs::before, body[data-book="tiny-town"] .langs a { border-radius: 9px; }

/* ---------- hero: blue sky, sun, drifting clouds, the town on the grass ---------- */
body[data-book="tiny-town"] .hero {
  background: linear-gradient(180deg, #3f9fec 0%, #6cbcf6 40%, #bfe4ff 78%, #d9f0ff 100%);
  padding-bottom: 236px;
}
body[data-book="tiny-town"] .hero .wrap { position: relative; z-index: 2; }
.sun { position: absolute; right: 7%; top: 8%; width: 110px; height: 110px; border-radius: 50%; background: #ffd84a; z-index: 0;
  box-shadow: 0 0 0 16px rgba(255, 216, 74, .25), 0 0 0 34px rgba(255, 216, 74, .12); animation: sun 6s ease-in-out infinite alternate; }
@keyframes sun { to { box-shadow: 0 0 0 22px rgba(255, 216, 74, .3), 0 0 0 46px rgba(255, 216, 74, .1); } }
.cloud { position: absolute; z-index: 1; width: 120px; height: 38px; border-radius: 40px; background: #fff; opacity: .95; animation: cloud 60s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 54px; height: 54px; left: 18px; top: -28px; }
.cloud::after { width: 42px; height: 42px; left: 60px; top: -18px; }
.cloud.c1 { top: 12%; left: -10%; }
.cloud.c2 { top: 30%; left: -30%; transform: scale(.7); animation-duration: 80s; animation-delay: -30s; }
.cloud.c3 { top: 6%; left: -20%; transform: scale(.85); animation-duration: 70s; animation-delay: -50s; }
@keyframes cloud { to { left: 110%; } }
/* the town: cartoon buildings on a strip of grass, a road with a fire truck and a little car driving by */
.townline { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none; }
.houses { display: flex; justify-content: space-around; align-items: flex-end; gap: 10px; padding: 0 2%; max-width: 1500px; margin: 0 auto; }
.houses .bld { width: 120px; height: auto; flex: 0 0 auto; }
.houses .bld[viewBox^="0 0 140"] { width: 140px; }
.houses .tree { width: 64px; height: auto; flex: 0 0 auto; }
.road { position: relative; height: 76px; margin-top: -2px;
  background: linear-gradient(#5bb544 0 10px, #3d8f2c 10px 12px, #d9dee8 12px 18px, #4b5a73 18px 100%); overflow: hidden; }
.road::after { content: ""; position: absolute; left: 0; right: 0; top: 47px; height: 4px; background: repeating-linear-gradient(90deg, #fff 0 34px, transparent 34px 66px); opacity: .8; }
.lane { position: absolute; left: 0; width: 100%; }
.lane.l1 { top: 6px; } .lane.l2 { top: 40px; }
.car { position: absolute; display: block; }
.truck { width: 96px; height: auto; animation: drive-r 18s linear infinite; z-index: 1; }
.mini { width: 60px; height: auto; animation: drive-l 13s linear infinite; animation-delay: -6s; transform: scaleX(-1); }
@keyframes drive-r { from { left: -130px; } to { left: 100%; } }
@keyframes drive-l { from { left: 100%; } to { left: -90px; } }
.car .wheel { transform-box: fill-box; transform-origin: center; animation: spin .6s linear infinite; }
.car .siren { animation: siren .5s steps(1) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes siren { 50% { fill: #e8442e; } }

/* red ribbon label like "Tiny Town Jobs" on the cover */
body[data-book="tiny-town"] .hero .for span {
  display: inline-block; padding: 8px 18px; border-radius: 10px; background: #e8442e; color: #fff; font-weight: 700; font-size: .95rem;
  box-shadow: 0 4px 0 #a3261a; transform: rotate(-2deg);
}

/* chunky title: white and yellow letters with a navy outline and a drop shadow */
body[data-book="tiny-town"] .hero h1 {
  font-size: clamp(3rem, 6vw, 5.3rem); letter-spacing: -.02em; line-height: .95; margin: 20px 0 22px;
  color: #fff; -webkit-text-stroke: .16em #102a5c; paint-order: stroke fill; text-shadow: 0 .09em 0 #102a5c;
}
body[data-book="tiny-town"] .hero h1 span { color: #ffc928; }
body[data-book="tiny-town"] .hero .lead { color: #0f2a52; font-weight: 500; }
body[data-book="tiny-town"] .facts li { background: #3d8f2c; color: #fff; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 4px 0 #2a6a1e; font-weight: 600; }
body[data-book="tiny-town"] .hero .note { color: #23436f; }
body[data-book="tiny-town"] .book3d .sticker { background: #ffc928; color: #102a5c; }

/* ---------- video: the town cinema, marquee lights around the screen ---------- */
.video-sec { padding-top: clamp(40px, 6vw, 80px); }
body[data-book="tiny-town"] .video-frame {
  position: relative; max-width: 940px; margin: 44px auto 0; padding: 22px; border-radius: 22px; background: #102a5c;
  box-shadow: 0 8px 0 #0a1c40, 0 30px 60px -25px rgba(16, 42, 92, .6);
}
body[data-book="tiny-town"] .video-frame::before { content: ""; position: absolute; inset: 7px; border-radius: 16px; pointer-events: none;
  background: radial-gradient(circle, #ffd84a 0 3.5px, transparent 4.5px) 0 0 / 22px 22px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  padding: 9px; animation: bulbs 1.2s steps(2) infinite; }
@keyframes bulbs { 50% { background-position: 11px 11px; } }
.video-label { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); z-index: 2; white-space: nowrap; padding: 8px 20px; border-radius: 10px;
  background: #e8442e; color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .02em; box-shadow: 0 4px 0 #a3261a; }
.video-frame video { position: relative; z-index: 1; display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #0a1c40; border-radius: 10px; }
.video-play { all: unset; cursor: pointer; position: absolute; z-index: 2; left: 50%; top: 50%; width: 86px; height: 86px; margin: -43px 0 0 -43px; border-radius: 50%; display: grid; place-items: center;
  background: #ffc928; color: #102a5c; box-shadow: 0 6px 0 #c48f00, 0 16px 30px rgba(0, 0, 0, .3); transition: transform .3s cubic-bezier(.2, 1.6, .4, 1); }
.video-play svg { width: 40px; height: 40px; margin-left: 6px; }
.video-play:hover { transform: scale(1.1); }
.video-play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.is-playing .video-play { display: none; }

/* ---------- free page + steps ---------- */
body[data-book="tiny-town"] .free { background: #fffbef; }
body[data-book="tiny-town"] .sheet { border-radius: 10px; }
body[data-book="tiny-town"] .free-art .sheet { box-shadow: 0 0 0 10px #fff, 0 0 0 13px #102a5c, 0 14px 0 13px #0a1c40; overflow: visible; }
body[data-book="tiny-town"] .free-art .sheet img { border-radius: 10px; }

/* free page: crayons pop up from behind the page, the numbers 1–4 bounce out */
.cr { position: absolute; z-index: -1; top: 6%; width: 22px; height: 120px; border-radius: 4px 4px 3px 3px; background: var(--k); box-shadow: inset -5px 0 0 rgba(0, 0, 0, .12), inset 0 -26px 0 rgba(255, 255, 255, .35);
  transform: translateY(0) rotate(var(--r)); transition: transform .6s cubic-bezier(.2, 1.8, .4, 1); }
.cr::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 22px; background: linear-gradient(var(--k) 0 45%, #f6d7a7 45%); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.free-art .cr { z-index: 1; }
.free-art .fun { z-index: auto; } .free-art .sheet { z-index: 2; } .free-art .num { z-index: 4; }
.cr1 { left: 12%; --k: #e8442e; --r: -14deg; } .cr2 { left: 28%; --k: #ffc928; --r: -6deg; } .cr3 { left: 46%; --k: #2f7fd6; --r: 2deg; } .cr4 { left: 64%; --k: #5bb544; --r: 8deg; } .cr5 { left: 80%; --k: #ff8a1f; --r: 15deg; }
.free-art:hover .cr, .free-art.play .cr { transform: translateY(-96px) rotate(var(--r)); }
.free-art:hover .cr2, .free-art.play .cr2 { transition-delay: .05s; } .free-art:hover .cr3, .free-art.play .cr3 { transition-delay: .1s; }
.free-art:hover .cr4, .free-art.play .cr4 { transition-delay: .15s; } .free-art:hover .cr5, .free-art.play .cr5 { transition-delay: .2s; }
.num { position: absolute; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; font: 700 1.6rem/1 var(--font); color: #102a5c; background: #fff; border: 3px solid #102a5c; box-shadow: 0 4px 0 #102a5c;
  opacity: 0; transform: scale(.2); transition: transform .55s cubic-bezier(.2, 1.9, .4, 1), opacity .2s; }
.num.n1 { left: -4%; top: 30%; background: #ffc928; } .num.n2 { left: 96%; top: 18%; background: #bfe6ff; } .num.n3 { left: 94%; top: 72%; background: #ffd0c8; } .num.n4 { left: -3%; top: 78%; background: #d6f2c9; }
.free-art:hover .num, .free-art.play .num { opacity: 1; transform: scale(1) rotate(-8deg); }
.free-art:hover .n2, .free-art.play .n2 { transform: scale(1) rotate(10deg); transition-delay: .3s; } .free-art:hover .n1, .free-art.play .n1 { transition-delay: .25s; }
.free-art:hover .n3, .free-art.play .n3 { transform: scale(1) rotate(-6deg); transition-delay: .35s; } .free-art:hover .n4, .free-art.play .n4 { transform: scale(1) rotate(12deg); transition-delay: .4s; }
body[data-book="tiny-town"] .sticker-flat { background: #ffc928; }
body[data-book="tiny-town"] .formats li { border-bottom: 2px dashed #b8c6dc; }
.steps-sec { padding-top: 0; }
body[data-book="tiny-town"] .steps li { border: 3px solid #102a5c; border-radius: 18px; box-shadow: 0 6px 0 #102a5c; }
body[data-book="tiny-town"] .steps li::before { width: 50px; height: 50px; border-radius: 6px; background: #ffc928; border: 3px solid #102a5c; transform: rotate(45deg); }
body[data-book="tiny-town"] .steps li:nth-child(2)::before { background: #ff8a1f; }
body[data-book="tiny-town"] .steps li:nth-child(3)::before { background: #5bb544; color: #fff; }
body[data-book="tiny-town"] .steps li::before { content: ""; }
body[data-book="tiny-town"] .steps li { position: relative; }
body[data-book="tiny-town"] .steps li::after { content: counter(s); position: absolute; left: 26px; top: 26px; width: 50px; height: 50px; display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: #102a5c; }
body[data-book="tiny-town"] .steps li:nth-child(3)::after { color: #fff; }
body[data-book="tiny-town"] .steps h3 { margin-top: 18px; }

/* ---------- mini Sudoku on squared paper ---------- */
.sudoku-sec { background: #fff;
  background-image: linear-gradient(#e3edf9 1px, transparent 1px), linear-gradient(90deg, #e3edf9 1px, transparent 1px); background-size: 26px 26px; border-block: 3px solid #102a5c; }
.sudoku-sec .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(30px, 6vw, 80px); align-items: center; }
.sudoku { display: grid; grid-template-columns: repeat(4, 1fr); width: min(84vw, 380px); aspect-ratio: 1; border: 5px solid #102a5c; border-radius: 14px; overflow: hidden; background: #fff;
  box-shadow: 0 8px 0 #102a5c; transform: rotate(1.5deg); }
.sudoku .cell { all: unset; box-sizing: border-box; display: grid; place-items: center; font: 700 clamp(1.8rem, 6vw, 2.6rem)/1 var(--font); color: #2f7fd6; cursor: pointer;
  border-right: 2px solid #b8c6dc; border-bottom: 2px solid #b8c6dc; background: #fff; transition: background-color .2s; }
.sudoku .cell:nth-child(4n) { border-right: 0; }
.sudoku .cell:nth-child(4n+2) { border-right: 5px solid #102a5c; }
.sudoku .cell:nth-child(n+5):nth-child(-n+8) { border-bottom: 5px solid #102a5c; }
.sudoku .cell:nth-child(n+13) { border-bottom: 0; }
.sudoku .cell.given { color: #102a5c; background: #fff7d6; cursor: default; }
.sudoku .cell:not(.given):hover { background: #eaf5ff; }
.sudoku .cell:focus-visible { outline: 4px solid #ff8a1f; outline-offset: -6px; }
.sudoku .cell.pop { animation: pop .3s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes pop { from { transform: scale(.6); } }
.sudoku .cell.clash { background: #ffe1dc; color: #c4291b; }
.sudoku.is-solved .cell { background: #e4f6dc; }
.sudoku.is-solved { animation: cheer .8s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes cheer { 30% { transform: rotate(-3deg) scale(1.04); } 60% { transform: rotate(3deg) scale(1.02); } 100% { transform: rotate(1.5deg); } }
.sudoku-msg { margin-top: 18px; min-height: 1.6em; font-weight: 700; color: #3d8f2c; }

/* ---------- what's inside, faq, author ---------- */
body[data-book="tiny-town"] .what { background: #d9f0ff; }
body[data-book="tiny-town"] .what-list { border: 4px solid #102a5c; border-radius: 18px; box-shadow: 0 6px 0 #102a5c; }
body[data-book="tiny-town"] .what-list li { border-color: #b8c6dc; }
body[data-book="tiny-town"] .what-list li:nth-child(1) b { color: #e8442e; }
body[data-book="tiny-town"] .what-list li:nth-child(2) b { color: #2f7fd6; }
body[data-book="tiny-town"] .what-list li:nth-child(3) b { color: #3d8f2c; }
body[data-book="tiny-town"] .what-list li:nth-child(4) b { color: #e0730c; }
body[data-book="tiny-town"] .what-note { border-left-color: #ff8a1f; background: #fff1c2; }
body[data-book="tiny-town"] .faq { background: #d9f0ff; padding-top: 0; }
body[data-book="tiny-town"] .faq details { border-bottom: 2px dashed #9fb7d6; }
body[data-book="tiny-town"] .faq summary::after { color: #e8442e; font-weight: 700; }

.author { position: relative; }
body[data-book="tiny-town"] .author { background: #fffbef; border-top: 0; }
.author .wrap { grid-template-columns: 190px minmax(0, 1fr); }
.portrait { display: block; width: 180px; height: 180px; border-radius: 50%; padding: 7px; position: relative; background: repeating-conic-gradient(#e8442e 0 30deg, #ffc928 30deg 60deg); }
.portrait img { width: 100% !important; height: 100% !important; border-radius: 50%; object-fit: cover; border: 5px solid #fff; box-shadow: none !important; }

.more { padding: clamp(46px, 6vw, 70px) 0; background: #5bb544; color: #fff; }
.more .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; }
.more h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 6px; color: #fff; }
.more p { color: #eaffdf; }
.more .btn-main { background: #ffc928; color: #102a5c; box-shadow: 0 5px 0 #c48f00; }
.more .btn-line { background: #fff; }
body[data-book="tiny-town"] .foot { background: #102a5c; color: #cfe3ff; border: 0; }
body[data-book="tiny-town"] .foot a:hover { color: #fff; }

/* 404 */
.lost .wrap { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
.lost-cover { width: min(100%, 360px); justify-self: center; border-radius: 8px; transform: rotate(4deg); box-shadow: 0 0 0 6px #fff, 0 10px 0 6px #102a5c; animation: lost-bob 6s ease-in-out infinite; }
@keyframes lost-bob { 50% { transform: rotate(1deg) translateY(-10px); } }

@media (max-width: 920px) {
  body[data-book="tiny-town"] .hero { padding-bottom: 200px; }
  .houses .opt { display: none; }
  .houses .bld { width: 96px; } .houses .bld[viewBox^="0 0 140"] { width: 112px; } .houses .tree { width: 52px; }
  .sun { width: 70px; height: 70px; right: 5%; top: 3%; }
  .sudoku-sec .wrap { grid-template-columns: 1fr; justify-items: center; }
  .sudoku-sec .sec-head { text-align: left; justify-self: stretch; }
  .author .wrap { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .lost-cover { order: -1; width: min(60%, 260px); }
}
@media (max-width: 560px) {
  body[data-book="tiny-town"] .hero h1 { font-size: clamp(2.6rem, 12.5vw, 3.6rem); }
  body[data-book="tiny-town"] .video-frame { padding: 14px; }
  .video-play { width: 66px; height: 66px; margin: -33px 0 0 -33px; }
  .video-play svg { width: 30px; height: 30px; }
}
@media (max-width: 420px) {
  .houses .bld { width: 84px; } .houses .bld[viewBox^="0 0 140"] { width: 98px; } .houses .tree { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud, .sun, .video-frame::before, .car, .car .wheel, .car .siren { animation: none !important; }
  .truck { left: 12%; } .mini { left: 70%; }
}
