/* Treacle Fox Games
 *
 * The palette is the logo's own: paper, the fox, the tin, and the treacle.
 * Archivo at its narrowest, blackest cut does the shouting (like the letters on the tin);
 * Source Serif 4 does the talking.
 */

:root {
  --paper: #fefbee;
  --cream: #fbefd6;
  --treacle: #361d11;
  --deep: #2a1006;
  --fox: #c74e18;
  --fox-deep: #a8410f;
  --tan: #c19766;
  --cream-soft: rgb(251 239 214 / .66);
  --cream-faint: rgb(251 239 214 / .34);

  --display: "Archivo", "Arial Narrow", "Helvetica Neue", sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --gutter: clamp(20px, 5vw, 72px);
  --measure: 1180px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--treacle);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font: 400 1.0625rem/1.62 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
p, h1, h2, h3, dl, dd, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--fox); outline-offset: 4px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- the rim */

/* An orange band with two cream pinstripes — the top of the tin. */
.rim, .small-print::before {
  display: block;
  height: 16px;
  background:
    linear-gradient(var(--cream) 0 0) 0 9px / 100% 2px no-repeat,
    linear-gradient(var(--cream) 0 0) 0 13px / 100% 1px no-repeat,
    var(--fox);
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  padding: 0 var(--gutter) clamp(56px, 8vw, 104px);
  text-align: center;
}

.masthead-nav {
  display: flex;
  justify-content: flex-end;
  gap: clamp(20px, 3vw, 36px);
  padding-top: 20px;
  font: 600 .9375rem/1 var(--display);
}

/* Links carry a treacle line; on hover a drop gathers under it and falls. */
.masthead-nav a {
  position: relative;
  padding: 6px 0;
  text-decoration: none;
}
.masthead-nav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; border-radius: 1px;
  background: var(--treacle);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s cubic-bezier(.3, .7, .2, 1);
}
.masthead-nav a::before {
  content: "";
  position: absolute; left: calc(50% - 2.5px); bottom: -1px;
  width: 5px; height: 6px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--treacle);
  opacity: 0;
  transform: translateY(-2px) scale(.4);
}
.masthead-nav a:hover::after { transform: scaleX(1); }
.masthead-nav a:hover::before { animation: drop 1.1s .25s cubic-bezier(.55, 0, .75, .3) both; }

@keyframes drop {
  0%   { opacity: 1; transform: translateY(-2px) scale(.4, .3); }
  40%  { opacity: 1; transform: translateY(1px) scale(.9, 1.1); }
  100% { opacity: 0; transform: translateY(14px) scale(.8, 1.3); }
}

.hero {
  width: clamp(300px, min(88vw, (100svh - 250px) * 1.0816), 700px);
  aspect-ratio: 1114 / 1030;
  margin: clamp(4px, 1.5vw, 16px) auto 0;
}
.hero iframe {
  display: block;
  width: 100%; height: 100%;
  border: 0;
  background: var(--paper);
  pointer-events: none;
}

.motto {
  max-width: 24em;
  margin: clamp(8px, 1.4vw, 18px) auto 0;
  font-size: clamp(1.3rem, 2.3vw, 1.75rem);
  font-style: italic;
  line-height: 1.35;
  text-wrap: balance;
}

/* "stuck", underlined in treacle, with a drip forming under it once the intro has played */
.stuck {
  position: relative;
  white-space: nowrap;
}
.stuck::after {
  content: "";
  position: absolute; left: -.03em; right: .02em; bottom: -.02em;
  height: .09em; border-radius: .05em;
  background: var(--treacle);
  transform-origin: left;
}
.stuck-drip {
  position: absolute;
  left: 57%; top: calc(100% - .07em);
  width: .5em; height: .75em;
  fill: var(--treacle);
  transform-origin: 50% 0;
  overflow: visible;
}
.stuck-shine { fill: none; stroke: var(--cream); stroke-width: 1.6; stroke-linecap: round; }

.js .stuck::after { animation: draw .7s var(--motto-delay, .4s) cubic-bezier(.5, 0, .2, 1) both; }
.js .stuck-drip { animation: ooze 2.2s calc(var(--motto-delay, .4s) + .45s) cubic-bezier(.45, 0, .15, 1) both; }
.first-visit { --motto-delay: 3.5s; }

@keyframes draw { from { transform: scaleX(0); } }
@keyframes ooze {
  0%   { transform: scale(.7, 0); }
  55%  { transform: scale(1.04, .82); }
  100% { transform: scale(1, 1); }
}

/* ---------------------------------------------------------------- the shelf */

.shelf { position: relative; color: var(--cream); }

.shelf-surface-wrap, .shelf-drips-wrap { overflow: hidden; line-height: 0; }
.shelf-surface-wrap { margin-bottom: -1px; }
.shelf-drips-wrap { margin-top: -1px; }

