/* Cozyty: the site. It borrows the game's own look (its ink panels, candy buttons and Baloo lettering), as Cozysters'
   site does its game's (cozy-coasting's site/, which this is made after), so the page reads like the game paused on a
   sheet. Behind everything, the sky runs through a day as you scroll. */

/* The lettering, served from here (fonts/, with their licenses in fonts/licenses/). Baloo 2 is the game's own copy
   (../data/fonts/), one file for every weight from 500 to 800 (and the latin-ext half only if a page ever needs it).
   Pacifico only ever spells "Cozy", in the name, so it's cut down to those letters:
     pyftsubset data/fonts/pacifico-latin.woff2 --text=Cozy --layout-features='*' --flavor=woff2 --output-file=site/fonts/pacifico-cozy.woff2
   and DynaPuff, smol farm's lettering on its badge, is Google Fonts' cut of just "smol farm" (css2?family=DynaPuff:wght@700&text=smol%20farm). */
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(../fonts/baloo-2-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(../fonts/baloo-2-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'Pacifico'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/pacifico-cozy.woff2) format('woff2'); }
@font-face { font-family: 'DynaPuff'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/dynapuff-smol-farm.woff2) format('woff2'); }

/* (the game's own colors: ui::theme, in src/ui/kit.cpp) */
:root {
  --ink: #221d45;
  --ink-raised: #2f2860;
  --panel: rgba(34, 29, 69, 0.9);
  --text: #fff6e6;
  --body: #e4def8;
  --muted: #b8b1da;
  --bulb: #ffd36b;
  --bulb-edge: #c99a2e;
  --mint: #7fe0c4;
  --candy: #ff8fb8;
  --line: rgba(255, 255, 255, 0.13);
  --font: 'Baloo 2', ui-rounded, 'SF Pro Rounded', 'Avenir Next', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --wide: 1240px;
  /* the sky, set from js/site.js as you scroll (these are the game's midday colors) */
  --sky-top: #5fa6e8; --sky-haze: #c8e2ee; --sky-bot: #d8eef4; --glow: #fff3de; --glow-a: 0.3; --glow-x: 50%; --stars: 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.55; color: var(--text); background: transparent; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; }
/* (a <picture>'s <source>s only offer files: left to the browser, they'd each take a row of a grid) */
source { display: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--bulb); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ------------------------------------------------ the sky */
.sky {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, var(--sky-top), var(--sky-haze) 64%, var(--sky-bot) 93%, color-mix(in srgb, var(--sky-bot), white 20%));
}
/* the glow on the sun's side of the horizon */
.sky .glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 75% at var(--glow-x) 100%, var(--glow), transparent 70%);
  opacity: var(--glow-a);
}
.sky .stars { position: absolute; inset: 0 0 25%; opacity: var(--stars); background-size: 900px 600px; mask-image: linear-gradient(to bottom, #000 55%, transparent); }

/* ------------------------------------------------ the wordmark, as on the game's title screen: "Cozy" in Pacifico, in
   the yellow of the lights, and "ty" in Baloo, in mint, each with a thick ink edge (ui_menu.cpp has its sizes) */
.sign { margin: 0; line-height: 0; }
.wordmark { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 14px 30px rgba(20, 8, 30, 0.35)); }
.wordmark text { font-family: var(--font); paint-order: stroke; stroke-linejoin: round; stroke-width: 15px; stroke: var(--ink); }
.wordmark .w-cozy { font-family: Pacifico, cursive; font-size: 104px; fill: var(--bulb); }
.wordmark .w-ty { font-size: 118px; font-weight: 800; letter-spacing: -0.01em; fill: var(--mint); }

/* ------------------------------------------------ the way to buy it: the store's badge, its height set by --badge (and
   room beside it for another store's, should there be one: they'd stack when there's no room) */
.stores { --badge: 66px; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 18px; }
.store {
  display: block; height: var(--badge); border-radius: calc(var(--badge) * 0.12); line-height: 0; text-decoration: none;
  box-shadow: 0 12px 30px rgba(10, 6, 30, 0.5), 0 2px 6px rgba(10, 6, 30, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.store:hover { transform: translateY(-3px); box-shadow: 0 18px 38px rgba(10, 6, 30, 0.55), 0 3px 8px rgba(10, 6, 30, 0.35); }
.store:active { transform: translateY(0); transition-duration: 0.05s; }
.store:focus-visible { outline: 3px solid var(--bulb); outline-offset: 3px; }
.store img { display: block; height: 100%; width: auto; }
/* smol farm's, the size an App Store badge would be: its logo and wordmark on the store's own buy panel (the night sky
   running down to the hills, in a leaf-to-dusk rim), with a firefly glow when you point at it */
.store.smolfarm {
  display: flex; align-items: center; gap: calc(var(--badge) * 0.17); box-sizing: border-box; width: calc(var(--badge) * 564 / 168);
  padding: 0 0 0 calc(var(--badge) * 0.19); border: 2px solid transparent; color: #f1efff; text-align: left;
  background: linear-gradient(160deg, #1b1650, #12334a 55%, #0d3b36) padding-box, linear-gradient(135deg, #10b981, #06b6d4, #6366f1) border-box;
}
.store.smolfarm:hover { box-shadow: 0 18px 38px rgba(10, 6, 30, 0.55), 0 3px 8px rgba(10, 6, 30, 0.35), 0 0 26px rgba(16, 185, 129, 0.45); }
.store.smolfarm img { height: 64%; }
.store.smolfarm span { display: grid; gap: calc(var(--badge) * 0.03); line-height: 1; }
.store.smolfarm small { font-size: calc(var(--badge) * 0.2); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #a7f3d0; }
.store.smolfarm b { font: 700 calc(var(--badge) * 0.41) / 1 DynaPuff, var(--font); white-space: nowrap; }
/* the 404's way home, on the game's yellow button, a size up */
.home {
  display: inline-block; margin: 0; border-radius: 999px; padding: 13px 30px 10px;
  background: var(--bulb); color: var(--ink); font-weight: 800; font-size: 21px; line-height: 1.2;
  box-shadow: 0 4px 0 var(--bulb-edge), 0 14px 32px rgba(20, 8, 30, 0.35);
  text-decoration: none; transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.home:hover { background: #ffdc85; }
.home:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--bulb-edge), 0 8px 20px rgba(20, 8, 30, 0.35); }
/* under the badge, what it plays on: each system's mark and name, small, in the shadowed white of the words over the
   pictures */
.platforms {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 16px 0 0; padding: 0; list-style: none;
  font-size: 15px; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 3px rgba(20, 8, 30, 0.7), 0 1px 12px rgba(20, 8, 30, 0.5);
}
.platforms li { display: flex; align-items: center; gap: 7px; }
/* (over the pictures up top, on a bar like the one that turns them, so it reads as the page's and not the town's) */
.hero .platforms {
  margin-top: 18px; padding: 7px 18px 6px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-shadow: none;
}
.hero .platforms svg { filter: none; }
.platforms svg { width: 18px; height: 18px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(20, 8, 30, 0.6)) drop-shadow(0 1px 10px rgba(20, 8, 30, 0.45)); }

/* ------------------------------------------------ hero: the town, with the title screen over it */
.hero { position: relative; min-height: min(100svh, 1000px); display: grid; place-items: center; overflow: hidden; background: #6f7f5c; touch-action: pan-y; }
/* The pictures, taking turns (js/site.js): the one showing (.on) fades in over the one before (.was). The rest aren't
   displayed, so their lazy loading waits until each is next (.near). */
.slides { position: absolute; inset: 0; z-index: 0; }
.slide { display: none; position: absolute; inset: 0; opacity: 0; }
.slide.near, .slide.on, .slide.was { display: block; }
.slide.on { z-index: 2; opacity: 1; transition: opacity 1.2s ease; }
.slide.was { z-index: 1; opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx, 50%) 50%; transform-origin: var(--fx, 50%) 50%; }
/* while one's showing, it drifts in a little closer */
.slide.on img, .slide.was img { animation: drift 9s linear forwards; }
@keyframes drift { to { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  .slide.on img, .slide.was img { animation: none; }
  .slide.on { transition-duration: 0.4s; }
}
/* a shade behind the words, as the title screen has (darker at the top, clearing on the way down) and a soft one round
   the name, so they read over any of the pictures: a town's a busier thing to be read over than a sky */
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 62% 48% at 50% 44%, rgba(20, 14, 45, 0.5), transparent 74%), linear-gradient(to bottom, rgba(20, 14, 45, 0.34), rgba(20, 14, 45, 0.1) 45%, transparent 65%);
}
.hero-card { position: relative; z-index: 1; display: grid; justify-items: center; text-align: center; padding: 0 var(--gutter) 6vh; }
.hero .sign { width: min(500px, 80vw); }
.tagline { margin: 6px 0 26px; font-size: clamp(20px, 2.4vw, 27px); font-weight: 700; line-height: 1.25; text-shadow: 0 2px 14px rgba(20, 8, 30, 0.55); }
/* (up top, as the title screen has it: close under the name, with the ink's shadow, and the store's button under that) */
.hero .tagline { margin: -4px 0 0; text-shadow: 0 2px 0 var(--ink), 0 2px 14px rgba(20, 8, 30, 0.7); text-wrap: balance; }
.hero .stores { margin-top: 26px; }
/* under the pictures: when the one showing is, and a bar to go back and forth, pick one, or stop them */
.deck { position: absolute; z-index: 1; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; }
.deck[hidden] { display: none; }
.where { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; text-shadow: 0 1px 3px rgba(20, 8, 30, 0.7), 0 1px 12px rgba(20, 8, 30, 0.5); }
.deck-bar {
  display: flex; align-items: center; height: 42px; padding: 0 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.turn, .motion { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.turn:hover, .motion:hover { background: var(--ink-raised); }
.turn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* one dot for each picture, the one showing drawn long, in the yellow of the lights */
.dots { display: flex; }
.dots button { display: grid; place-items: center; min-width: 24px; height: 34px; padding: 0 3px; border: 0; background: none; cursor: pointer; }
.dots button::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--muted); opacity: 0.65; transition: width 0.25s ease, background-color 0.25s ease, opacity 0.25s ease; }
.dots button:hover::before { opacity: 1; }
.dots button[aria-current]::before { width: 20px; background: var(--bulb); opacity: 1; }
/* stopping them: just the symbol for what a tap will do, past a thin line */
.motion { margin-left: 4px; position: relative; }
.motion::before { content: ''; position: absolute; left: -3px; top: 9px; bottom: 9px; border-left: 1px solid var(--line); }
.motion svg { width: 16px; height: 16px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.motion .i-play, .motion.paused .i-pause { display: none; }
.motion.paused .i-play { display: block; }

/* ------------------------------------------------ the features: a picture from the game beside a sheet of words */
main { display: grid; gap: clamp(90px, 16vh, 170px); padding: clamp(90px, 16vh, 170px) 0 0; }
.feature { width: min(var(--wide), 100% - 2 * var(--gutter)); margin: 0 auto; display: grid; gap: clamp(20px, 3vw, 36px); align-items: center; }
@media (min-width: 960px) {
  .feature { grid-template-columns: 7fr 5fr; }
  .feature.flip { grid-template-columns: 5fr 7fr; }
  .feature.flip .shot { order: 2; }
}
/* a sheet, like the ones the game opens over the town */
.sheet {
  background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 22px; padding: clamp(22px, 2.8vw, 34px) clamp(22px, 3vw, 36px);
  box-shadow: 0 18px 50px rgba(8, 5, 25, 0.45);
}
.sheet h2 { margin: 0 0 12px; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.1; font-weight: 800; letter-spacing: -0.005em; text-wrap: balance; }
.sheet p { margin: 0 0 12px; color: var(--body); font-size: 18px; max-width: 46ch; text-wrap: pretty; }
.sheet p:last-child { margin-bottom: 0; }
.sheet a { color: var(--bulb); text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
.shot { display: block; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(8, 5, 25, 0.45); }
/* (a <picture> is only there to offer the AVIF: the picture inside it is what's laid out) */
.shot picture, .night picture { display: contents; }
.shot img { width: 100%; height: auto; }

/* ------------------------------------------------ the finale: the festival's night */
.night { width: 100%; position: relative; display: grid; place-items: center; margin-top: 40px; }
.night-shot {
  grid-area: 1 / 1; width: 100%; height: auto; min-height: 560px; object-fit: cover; object-position: var(--fx, 50%) 100%;
  /* the dark of the woods along its top melts into the page's night sky */
  mask-image: linear-gradient(to bottom, transparent, #000 24%);
}
.finale { grid-area: 1 / 1; position: relative; display: grid; justify-items: center; text-align: center; padding: 0 var(--gutter); align-self: start; margin-top: clamp(40px, 11vw, 160px); }
.finale .sign { width: min(360px, 66vw); }
.finale .tagline { margin-top: 0; }
/* the 404 page: the same night, filling the window, with the town along the bottom */
.lost { margin-top: 0; min-height: 100svh; align-items: end; }

.foot { padding: 28px var(--gutter) 40px; text-align: center; background: #060a26; }
.foot p { margin: 0; font-size: 14px; color: var(--muted); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { min-height: 88svh; }
  .home { font-size: 19px; padding: 12px 26px 9px; }
  /* (a size down and closer together) */
  .platforms { gap: 4px 12px; font-size: 14px; }
  .platforms li { gap: 6px; }
  .platforms svg { width: 16px; height: 16px; }
  .hero .platforms { padding-inline: 12px; }
  .stores { --badge: 56px; flex-direction: column; align-items: center; }
  .sheet p { font-size: 17px; }
  /* (the night's picture is cut to a phone's width: the castle's side of it, and its fireworks, kept under the words) */
  .night-shot { --fx: 74%; }
}
/* a phone on its side: the words a size down, with the deck's room kept clear under them (its bar, the words over it
   and its 18px off the bottom), and the 404's way home in view without scrolling */
@media (max-height: 500px) {
  .hero .sign { width: min(500px, 80vw, 78svh); }
  .hero .tagline { font-size: 18px; }
  .hero .stores { --badge: 52px; margin-top: 14px; }
  .hero .platforms { margin-top: 12px; }
  .hero-card { padding-bottom: 96px; }
  .lost { padding-top: 0; }
  .lost .finale { margin-top: 24px; }
}
