/* Mostly Asleep prototype: the home page. Hero and scene, day strip, planner, notes. */

main { padding: 0 16px; }
h1 { margin: 4px 0 0; min-height: 84px; font: 600 24px/28px var(--sans); letter-spacing: -.015em; font-variation-settings: "ROND" var(--rond); text-wrap: balance; }
.makes { margin: 6px 0 0; min-height: 40px; font-size: 15px; line-height: 20px; }
h2 { margin: 0; font: 620 28px/32px var(--sans); letter-spacing: -.015em; font-variation-settings: "ROND" var(--rond); }
h2 em { font: italic 400 30px/32px var(--serif); letter-spacing: 0; }
h2 a { color: inherit; }
h3, h4 { margin: 0; }
section { margin-top: 56px; }

/* ---- The scene ---------------------------------------------------------------- */
#day { margin-top: 10px; }
.scene-frame { aspect-ratio: 2 / 1; overflow: hidden; border-radius: 8px; outline: 1px solid var(--edge); outline-offset: -1px; }
/* Morning is the picture without script in the light scheme. */
#scene { display: block; width: 100%; height: 100%; pointer-events: none; --sky: #DCEBEA; --ink: #23404A; --orb: #C2255C; }
html[data-sky="dawn"] #scene { --sky: #E2DADD; --ink: #4A4763; }
html[data-sky="noon"] #scene { --sky: #EEF3EE; --ink: #1E3A3A; }
html[data-sky="late"] #scene { --sky: #E8E6B8; --ink: #4A3F2A; }
html[data-sky="dusk"] #scene { --sky: #DACACF; --ink: #3A2440; }
html[data-sky="night"] #scene { --sky: #14262A; --ink: #7FA39A; --orb: #DCE6E2; }
@media (prefers-color-scheme: dark) {
  /* Without script in the dark scheme: asleep under the night sky. */
  html:not([data-js]) #scene { --sky: #14262A; --ink: #7FA39A; --orb: #DCE6E2; }
  html:not([data-js]) .stars { opacity: 1; }
}
.sky { fill: var(--sky); }
.ink { fill: var(--ink); }
.ink-s { fill: none; stroke: var(--ink); }
.sky-s { fill: none; stroke: var(--sky); }
.orb-fill { fill: var(--orb); }
.dot-sky { stroke: var(--sky); }
.dot-ink { stroke: var(--ink); }
.dot-orb { stroke: var(--orb); }
/* The cut: a hairline of sky where one paper shape lies over another. Not an outline. */
.cut { stroke: var(--sky); stroke-width: 1.3; stroke-linejoin: round; }
.cut-s { stroke: var(--sky); stroke-width: .9; stroke-linejoin: round; }
.sky, .ink, .ink-s, .sky-s, .orb-fill, .dot-sky, .dot-ink, .dot-orb, .cut, .cut-s { transition: fill 1.2s linear, stroke 1.2s linear; }
.stars { opacity: 0; transition: opacity 1.2s linear; }
html[data-sky="night"] .stars { opacity: 1; }
/* Without script the sun or moon sits in the clear sky above the desk. */
.orb { transform: translate(var(--orb-x, 276px), var(--orb-y, 66px)); transition: transform .6s linear, opacity .6s linear; }
html[data-orb="none"] .orb { opacity: 0; }

/* Sloth: one set of joint angles per pose. Asleep is the default and the no-script picture. */
html { --rx: 104px; --ry: 93px; --rr: 3deg; --neck: 30deg; --af: 150deg; --an: 150deg; --el: 28deg; --lf: 67deg; --ln: 125deg; }
html[data-pose="eating"] { --rx: 226px; --ry: 78px; --rr: -12deg; --neck: 20deg; --af: 17deg; --an: -60deg; --el: 75deg; --lf: 0deg; --ln: 6deg; --rond: 60; }
html[data-pose="playing"] { --rx: 222px; --ry: 76px; --rr: 4deg; --neck: -22deg; --af: 0deg; --an: 168deg; --el: 8deg; --lf: -4deg; --ln: 186deg; --rond: 60; }
html[data-pose="working"] { --rx: 258px; --ry: 100px; --rr: 78deg; --neck: 112deg; --af: 54deg; --an: 83deg; --el: -60deg; --lf: 92deg; --ln: 97deg; --rond: 0; }
html[data-pose="hang"] { --ry: 76px; --rr: 0deg; --neck: 0deg; --af: -28deg; --an: -60deg; --el: 75deg; --lf: -5deg; --ln: 6deg; --rond: 60; }
html[data-pose="hang"][data-to="eating"] { --rx: 226px; }
html[data-pose="hang"][data-to="playing"] { --rx: 222px; }
html[data-pose="hang"][data-to="working"] { --rx: 258px; }
.sloth-root { transform: translate(var(--rx), var(--ry)) rotate(var(--rr)) scale(1.5); }
.t-neck { transform: rotate(var(--neck)); }
.t-af { transform: rotate(var(--af)); }
.t-an { transform: rotate(var(--an)); }
.t-el { transform: rotate(var(--el)); }
.t-lf { transform: rotate(var(--lf)); }
.t-ln { transform: rotate(var(--ln)); }
/* The slow change is for the live clock only: 6 s under the branch, then 4 s into the pose. */
.sloth-root, .turn { transition: transform 4s cubic-bezier(.4, 0, .2, 1); }
html[data-pose="hang"] .sloth-root, html[data-pose="hang"] .turn { transition-duration: 6s; }
/* Anything a person asks for (drag, tap, key, button) lands in a quarter of a second. */
html[data-scrub] #scene *, html[data-quick] #scene * { transition-duration: .25s; transition-timing-function: ease-out; }
html[data-settle] .orb { transition: none; }