/* Narrow screens crop the edges rather than squash them, so drips stay drip-shaped. */
.shelf-surface, .shelf-drips {
  position: relative; left: 50%;
  translate: -50% 0;
  width: max(100%, 860px);
  height: auto;
  fill: var(--treacle);
  overflow: visible;
}
.shelf-surface { aspect-ratio: 1440 / 120; }
.shelf-drips { aspect-ratio: 1440 / 191; transform-origin: top; }

.sheen {
  fill: none;
  stroke: var(--cream);
  stroke-linecap: round;
  stroke-width: 2.4px;
  stroke-opacity: .42;
  vector-effect: non-scaling-stroke;
}
.shelf-drips .sheen { stroke-width: 2px; stroke-opacity: .38; }

/* The drips run off the shelf the first time it comes into view. */
.js .shelf-drips { transform: scaleY(.2); }
.js .shelf-drips.is-poured { transform: none; transition: transform 3.2s cubic-bezier(.5, .05, .25, 1); }

.shelf-inner {
  background: var(--treacle);
  padding: clamp(24px, 4vw, 48px) var(--gutter) clamp(56px, 7vw, 104px);
}
.shelf-inner > * { max-width: var(--measure); margin-inline: auto; }

.shelf h2, .studio h2, .label-title {
  font-family: var(--display);
  font-stretch: 62%;
  font-weight: 900;
  line-height: .82;
}
.shelf h2 {
  font-size: clamp(3.4rem, 9vw, 7.5rem);
  margin-bottom: clamp(48px, 6vw, 88px);
}

/* ---------------------------------------------------------------- the game */

.shot {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--deep);
  box-shadow: 0 28px 60px -30px rgb(0 0 0 / .7);
  isolation: isolate;
}
.shot img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
}
/* stepping through: the room you're in rushes past, the next one settles into place */
.shot img.leaving { transform: scale(1.1); transition: transform 1s cubic-bezier(.4, 0, .6, 1); }
.shot img.incoming { opacity: 0; transform: scale(1.04); }
.shot img.incoming.in {
  opacity: 1; transform: none;
  transition: opacity .6s ease .12s, transform 1.2s cubic-bezier(.2, .7, .2, 1) .12s;
}

/* the other rooms, as a strip of thumbnails */
.rooms {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.2vw, 16px);
  margin-top: clamp(10px, 1.2vw, 16px);
}
.room {
  appearance: none;
  border: 0; background: none; padding: 0;
  display: grid; gap: 9px;
  text-align: left;
  font: 500 .875rem/1.25 var(--display);
  color: var(--cream-soft);
  cursor: pointer;
  transition: color .2s;
}
.room img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  opacity: .5;
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: opacity .25s, outline-color .25s;
}
.room:hover { color: var(--cream); }
.room:hover img { opacity: .85; }
.room.is-current { color: var(--cream); cursor: default; }
.room.is-current img { opacity: 1; outline-color: var(--fox); }

.game-text {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: start;
  gap: 32px clamp(32px, 6vw, 96px);
}
.gallery-steam { margin-top: clamp(48px, 6vw, 80px); }
/* the game's own lockup: its wax seal, its name and its line */
.game-seal { width: 72px; height: 72px; margin-bottom: 18px; }
.game-title h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.6rem, 4.8vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.022em;
}
.game-title p {
  margin-top: 18px;
  max-width: 17em;
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.4;
  color: var(--cream-soft);
}
.game-copy { padding-top: 96px; }
.game-copy p {
  max-width: 33em;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgb(251 239 214 / .8);
}
.game-copy .game-lede {
  font-size: clamp(1.25rem, 1.8vw, 1.45rem);
  line-height: 1.5;
  color: var(--cream);
}
.game-copy p + p { margin-top: 16px; }

/* what the Steam version adds, as a plain list */
.features {
  columns: 2;
  column-gap: 32px;
  margin-top: 22px;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: rgb(251 239 214 / .86);
}
.features li {
  break-inside: avoid;
  padding: 0 0 9px 18px;
  position: relative;
}
.features li::before {
  content: "";
  position: absolute; left: 0; top: .6em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--fox);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-top: 26px;
}
/* not a button until there's a store page to go to */
.soon {
  display: inline-flex;
  align-items: center;
  padding: 13px 20px 12px;
  border: 1.5px solid var(--cream-faint);
  border-radius: 3px;
  font: 700 1.0625rem/1 var(--display);
  color: var(--cream);
}
.quiet-link {
  font: 500 1rem/1.3 var(--display);
  color: var(--cream-soft);
  text-decoration-color: var(--fox);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.quiet-link:hover { color: var(--cream); }

/* ---- the free version, with screenshots below its text */

.free {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  margin-top: clamp(80px, 10vw, 144px);
  padding-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--tan);
  scroll-margin-top: 24px;
}
.gallery-free { margin-top: 16px; }
.free-text { max-width: 42em; }
.free > h3 {
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -.018em;
}
.free-text p {
  margin-top: 0;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgb(251 239 214 / .8);
}

