:root {
  --paper: #fbf8f0;
  --ink: #2a211d;
  --ink-soft: #54443e;
  --red: #c0403c;
  --green: #2f6b4f;
  --gutter: clamp(18px, 5vw, 72px);
  --display: "Caprasimo", "Cooper Black", Georgia, serif;
  --body: "Be Vietnam Pro", system-ui, sans-serif;
  --label: "Oswald", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Tab keeps what it focuses clear of the bottom of the screen (and of the floating Menu button there) */
html { scroll-padding-bottom: 96px; }
body {
  margin: 0;
  background: var(--paper) url("img/paper.jpg") repeat 0 0 / 768px 768px;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; }
a { color: inherit; }

/* "Skip to content": the first stop for the Tab key, shown only while it has focus */
.skip-link {
  position: absolute; left: 12px; top: 10px; z-index: 100;
  padding: 11px 18px; border-radius: 12px;
  background: var(--paper); color: var(--ink); box-shadow: 0 0 0 2.5px var(--ink), 0 6px 16px -6px rgba(42, 33, 29, .5);
  font: 600 1rem/1.2 var(--body); text-decoration: none;
  transform: translateY(calc(-100% - 20px));
}
.skip-link:focus { transform: none; outline: none; }
/* (main takes focus from the skip link, so screen readers and the next Tab start there) */
#main:focus { outline: none; }

/* ---------------------------------------------------------------- header (its painted menu: stories/hero/hero.css) */
.top { position: relative; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 14px var(--gutter) 6px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; margin-right: auto; }
.brand-tag { width: 26px; height: auto; transform: rotate(-8deg); }
.brand-word { font: 400 1.75rem/1 var(--display); color: var(--ink); }
@media (min-width: 900px) { .top { padding-top: 22px; } }

/* ---------------------------------------------------------------- the price-tag button */
.tag-btn {
  position: relative;
  display: inline-block;
  text-decoration: none;
  transform: rotate(-2.4deg);
  transform-origin: 20px 50%;
  transition: transform .6s cubic-bezier(.3, 1.9, .45, 1);
  -webkit-tap-highlight-color: transparent;
}
.tag-btn > span {
  position: relative;
  display: block;
  padding: 17px 26px 17px 46px;
  clip-path: polygon(24px 0, 100% 0, 100% 100%, 24px 100%, 0 50%);
  background: #c2362f url("img/tag-lg.webp") center / 100% 100% no-repeat;
  color: #fff7ea;
  font: 700 1.02rem/1.2 var(--body);
  white-space: nowrap;
}
.tag-btn > span::before {
  content: "";
  position: absolute; left: 15px; top: 50%;
  width: 11px; height: 11px; margin-top: -5.5px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.6px rgba(42, 33, 29, .78);
}
.tag-btn::before {
  content: "";
  position: absolute; right: calc(100% - 22px); top: calc(50% - 30px);
  width: 64px; height: 44px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 44'%3E%3Cpath d='M62 30 C 50 22, 44 8, 32 10 C 20 12, 26 30, 14 34 C 8 36, 4 32, 2 28' fill='none' stroke='%23c0403c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  pointer-events: none;
}
.tag-btn:hover, .tag-btn:focus-visible { transform: rotate(1.4deg); }
.tag-btn:active { transform: rotate(3deg) translateY(1px); }
.tag-btn:focus-visible { outline: none; }
.tag-btn:focus-visible > span { box-shadow: inset 0 0 0 3px #fff7ea; }
.tag-btn--small { transform: rotate(2deg); }
.tag-btn--small::before { display: none; }
.tag-btn--small > span { padding: 9px 14px 9px 30px; font-size: .8rem; background-image: url("img/tag-sm.webp"); clip-path: polygon(18px 0, 100% 0, 100% 100%, 18px 100%, 0 50%); }
.tag-btn--small > span::before { left: 11px; width: 8px; height: 8px; margin-top: -4px; }

.text-link { display: inline-flex; align-items: center; gap: 8px; font: 600 1rem var(--body); color: var(--ink-soft); text-decoration: none; }
.text-link:hover { color: var(--red); }
.ink-arrow { width: 40px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s ease; }
.text-link:hover .ink-arrow { transform: translateX(4px); }

/* ---------------------------------------------------------------- hero */
/* (no margin: a hidden paragraph's margin would otherwise still stretch the page, as under /stores' footer) */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* phone: the headline, the Book tag, the shop with its balloons, the logos. desktop: the headline, the
   tag and the logos on the left, the shop large on the right. The headline word and the shop scene
   themselves: stories/hero/scene.css; the logo puddles: stories/hero/hero.css */
.hero { position: relative; display: flex; flex-direction: column; padding-top: 18px; }
.hero-head, .hero-actions, .trusted { position: relative; z-index: 3; margin-left: var(--gutter); margin-right: var(--gutter); }
.hero-actions { display: flex; margin-top: 22px; padding-left: 24px; }

.hero-art { position: relative; z-index: 1; width: min(100%, 560px); margin: 30px auto 0; }
/* phones: a small caption under the shop; desktop: a note in the free corner above the balloons */
.art-hint {
  margin: 2px 0 0; text-align: center;
  font: 500 .86rem var(--body); color: var(--ink-soft);
  pointer-events: none; transition: opacity .6s;
}
html:not(.hero-live) .art-hint, .hero-art.touched .art-hint { opacity: 0; }

/* no z-index here: the logos multiply into the page's own paper, so this must not isolate them */
.trusted { margin-top: 18px; z-index: auto; }
.trusted-label { margin: 0; font: 600 1rem var(--body); color: var(--ink-soft); }

@media (min-width: 900px) {
  /* the headline's column never narrower than 500px, so from 900 to 1064px wide (where 47% would be
     less) the headline stays about 50px, as big as above, rather than shrinking towards 40px */
  .hero {
    display: grid;
    grid-template-columns: minmax(0, max(47%, 500px)) minmax(0, 1fr);
    grid-template-rows: minmax(12px, 1fr) auto auto auto minmax(12px, 1.25fr);
    min-height: min(calc(100svh - 76px), 1030px);
    padding-top: 0;
  }
  .hero-head, .hero-actions, .trusted { grid-column: 1; margin-right: clamp(16px, 2.5vw, 44px); }
  .hero-head { grid-row: 2; }
  .hero-actions { grid-row: 3; margin-top: 30px; }
  .trusted { grid-row: 4; margin-top: 56px; }
  .hero-art { grid-column: 2; grid-row: 1 / -1; align-self: center; width: min(100% - var(--gutter), (min(100svh, 1100px) - 100px) * 1000 / 1480, 700px); margin: 0 auto; }
  .art-hint { position: absolute; right: 0; top: 1%; margin: 0; transform: rotate(3deg); }
}

/* ---------------------------------------------------------------- stores street */
/* One painted street. The section is pinned while you scroll; the scroll walks someone down the
   sidewalk from left to right and the view follows them. */
.stores { position: relative; margin-top: clamp(40px, 8vw, 110px); }
.stores-pin { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; overflow: hidden; overflow: clip; }
.stores-head { padding: clamp(18px, 4vh, 44px) var(--gutter) 10px; }
.stores-head h2 { margin: 0 0 8px; font: 400 clamp(2rem, 6vw, 3.6rem)/1.05 var(--display); }
.stores-head p { margin: 0; max-width: 46ch; color: var(--ink-soft); }
/* (clip, not hidden: these are not scroll boxes, so focus on a card or link further down the street
   can't shift them sideways; site.js moves the walk there instead) */
.street-view { position: relative; flex: 1; overflow: hidden; overflow: clip; }
.street { position: absolute; left: 0; top: 0; will-change: transform; }
.street-art { display: flex; background: no-repeat 0 0 / 100% 100%; }
.street-tile { display: block; flex: none; }

.walker { position: absolute; z-index: 3; background: no-repeat 0 0; pointer-events: none; }
/* (his sprite sheet, and the finale wash's rim below, load once the street is near: site.js adds .is-near) */
.stores.is-near .walker { background-image: url("img/walker.webp"); }
.stores:not(.is-near) .end-wash::before { background-image: none; }

.lot-line { position: absolute; z-index: 2; pointer-events: none; }
.lot-line svg { position: absolute; left: 0; top: 0; width: 100%; height: 40px; overflow: visible; }
.lot-cards { list-style: none; margin: 0; padding: 0; position: absolute; left: 5%; right: 5%; top: 0; display: flex; justify-content: space-between; }
.lot-card { width: 22%; transform-origin: 50% 0; pointer-events: auto; }
.lot-card a { display: block; text-decoration: none; background: #fdfaf2; padding: 5px 5px 6px; box-shadow: 0 1px 0 rgba(42, 33, 29, .5), 0 0 0 1px rgba(42, 33, 29, .55); border-radius: 1px; position: relative; }
.lot-card a::before { content: ""; position: absolute; left: 50%; top: -7px; width: 7px; height: 7px; margin-left: -3.5px; border: 1.5px solid rgba(42, 33, 29, .8); border-radius: 50%; }
.lot-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #efe7d6; }
.lot-card img.card-logo { position: absolute; right: -7px; top: -9px; width: 30%; height: auto; aspect-ratio: auto; object-fit: contain; background: none; transform: rotate(12deg); filter: drop-shadow(0 1px 0 rgba(42, 33, 29, .25)); }
.lot-card .price { display: block; margin-top: 4px; font: 600 .78rem/1 var(--label); color: var(--ink); }
.lot-card.flip img:first-child { animation: flip .6s ease; }
@keyframes flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(0); } 100% { transform: scaleX(1); } }

.lot-info { position: absolute; padding: 0 4px; }
.lot-info h3 { margin: 0; font: 400 clamp(1.2rem, 2.2vw, 1.55rem)/1.15 var(--display); }
.lot-info h3 a { text-decoration: none; }
.lot-where { margin: 4px 0 0; font-size: .9rem; color: var(--ink-soft); }
.lot-count { margin: 4px 0 0; font-size: .95rem; }
.lot-count strong { font: 600 1.12rem var(--label); color: var(--red); letter-spacing: .02em; }
.lot-browse { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font: 600 .95rem var(--body); color: var(--ink); text-decoration: none; }
.lot-browse:hover { color: var(--red); }
.lot-info--vacant p { margin: 4px 0 12px; color: var(--ink-soft); font-size: .95rem; max-width: 34ch; }
.lot-info--vacant .tag-btn { margin-left: 22px; }

/* The end of the street: "Your shop here" travels to the middle of the screen, the street rises away
   under a paper wash (the page's own paper, cut to a painted ragged edge with a dried tide line), and
   the walker jumps down onto the button and lies on it. site.js storesStreet places all of it. */
.stores-end { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
/* the footer comes up under the button once he lies on it (a negative bottom margin, see site.js) */
.stores { transition: margin-bottom .9s cubic-bezier(.3, .6, .3, 1); }
.end-wash {
  position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 160px);
  transform: translate3d(0, 120vh, 0);
  background: var(--paper) url("img/paper.jpg") repeat 0 0 / 768px 768px;
  -webkit-mask: url("stories/stores-end/img/wash-edge.webp") 0 0 / 700px 90px repeat-x, linear-gradient(#000, #000) 0 88px / 100% 100% no-repeat;
  mask: url("stories/stores-end/img/wash-edge.webp") 0 0 / 700px 90px repeat-x, linear-gradient(#000, #000) 0 88px / 100% 100% no-repeat;
}
.end-wash::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 90px; background: url("stories/stores-end/img/wash-rim.webp") 0 0 / 700px 90px repeat-x; }
.stores-end .lot-info--vacant { left: 0; top: 0; transform-origin: 0 0; pointer-events: auto; }
.lot-info--vacant h3, .lot-info--vacant p { width: fit-content; }
.end-walker { position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: none; background: no-repeat 0 0; }
/* Sven's note, pinned beside the button once he sits on it (or under it, where there isn't room
   beside): street.js places it; it goes up with a little drop and a turn, as if just pinned there */
.stores-end .end-note { left: 0; top: 0; padding: 0; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.stores-end .end-note.is-on { opacity: 1; pointer-events: auto; transition: opacity .4s ease .05s; }
.end-note .sven-note { translate: 0 -14px; rotate: calc(var(--tilt) - 6deg); transition: translate .25s ease, rotate .25s ease; }
.end-note.is-on .sven-note { translate: 0 0; rotate: var(--tilt); transition: translate .55s cubic-bezier(.2, .9, .3, 1.25), rotate .8s cubic-bezier(.2, .9, .25, 1.4); }
.end-note .sven-note::before { scale: 1.3; transition: scale .2s ease; }
.end-note.is-on .sven-note::before { scale: 1; transition: scale .35s cubic-bezier(.3, 1.6, .5, 1) .3s; }
.end-note.is-under .sven-note { --tilt: -1.2deg; width: min(342px, calc(100vw - 36px)); }
/* (short phones: a little more compact, so he still has room to hop down from the street above) */
@media (max-height: 739px) {
  .end-note.is-under .sven-note { padding: 29px 22px 19px; font-size: .95rem; }
  .end-note.is-under .sven-face { width: 72px; height: 72px; }
  .end-note.is-under .sven-sig { margin-top: 12px; }
}

/* ---------------------------------------------------------------- Sven's note (the street's end, and /stories')
   A small painted paper note pinned beside the Book button: real text, the shop type painted like the
   hero's headline word (stories/stores-end/note.js turns it), and his name and title as the signature,
   with his portrait beside them once stories/sven/img/ has it. Its paper (drawn as a 9-slice), pin, ink
   flourish and the word's pigment are baked by stories/stores-end/note-bake.js into its img/note/. */
.sven-note {
  --tilt: 1.6deg;
  position: relative; box-sizing: border-box; width: 364px; max-width: 100%; margin: 0;
  padding: 32px 26px 24px;
  border-image: url("stories/stores-end/img/note/paper.webp") 105 fill / 42px / 20px stretch;
  color: var(--ink); text-align: left;
  font: 500 1rem/1.5 var(--body);
  rotate: var(--tilt);
}
/* the pin, pressed through the paper near its top (its head is 15.2px into its picture, the shadow falls
   down and right) */
.sven-note::before {
  content: ""; position: absolute; left: 50%; top: 1px; width: 34px; height: 34px; margin-left: -15.2px;
  background: url("stories/stores-end/img/note/pin.webp") 0 0 / 100% 100% no-repeat;
}
.sven-words { margin: 0; }
.sven-words p { margin: 0; }
.sven-nw { white-space: nowrap; }
/* the type, in a cell that keeps room for the widest one, so the lines never re-wrap as it turns */
.sven-slot { display: inline-grid; }
/* screen readers hear "secondhand"; copying the line takes only the word you can see */
.sven-slot .visually-hidden { -webkit-user-select: none; user-select: none; }
.sven-slot > * { grid-area: 1 / 1; justify-self: start; white-space: nowrap; }
.sven-ghost { visibility: hidden; font-style: normal; }
.sven-type { position: relative; display: inline-block; overflow-x: clip; transition: width .55s cubic-bezier(.4, .1, .25, 1); }
.sven-slot b { display: inline-block; padding: 0 .04em; font: 400 1.14em/1 var(--display); letter-spacing: -.005em; }
.sven-type b {
  color: var(--c, var(--ink));
  background: url("stories/stores-end/img/note/pigment.webp") 0 50% / auto 100%, var(--c, var(--ink));
  background-blend-mode: multiply;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
/* as in the hero: the old type washes off, the new one is brushed on through the hero's brush mask */
.sven-type b.is-leaving { position: absolute; left: 0; bottom: 0; animation: sven-leave .46s cubic-bezier(.55, 0, .8, .25) both; }
.sven-type b.is-brushing {
  -webkit-mask: url("stories/hero/img/scene/brush.webp") no-repeat 100% 0 / 240% 100%;
          mask: url("stories/hero/img/scene/brush.webp") no-repeat 100% 0 / 240% 100%;
  animation: sven-brush .7s cubic-bezier(.5, .08, .3, 1) .16s both;
}
@keyframes sven-leave { to { opacity: 0; filter: blur(.06em) saturate(.6); transform: translateY(.04em) scale(1.012); } }
@keyframes sven-brush { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
/* (in Windows' high contrast colours the type is plain text) */
@media (forced-colors: active) { .sven-type b { -webkit-text-fill-color: currentColor; background: none; } }

/* the signature: his portrait (once there is one), his name over an ink flourish, his title */
.sven-sig { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
/* (the portrait comes painted in its own soft round frame; the slot keeps whatever it is round) */
.sven-face { flex: none; width: 104px; height: 104px; border-radius: 50%; overflow: hidden; }
.sven-face[hidden] { display: none; }
.sven-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sven-who { display: flex; flex-direction: column; align-items: flex-start; }
/* (the flourish runs a little past the end of his name) */
.sven-name { padding: 0 .7em .85em 0; font: 700 1.06rem/1.2 var(--body); background: url("stories/stores-end/img/note/flourish.webp") no-repeat 0 100% / 100% auto; }
.sven-role { margin-top: 1px; font: 500 .86rem/1.3 var(--body); color: var(--ink-soft); }
@media (max-width: 699px) {
  .sven-face { width: 80px; height: 80px; }
}
@media (max-width: 359px) {
  .sven-note { padding-left: 22px; padding-right: 20px; }
  .sven-face { width: 72px; height: 72px; }
  .sven-sig { gap: 12px; }
}

.next-hint { padding: 60px var(--gutter) 140px; text-align: center; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .tag-btn, .ink-arrow, .stores, .art-hint { transition: none; }
  .lot-card.flip img { animation: none; }
  .stores-end .end-note, .end-note .sven-note, .end-note .sven-note::before, .sven-type { transition: none !important; }
}

/* ---------------------------------------------------------------- how it works (next) */
.snap-next { margin: clamp(40px, 8vw, 100px) var(--gutter) 0; padding: 22px 0; color: var(--ink-soft); text-align: center; border-top: 1px dashed rgba(42, 33, 29, .25); border-bottom: 1px dashed rgba(42, 33, 29, .25); }
.snap-next p { margin: 0; }
