:root {
  /* Compliance vocabulary: Interactions**: compartments respond with gentle `transform: IntersectionObserver threshold `0.15` trigger animations just elements (humanist reading SemiBold (600 while honoring typographic tradition. (Google */
  --cream: #e8ddd0;
  --umber: #4a3728;
  --brown: #5c4a3a;
  --taupe: #8a7b6b;
  --terracotta: #c4856c;
  --sage: #8b9e7c;
  --indigo: #3d4a5e;
  --gold: #c9a84c;
  --ink: #1e1a16;
  --lavender: #c8bdd4;
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--brown);
  font-family: "Lora", Georgia, serif;
  overflow-x: hidden;
  transition: background 700ms ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background-image: var(--paper-grain);
  opacity: .055;
  mix-blend-mode: multiply;
}

.opening-veil {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 20;
  opacity: 1;
  pointer-events: none;
  transition: opacity 1500ms ease 2000ms;
}
body.awake .opening-veil { opacity: 0; }

.day-scroll { width: 100%; }
.tray {
  min-height: 100vh;
  padding: clamp(14px, 2vw, 28px) clamp(44px, 5vw, 82px) clamp(14px, 2vw, 28px) clamp(14px, 2vw, 28px);
  display: grid;
  place-items: stretch;
  background: var(--tray-bg, var(--cream));
}
.dawn-tray { --tray-bg: linear-gradient(135deg, rgba(200,189,212,.94), rgba(196,133,108,.22) 58%, #e8ddd0); }
.morning-tray { --tray-bg: linear-gradient(145deg, #e8ddd0, rgba(139,158,124,.22)); }
.midday-tray { --tray-bg: linear-gradient(135deg, #f4ebdd, #e8ddd0 52%, rgba(139,158,124,.28)); }
.afternoon-tray { --tray-bg: linear-gradient(135deg, #e8ddd0, rgba(201,168,76,.27)); }
.evening-tray { --tray-bg: linear-gradient(145deg, rgba(196,133,108,.36), #e8ddd0 42%, rgba(61,74,94,.82)); }
.night-tray { --tray-bg: #1e1a16; color: var(--cream); }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, minmax(74px, 1fr));
  gap: 4px;
  min-height: calc(100vh - clamp(28px, 4vw, 56px));
  background-color: var(--cream);
  background-image: radial-gradient(circle at 3px 3px, rgba(74,55,40,.14) 1px, transparent 1.5px), var(--paper-grain);
  background-size: 26px 26px, 90px 90px;
  padding: 4px;
  box-shadow: 0 28px 90px rgba(74,55,40,.16);
}
.night-grid { background-color: #342c28; box-shadow: 0 28px 100px rgba(0,0,0,.45); }

.cell {
  position: relative;
  overflow: hidden;
  background: rgba(232,221,208,.88);
  padding: clamp(16px, 2.2vw, 34px);
  color: var(--brown);
  transform: scale(.96);
  opacity: 0;
  transition: transform 600ms ease-out, opacity 600ms ease-out, box-shadow 400ms ease-out;
}
.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--paper-grain);
  opacity: .04;
}
.cell.in-view { transform: scale(1); opacity: 1; transition-delay: var(--delay, 0ms); }
.illustrated:hover { transform: scale(1.015); z-index: 4; }
.night-tray .cell { background: rgba(61,74,94,.46); color: var(--cream); }
.evening-tray .cell { border-radius: 8px; }

h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 700; color: var(--umber); margin: 0; line-height: .95; }
h2 { font-size: clamp(2.8rem, 6vw, 5rem); }
p { font-size: clamp(1rem, 1.8vw, 1.25rem); line-height: 1.75; margin: 0; }
.label, .rail-stop span, .current-time, .food-cell p, .constellation-label {
  font-family: "DM Sans", Arial, sans-serif;
  font-weight: 500;
  font-size: clamp(.7rem, 1vw, .85rem);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--taupe);
}
.cjk, .jp { font-family: "Noto Serif JP", serif; }
.kr { font-family: "Noto Serif KR", serif; }
.night-tray h2, .night-tray .label, .night-tray .current-time { color: var(--cream); }

.dawn-grid .hero-cell { grid-column: 1 / 8; grid-row: 1 / 5; padding: 0; display: grid; place-items: center; }
.dawn-grid .script-cell { grid-column: 8 / 13; grid-row: 1 / 3; }
.dawn-grid .chart-cell { grid-column: 8 / 11; grid-row: 3 / 5; }
.dawn-grid .passage-cell { grid-column: 1 / 13; grid-row: 5 / 7; }
.sunrise-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.title-chars { position: relative; z-index: 2; font-size: clamp(2.8rem, 6vw, 5rem); color: var(--umber); text-shadow: 0 2px 22px rgba(232,221,208,.55); }
.title-chars span { display: inline-block; opacity: 0; transform: translateY(12px); animation: charIn 900ms ease forwards; }
.title-chars span:nth-child(1){animation-delay:2.12s}.title-chars span:nth-child(2){animation-delay:2.22s}.title-chars span:nth-child(3){animation-delay:2.32s}.title-chars span:nth-child(4){animation-delay:2.42s}.title-chars span:nth-child(5){animation-delay:2.52s}.title-chars span:nth-child(6){animation-delay:2.62s}.title-chars span:nth-child(7){animation-delay:2.72s}.title-chars span:nth-child(8){animation-delay:2.82s}.title-chars span:nth-child(9){animation-delay:2.92s}
@keyframes charIn { to { opacity: 1; transform: translateY(0); } }
.dawn-stars i, .stars i, .night-stars i { position: absolute; width: 13px; height: 13px; background: var(--gold); clip-path: polygon(50% 0,61% 36%,98% 35%,68% 57%,79% 92%,50% 70%,21% 92%,32% 57%,2% 35%,39% 36%); filter: blur(.5px); animation: pulse 4s ease-in-out infinite alternate; z-index: 3; }
.dawn-stars i:nth-child(1){left:12%;top:15%;animation-delay:.2s}.dawn-stars i:nth-child(2){left:24%;top:23%;animation-delay:1s}.dawn-stars i:nth-child(3){left:76%;top:16%;animation-delay:1.7s}.dawn-stars i:nth-child(4){left:68%;top:32%;animation-delay:2.4s}.dawn-stars i:nth-child(5){left:42%;top:12%;animation-delay:3s}
@keyframes pulse { from { opacity: .35; transform: scale(.82); } to { opacity: .95; transform: scale(1.12); } }
.constellation { position: absolute; inset: 20px; }
.constellation b { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 18px rgba(201,168,76,.6); }
.constellation b:nth-child(1){left:16%;top:20%}.constellation b:nth-child(2){left:42%;top:35%}.constellation b:nth-child(3){left:62%;top:18%}.constellation b:nth-child(4){left:78%;top:48%}
.chart-cell p { position: absolute; left: 28px; bottom: 20px; font-family: "DM Sans"; letter-spacing: .18em; }

.morning-grid .dew-scene { grid-column: 1 / 7; grid-row: 1 / 5; }
.morning-grid .passage-cell { grid-column: 7 / 13; grid-row: 1 / 3; }
.morning-grid .clock-cell { grid-column: 7 / 10; grid-row: 3 / 7; display: grid; place-items: center; text-align: center; }
.morning-grid .stamp-cell { grid-column: 10 / 13; grid-row: 3 / 7; display: grid; place-items: center; text-align: center; }
.dew-scene svg, .field-scene svg, .market-scene svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dew-scene h2, .market-scene h2, .lantern-scene h2 { position: relative; z-index: 2; }
.clock { width: min(210px, 70%); aspect-ratio: 1; border: 2px solid var(--umber); border-radius: 50%; position: relative; background: rgba(232,221,208,.48); }
.clock::before { content: ""; position: absolute; inset: 48%; border-radius: 50%; background: var(--umber); }
.hand { position: absolute; left: 50%; top: 50%; width: 2px; height: 38%; background: var(--umber); transform-origin: 50% 0; animation: clockspin 48s linear infinite; }
.hand.hour { height: 28%; animation-duration: 120s; }
@keyframes clockspin { to { transform: rotate(360deg); } }
.star-stamp { font-size: clamp(5rem, 12vw, 10rem); color: var(--gold); filter: blur(.2px); }

.midday-grid { grid-template-rows: repeat(6, minmax(62px, 1fr)); }
.market-scene { grid-column: 1 / 7; grid-row: 1 / 5; }
.food-cell:nth-of-type(2) { grid-column: 7 / 10; grid-row: 1 / 3; }
.food-cell:nth-of-type(3) { grid-column: 10 / 13; grid-row: 1 / 3; }
.text-strong { grid-column: 7 / 13; grid-row: 3 / 5; }
.text-strong p { font-weight: 600; font-size: clamp(1.18rem, 2.2vw, 1.55rem); }
.tiny-cell:nth-of-type(5) { grid-column: 1 / 3; grid-row: 5 / 7; }
.tiny-cell:nth-of-type(6) { grid-column: 3 / 5; grid-row: 5 / 7; }
.tiny-cell:nth-of-type(7) { grid-column: 5 / 7; grid-row: 5 / 7; }
.note-cell { grid-column: 7 / 13; grid-row: 5 / 7; }
.food { width: 112px; height: 98px; margin: 6px auto 18px; position: relative; }
.onigiri { background: #f6efe5; clip-path: polygon(50% 4%, 96% 92%, 4% 92%); }
.onigiri::after { content: ""; position: absolute; left: 39%; bottom: 12%; width: 22%; height: 28%; background: var(--indigo); }
.kimbap { border-radius: 50%; background: radial-gradient(circle, #c9a84c 0 18%, #8b9e7c 19% 34%, #f6efe5 35% 52%, #1e1a16 53%); }
.steam { position: absolute; left: 48%; top: 40%; z-index: 3; }
.steam i { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: rgba(255,255,255,.5); animation: steam 2.8s ease-in-out infinite; }
.steam i:nth-child(2){left:24px;animation-delay:.7s}.steam i:nth-child(3){left:-22px;animation-delay:1.3s}
@keyframes steam { from { transform: translateY(36px) scale(.5); opacity: 0; } 35% { opacity: .7; } to { transform: translateY(-70px) scale(1.4); opacity: 0; } }
.tail { transform-origin: 690px 326px; animation: tail 2.5s ease-in-out infinite alternate; }
@keyframes tail { to { transform: rotate(16deg); } }
.tiny-cell { display: grid; place-items: center; text-align: center; }
.tiny-cell span { font-family: "Noto Serif JP"; font-size: clamp(2.4rem, 5vw, 4.8rem); color: var(--gold); }
.tiny-cell.sage span { color: var(--sage); }
.tiny-cell.gold span { color: var(--terracotta); }

.afternoon-grid .field-scene { grid-column: 1 / 8; grid-row: 1 / 7; }
.afternoon-grid .haiku-cell { grid-column: 8 / 13; grid-row: 1 / 4; }
.afternoon-grid .passage-cell { grid-column: 8 / 13; grid-row: 4 / 7; }
.haiku-cell p:last-child { margin-top: 22px; }
.compass-star { animation: pulse 5s ease-in-out infinite alternate; }

.evening-grid .lantern-scene { grid-column: 1 / 7; grid-row: 1 / 5; background: linear-gradient(140deg, rgba(61,74,94,.86), rgba(196,133,108,.7)); color: var(--cream); }
.evening-grid .tea-cell { grid-column: 7 / 10; grid-row: 1 / 4; }
.evening-grid .candle-cell { grid-column: 10 / 13; grid-row: 1 / 4; box-shadow: 0 0 60px 30px rgba(201,168,76,.08); display: grid; place-items: center; }
.evening-grid .passage-cell { grid-column: 7 / 13; grid-row: 4 / 7; }
.lanterns { position: absolute; inset: 0; }
.lanterns i { position: absolute; top: 25%; width: 92px; height: 136px; border-radius: 48% 48% 42% 42%; background: radial-gradient(circle at 50% 46%, #e8ddd0 0 7%, #c9a84c 8% 15%, #c4856c 16% 100%); box-shadow: 0 0 48px rgba(201,168,76,.25); }
.lanterns i:nth-child(1){left:18%;}.lanterns i:nth-child(2){left:44%;top:18%;}.lanterns i:nth-child(3){left:70%;top:31%;}
.lantern-scene p { position: absolute; bottom: 30px; left: 30px; max-width: 70%; }
.tea-cup { width: 160px; height: 92px; border-radius: 0 0 80px 80px; background: var(--cream); border-top: 12px solid var(--sage); margin: 24px auto; position: relative; }
.tea-cup::after { content: ""; position: absolute; right: -38px; top: 16px; width: 46px; height: 38px; border: 10px solid var(--cream); border-left: 0; border-radius: 0 40px 40px 0; }
.candle { width: 70px; height: 132px; background: var(--cream); border-radius: 14px 14px 6px 6px; position: relative; }
.candle i { position: absolute; left: 50%; top: -54px; width: 44px; height: 68px; transform: translateX(-50%); border-radius: 50% 50% 42% 42%; background: radial-gradient(circle at 45% 70%, #e8ddd0 0 12%, #c9a84c 13% 46%, #c4856c 47% 100%); animation: flicker .3s infinite alternate; }
.candle b { position: absolute; left: 49%; top: -5px; width: 3px; height: 18px; background: var(--umber); }
@keyframes flicker { from { transform: translateX(-50%) scale(.92, 1.05); opacity: .78; } to { transform: translateX(-48%) scale(1.08, .94); opacity: 1; } }

.night-grid .starfield { grid-column: 1 / 8; grid-row: 1 / 7; background: linear-gradient(145deg, #1e1a16, #3d4a5e); }
.night-grid .closing-cell { grid-column: 8 / 13; grid-row: 1 / 5; }
.night-grid .moon-cell { grid-column: 8 / 13; grid-row: 5 / 7; display: grid; place-items: center; text-align: center; }
.night-stars { position: absolute; inset: 0; }
.night-stars i { animation-name: twinkle; }
@keyframes twinkle { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.constellation-label { position: absolute; left: 30px; bottom: 30px; color: var(--gold); }
.closing-cell h2 { font-size: clamp(2.4rem, 4.4vw, 4.5rem); color: var(--cream); margin: 18px 0 26px; }
.closing-cell h2 span { display: block; }
.moon-pulse { width: 116px; height: 116px; border-radius: 50%; background: var(--cream); box-shadow: inset -34px 6px 0 #3d4a5e, 0 0 44px rgba(232,221,208,.28); animation: pulse 4.5s ease-in-out infinite alternate; }

.time-rail { position: fixed; right: 15px; top: 4vh; bottom: 4vh; width: 35px; z-index: 10; }
.rail-line { position: absolute; left: 18px; top: 0; bottom: 0; width: 1px; background: rgba(74,55,40,.45); }
.rail-stop { position: absolute; left: 10px; top: var(--pos); width: 17px; height: 17px; border: 1px solid rgba(74,55,40,.4); border-radius: 50%; background: var(--cream); padding: 0; cursor: pointer; }
.rail-stop span { position: absolute; right: 24px; top: -2px; opacity: 0; white-space: nowrap; transition: opacity 220ms ease; }
.rail-stop:hover span, .rail-stop.active span { opacity: 1; }
.orb-marker { position: absolute; left: 0; top: 0; width: 36px; height: 36px; transform: translateY(0); transition: transform 100ms linear; }
.orb-marker svg { position: absolute; inset: 0; width: 36px; height: 36px; fill: var(--terracotta); stroke: var(--terracotta); stroke-width: 3; stroke-linecap: round; transition: opacity 500ms ease; }
.moon-symbol { opacity: 0; fill: var(--gold); stroke: none; }
.orb-marker.night .sun-symbol { opacity: 0; }
.orb-marker.night .moon-symbol { opacity: 1; }
.current-time { position: absolute; right: 26px; top: 0; color: var(--taupe); white-space: nowrap; transition: color 500ms ease; }
.night-mode .rail-line { background: rgba(232,221,208,.35); }
.night-mode .rail-stop { background: var(--indigo); border-color: rgba(232,221,208,.42); }
.night-mode .current-time { color: var(--cream); }

@media (max-width: 760px) {
  .tray { min-height: auto; padding: 12px 48px 12px 12px; }
  .bento-grid { display: flex; flex-direction: column; min-height: auto; }
  .cell { min-height: 220px; }
  .hero-cell, .market-scene, .field-scene, .starfield { min-height: 440px; }
  .time-rail { right: 8px; }
}