/* ---- enter: a door that swings open, and a drip that won't let go */

.enter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  padding: 14px 24px 14px 18px;
  background: var(--fox);
  color: var(--cream);
  border-radius: 3px;
  text-decoration: none;
  font: 700 1.0625rem/1 var(--display);
  transition: background .3s;
}
.enter:hover { background: var(--fox-deep); }

.enter-door { width: 20px; height: 25px; overflow: visible; }
.enter-frame { fill: #ffe3a8; }
.enter-leaf {
  fill: var(--treacle);
  transform-box: fill-box;
  transform-origin: left center;
  transition: transform .55s cubic-bezier(.3, .7, .2, 1);
}
.enter:hover .enter-leaf, .enter:focus-visible .enter-leaf { transform: perspective(40px) rotateY(-62deg); }

.enter-drip {
  position: absolute;
  right: 26%; top: calc(100% - 1px);
  width: 13px; height: 25px;
  fill: var(--fox);
  transform-origin: 50% 0;
  transform: scale(.8, 0);
  transition: transform .5s cubic-bezier(.5, 0, .5, 1), fill .3s;
}
.enter:hover .enter-drip { transform: none; fill: var(--fox-deep); transition: transform 1.4s .15s cubic-bezier(.35, 0, .2, 1), fill .3s; }

/* ---------------------------------------------------------------- the studio */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(40px, 6vw, 88px) var(--gutter) clamp(72px, 10vw, 136px);
}
.studio h2 { font-size: clamp(2.8rem, 6vw, 5rem); margin-bottom: 26px; }
.studio-lede {
  font-size: clamp(1.35rem, 2.1vw, 1.7rem);
  line-height: 1.32;
  margin-bottom: 18px;
}
.studio-copy p + p { margin-top: 14px; }
.studio-copy p:not(.studio-lede) { max-width: 34em; }
.studio-copy a {
  text-decoration-color: var(--fox);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.studio-copy a:hover { color: var(--fox-deep); }

.lid { justify-self: center; width: min(100%, 400px); text-align: center; }
.lid svg { display: block; width: 100%; height: auto; overflow: visible; }
.lid-rim { fill: var(--fox); }
.lid-groove { fill: none; stroke: var(--cream); stroke-width: 2; }
.lid-groove.fine { stroke-width: 1; stroke: var(--fox-deep); }
.lid-face { fill: var(--paper); }
.lid figcaption {
  margin-top: 18px;
  font-style: italic;
  font-size: 1rem;
  color: rgb(54 29 17 / .72);
}

/* ---------------------------------------------------------------- the small print */

.small-print {
  position: relative;
  background: var(--cream);
  padding: 0 var(--gutter) 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
}
.small-print::before {
  content: "";
  flex: 0 0 calc(100% + 2 * var(--gutter));
  margin-inline: calc(-1 * var(--gutter));
  margin-bottom: clamp(24px, 4vw, 44px);
}

/* the panel on the back of the tin */
.label-panel {
  width: min(100%, 440px);
  padding: 10px 14px 6px;
  border: 2px solid var(--treacle);
  background: var(--paper);
  font-family: var(--display);
  font-size: .875rem;
  line-height: 1.4;
}
.label-title {
  font-size: 2.8rem;
  padding-bottom: 6px;
  border-bottom: 9px solid var(--treacle);
}
.label-panel dl div {
  padding: 7px 0 6px;
  border-bottom: 1px solid var(--treacle);
}
.label-panel dl div:first-child { border-bottom-width: 4px; }
.label-panel dl div:last-child { border-bottom: 0; }
.label-panel dt { display: inline; font-weight: 800; }
.label-panel dt::after { content: ": "; }
.label-panel dd { display: inline; }
.label-panel a { color: var(--fox-deep); text-underline-offset: 2px; }

.colophon {
  display: grid;
  justify-items: end;
  gap: 22px;
  font: 500 .9375rem/1.2 var(--display);
}
.colophon ul { display: grid; justify-items: end; gap: 12px; }
.colophon a { text-decoration: none; }
.colophon a:hover { color: var(--fox-deep); }
.colophon p { opacity: .7; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  .game-text { grid-template-columns: minmax(0, 1fr); }
  .game-copy { padding-top: 0; }
  .free { grid-template-columns: minmax(0, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .lid { grid-row: 1; width: min(76%, 320px); }
}

@media (max-width: 560px) {
  .masthead-nav { justify-content: center; }
  .features { columns: 1; }
  /* the thumbnails become a strip you can swipe along */
  .rooms, .free .rooms {
    grid-auto-columns: 42%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 6px;
    padding: 6px;
    margin: 4px -6px 0;
    scrollbar-width: none;
  }
  .room { scroll-snap-align: start; }
  .small-print { flex-direction: column; align-items: stretch; }
  .colophon, .colophon ul { justify-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .shelf-drips { transform: none; }
}