@media (prefers-reduced-motion: no-preference) {
  @supports selector(:has(*)) {
    @keyframes breathe { from { scale: 1 1; } to { scale: 1 1.035; } }
    @keyframes sway2 { from { rotate: -1.5deg; } to { rotate: 1.5deg; } }
    @keyframes stir { 0%, 91% { rotate: 0deg; } 95% { rotate: -12deg; } 100% { rotate: 0deg; } }
    @keyframes leaf { from { rotate: -1.5deg; } to { rotate: 1.5deg; } }
    @keyframes swing { from { rotate: -6deg; } to { rotate: 6deg; } }
    @keyframes nod { from { rotate: -2deg; } to { rotate: 2deg; } }
    @keyframes desk { from { rotate: -2.5deg; } to { rotate: 2.5deg; } }
    @keyframes glance { 0%, 100% { rotate: 0deg; } 36%, 64% { rotate: -14deg; } }
    .breath { animation: breathe 5s ease-in-out infinite alternate; }
    .leaf-a { animation: leaf 7s ease-in-out infinite alternate; }
    .leaf-b { animation: leaf 9s ease-in-out infinite alternate; }
    .leaf-c { animation: leaf 11s ease-in-out infinite alternate; }
    html:not([data-pose]) .t-el, html[data-pose="asleep"] .t-el { animation: sway2 7s ease-in-out infinite alternate, stir 48s ease-in-out infinite; animation-composition: add; }
    html[data-pose="playing"] .sway { transform-origin: 222px 28px; animation: swing 3s ease-in-out infinite alternate; }
    html[data-pose="eating"] .glance, html[data-pose="working"] .glance { animation: nod 2.5s ease-in-out infinite alternate; }
    html[data-pose="working"] .t-el { animation: desk 2s ease-in-out infinite alternate; }
    html[data-glance] .glance { animation: glance 5.5s ease-in-out 1; }
    /* Pause the scene: the switch is plain CSS, so it works without script. */
    html:has(#pause:checked) #scene *, html[data-away] #scene * { animation-play-state: paused; }
    html:has(#pause:checked) #scene * { transition: none; }
  }
}
@media (prefers-reduced-motion: reduce) { #scene * { transition: none; } }

/* ---- Status, strip, controls -------------------------------------------------- */
.now { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-height: 24px; margin: 6px 0 0; }
.now-tag { color: var(--muted); font: 500 12px/24px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
html:not([data-js]) .now-tag { display: none; }
.say { font: italic 400 19px/24px var(--serif); }
.aside { min-height: 20px; margin: 0; color: var(--muted); font: italic 400 16px/20px var(--serif); }

/* The day strip. Each part of the day has its own form, so nothing depends on colour:
   rest a full block, play a low block, eating an empty outline, work a tall spike. */
.strip { position: relative; height: 44px; margin-top: 6px; }
#day-bar { position: absolute; inset: 2px 0 auto; display: flex; align-items: flex-end; height: 28px; }
#day-bar span { flex: 1 0 0; min-width: 0; height: 20px; border-right: 2px solid var(--ground); }
#day-bar span:last-child { border-right: 0; }
#day-bar .rest { flex-grow: 900; background: var(--rest); }
#day-bar .eat { flex-grow: 120; box-shadow: inset 0 0 0 2px var(--edge); }
#day-bar .eat2 { flex-grow: 90; }
#day-bar .play { flex-grow: 60; height: 11px; background: var(--play); }
#day-bar .play2 { flex-grow: 230; }
#day-bar .work { flex-grow: 40; height: 28px; background: var(--accent); }
.hours { position: absolute; inset: 31px 0 auto; height: 13px; margin: 0; padding: 0; list-style: none; color: var(--muted); font: 500 11px/13px var(--mono); }
.hours li { position: absolute; top: 0; translate: -50% 0; }
.hours li:nth-child(1) { left: 0; translate: none; }
.hours li:nth-child(2) { left: 16.667%; }
.hours li:nth-child(3) { left: 33.333%; }
.hours li:nth-child(4) { left: 50%; }
.hours li:nth-child(5) { left: 66.667%; }
.hours li:nth-child(6) { left: 83.333%; }
.hours li:nth-child(7) { right: 0; translate: none; }
.marker { position: absolute; top: 0; left: calc(var(--v, 0) * 100%); width: 14px; height: 32px; margin-left: -7px; border: 2px solid var(--ground); border-radius: 7px; background: var(--accent); pointer-events: none; }
html:not([data-js]) .marker { display: none; }
#day-range { position: absolute; top: 0; left: -14px; width: calc(100% + 28px); height: 44px; margin: 0; opacity: 0; cursor: pointer; touch-action: pan-y; -webkit-appearance: none; appearance: none; background: none; }
#day-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 44px; }
#day-range::-moz-range-thumb { width: 28px; height: 44px; border: 0; }
.strip:has(#day-range:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }

/* Controls cut like the scene: paper slips, two of them pointed the way they go. */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0 3px; min-height: 44px; }
.ctl { height: 44px; min-width: 44px; padding: 0; border: 0; background: none; color: var(--on-rest); font: 600 13px/20px var(--sans); cursor: pointer; }
.ctl span { display: block; padding: 5px 8px; background: var(--rest); }
#earlier span { padding-left: 15px; clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); }
#later span { padding-right: 15px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
#to-now span { padding-right: 11px; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }
.ctl:disabled { cursor: default; }
.ctl:disabled span { background: none; box-shadow: inset 0 0 0 1.5px var(--edge); color: var(--muted); }
.pause { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-left: auto; font: 600 13px/20px var(--sans); cursor: pointer; }
#pause { position: relative; flex: none; width: 32px; height: 18px; margin: 0; border: 1.5px solid var(--text); border-radius: 2px; -webkit-appearance: none; appearance: none; background: none; cursor: pointer; }
#pause::before { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; background: var(--text); clip-path: polygon(0 0, 100% 0, 100% 100%, 4px 100%, 0 calc(100% - 4px)); transition: translate .12s; }
#pause:checked { border-color: var(--accent); background: var(--accent); }
#pause:checked::before { translate: 14px 0; background: var(--on-accent); }

/* ---- The two products, in the first screen ------------------------------------ */
.today { margin-top: 8px; }
.today ul { margin: 0; padding: 0; list-style: none; }
.today li { border-top: 1px solid var(--edge); }
.today a { display: flex; align-items: center; gap: 12px; min-height: 59px; padding: 2px 0; color: var(--text); text-decoration: none; }
.shot-s { flex: none; width: 54px; height: 54px; overflow: hidden; border-radius: 6px; outline: 1px solid var(--edge); outline-offset: -1px; }
.shot-s img { display: block; width: 54px; height: 54px; object-fit: cover; object-position: 50% 0; }
.shot-px img { object-fit: none; object-position: 55.3% 57.3%; image-rendering: pixelated; }
.row-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.row-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 8px; }
.row-name { font-weight: 620; font-size: 16px; line-height: 20px; letter-spacing: -.005em; }
.row-kind { color: var(--muted); font: 500 11px/14px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.row-status { font-weight: 600; font-size: 13px; line-height: 18px; }
.row-status i { font: italic 400 16px/18px var(--serif); }
.row-what { color: var(--muted); font-size: 12px; line-height: 15px; }
/* A swatch drawn like the product's part of the strip. */
.sw { display: inline-block; width: 11px; margin-right: 6px; }
.sw-rest { height: 11px; background: var(--rest); }
.sw-play { height: 6px; background: var(--play); }

/* ---- Planner ------------------------------------------------------------------- */
.legend { margin: 10px 0 0; color: var(--muted); font: 500 12px/18px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.daytable { margin-top: 14px; overflow-x: auto; border-block: 1px solid var(--edge); }
.daytable summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 14px; list-style: none; cursor: pointer; }
.daytable summary::-webkit-details-marker { display: none; }
.daytable summary::before { content: ""; flex: none; margin-right: 10px; border-block: 5px solid transparent; border-left: 7px solid var(--text); transition: rotate .12s; }
.daytable[open] summary::before { rotate: 90deg; }
.daytable table { width: 100%; border-collapse: collapse; font: 500 12px/16px var(--mono); }
.daytable caption { padding: 4px 0 8px; text-align: left; font: italic 400 19px/24px var(--serif); }
.daytable th, .daytable td { padding: 6px 8px 6px 0; border-top: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); text-align: left; vertical-align: top; }
.daytable th { color: var(--muted); font-weight: 500; }
.lookin { margin: 8px 0 12px; font-size: 14px; }
.lookin a { display: inline-block; padding: 8px 5px; font-weight: 600; }
html:not([data-js]) .lookin { display: none; }
.allday { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 0; padding: 10px 12px; border: 1.5px solid var(--edge); border-radius: 4px; font-size: 14px; line-height: 20px; }
.allday .mono { flex: none; color: var(--muted); }

.block { margin-top: 28px; }
.band { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 12px; border-radius: 4px; }
.band h3 { font-weight: 650; letter-spacing: -.02em; font-variation-settings: "ROND" var(--rond); }
.dur { padding-bottom: 7px; font: 500 12px/16px var(--mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.b-rest .band { min-height: 150px; padding-bottom: 6px; background: var(--rest); color: var(--on-rest); }
.b-rest h3 { font-size: 64px; line-height: 64px; }
.b-play .band { min-height: 48px; align-items: center; background: var(--play); color: var(--on-play); }
.b-play h3 { font-size: 40px; line-height: 44px; }
.b-play .dur, .b-eat .dur { padding-bottom: 0; }
.b-eat .band { min-height: 35px; align-items: center; box-shadow: inset 0 0 0 2px var(--edge); }
.b-eat h3 { font-size: 28px; line-height: 32px; }
.b-work .band { min-height: 7px; padding: 0; border-radius: 2px; background: var(--accent); }
.under { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.under h3 { font-weight: 650; font-size: 20px; line-height: 24px; font-variation-settings: "ROND" var(--rond); }
.under .dur { padding: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; min-height: 20px; margin: 8px 0 0; color: var(--muted); font: 500 12px/20px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.here { display: none; align-items: center; gap: 7px; color: var(--text); font: italic 400 17px/20px var(--serif); letter-spacing: 0; text-transform: none; }
.here::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
html[data-block="rest"] .b-rest .here, html[data-block="play"] .b-play .here, html[data-block="eating"] .b-eat .here, html[data-block="work"] .b-work .here { display: inline-flex; }
.nothing { margin: 8px 0 0; color: var(--muted); }

.entry { margin-top: 12px; padding: 16px; border-left: 4px solid var(--text); background: var(--surface); }
.entry.pencil { border-left: 4px dashed var(--edge); }
.entry.unsched { border-left: 4px dotted var(--edge); }
.kind { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font: 500 12px/16px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.kind img { display: block; border-radius: 9px; }
.entry h4 { margin-top: 6px; font-weight: 620; font-size: 24px; line-height: 28px; letter-spacing: -.01em; }
.entry h4 a { display: inline-block; padding: 8px 0; color: var(--text); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.entry p { margin: 12px 0 0; }
.entry p.kind { margin: 0; }
.entry p.status { margin: 2px 0 0; font-weight: 600; font-size: 14px; line-height: 20px; }
.status i { font: italic 400 17px/20px var(--serif); }
.entry .lead { margin: 0; font-weight: 500; font-size: 17px; }
.shots { display: flex; gap: 12px; margin: 16px -16px 0; padding: 0 16px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 16px; }
.shot { flex: none; width: 216px; height: 347px; margin: 0; overflow: hidden; border-radius: 12px; outline: 1px solid var(--edge); outline-offset: -1px; scroll-snap-align: start; }
.shot img { display: block; width: 216px; height: 347px; }
/* The game at exactly 1x, through a window that keeps its health bar and the opponent. */
.pixel { max-width: 548px; height: 344px; margin: 16px 0 0; overflow: hidden; border-radius: 4px; }
.pixel img { display: block; width: 100%; height: 100%; object-fit: none; object-position: 80% 0; image-rendering: pixelated; }
.btn { display: inline-block; margin-top: 16px; color: var(--on-accent); font-weight: 600; text-decoration: none; }
.btn span { display: flex; align-items: center; min-height: 48px; padding: 0 28px 0 18px; background: var(--accent); clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); }
.entry .small { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 18px; }
.workshop { margin: 28px 0 0; padding: 2px 0 2px 16px; border-left: 4px dotted var(--edge); font-weight: 500; font-size: 17px; }

/* ---- About and log ------------------------------------------------------------- */
.note p { max-width: 34em; margin: 14px 0 0; }
.log { margin: 14px 0 0; padding: 0; list-style: none; }
.log li { padding: 12px 0; border-top: 1px solid var(--edge); }
.log time { display: block; color: var(--muted); font: 500 12px/16px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.log p { max-width: 34em; margin: 4px 0 0; }
.feed { display: inline-block; padding: 10px 0; font-weight: 600; }

/* ---- Desktop: the hero is one band that scrolls away; the planner takes the page - */
@media (min-width: 1024px) {
  body { font-size: 17px; line-height: 27px; }
  main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto auto 1fr; column-gap: 24px; align-items: start; max-width: var(--wrap); margin: 8px auto 0; padding: 0 32px; box-sizing: content-box; }
  main > * { grid-column: 1 / -1; }
  #day { grid-column: 1 / 8; grid-row: 1 / span 3; margin-top: 0; }
  h1 { grid-column: 8 / -1; grid-row: 1; min-height: 0; margin-top: 0; font-size: 36px; line-height: 40px; letter-spacing: -.02em; }
  .makes { grid-column: 8 / -1; grid-row: 2; min-height: 0; margin-top: 16px; font-size: 18px; line-height: 26px; }
  .today { grid-column: 8 / -1; grid-row: 3; margin-top: 24px; }
  .today a { min-height: 71px; gap: 16px; }
  .shot-s, .shot-s img { width: 60px; height: 60px; }
  .shot-px img { object-position: 55.8% 57.8%; }
  .row-name { font-size: 18px; line-height: 24px; }
  .row-status { font-size: 15px; line-height: 22px; }
  .row-status i { font-size: 18px; line-height: 22px; }
  .row-what { font-size: 13px; line-height: 17px; }
  .row-kind { font-size: 12px; }
  h2 { font-size: 36px; line-height: 40px; }
  h2 em { font-size: 39px; line-height: 40px; }
  .now { min-height: 28px; margin-top: 12px; }
  .say { font-size: 22px; line-height: 28px; }
  .aside { min-height: 24px; font-size: 18px; line-height: 24px; }
  .now-tag, .legend, .meta, .dur, .kind, .log time, .allday .mono { font-size: 13px; }
  .strip { margin-top: 10px; }
  .ctl, .pause { font-size: 14px; }
  section { margin-top: 80px; }
  .block { margin-top: 40px; }
  .band { padding: 0 20px; }
  .b-rest .band { min-height: 240px; padding-bottom: 10px; }
  .b-rest h3 { font-size: 96px; line-height: 96px; }
  .b-play .band { min-height: 77px; }
  .b-play h3 { font-size: 56px; line-height: 60px; }
  .b-eat .band { min-height: 56px; }
  .b-eat h3 { font-size: 40px; line-height: 44px; }
  .b-work .band { min-height: 11px; }
  .under h3 { font-size: 24px; line-height: 28px; }
  .entry { padding: 24px; }
  .entry.full { display: grid; grid-template-columns: minmax(0, 58%) minmax(0, 1fr); column-gap: 32px; align-content: start; }
  .entry.full > * { grid-column: 2; }
  .entry.full > .shots, .entry.full > .pixel { grid-column: 1; grid-row: 1 / span 9; margin: 0; scroll-padding-left: 0; }
  .entry.full > .shots { padding: 0 0 6px; }
  .entry.full > .pixel { height: 400px; }
  .entry.full > .btn { justify-self: start; }
  .entry h4 { font-size: 28px; line-height: 32px; }
  .entry p.status { font-size: 15px; line-height: 22px; }
  .status i { font-size: 18px; line-height: 22px; }
  .sideways { display: none; }
  #about { grid-column: 1 / 7; }
  #log { grid-column: 7 / -1; }
}
@media (min-width: 1440px) {
  h1 { font-size: 48px; line-height: 52px; }
  .makes { font-size: 20px; line-height: 28px; }
  h2 { font-size: 44px; line-height: 48px; }
  h2 em { font-size: 47px; line-height: 48px; }
  .say { font-size: 24px; line-height: 30px; }
  .now { min-height: 30px; }
  .b-rest h3 { font-size: 112px; line-height: 112px; }
  .b-play h3 { font-size: 64px; line-height: 68px; }
  .b-eat h3 { font-size: 44px; line-height: 48px; }
  .entry h4 { font-size: 32px; line-height: 36px; }
  .shot, .shot img { width: 200px; height: 321px; }
}
