/* spudnote.com's shared chrome: the field wallpaper, the sticky header (with the language
 * picker and the night garden toggle), the footer and the back-to-top button. ONE copy,
 * linked by every page (the landing page, its translations, the watch page), so moving
 * between them changes nothing but the content. Page styles must not restyle any of this.
 *
 * Two themes, the app's own (spudnote/Theme.swift): classic cream (default) and night
 * garden (:root[data-theme="dark"], set before paint by the snippet in each page's head
 * and toggled by /site/site.js). The field itself is drawn by /site/field.js.
 */

:root {
  --s-ink: #2A1408;
  --s-ink-dim: #6E4A2E;
  --s-ink-faint: #8A6A4E;
  --s-line: rgba(90, 52, 12, 0.14);
  --s-brand: #9A5518;            /* "spud" in the wordmark: 5.2:1 on cream */
  --s-cta: #2E7018;              /* the Download green */
  --s-nav-bg: rgba(255, 250, 241, 0.82);
  --s-pill: rgba(255, 255, 255, 0.5);
  --s-pill-hover: #fff;
  --s-pill-edge: rgba(90, 52, 12, 0.24);
  --s-menu: #FFFAF1;
  --s-menu-hover: #FFF3E2;
  --s-menu-on: #FDEEDA;
  --s-menu-shadow: 0 18px 42px rgba(90, 52, 12, 0.15), 0 2px 6px rgba(90, 52, 12, 0.06);
  --s-top-bg: #ffffff;
  /* the field's own colours (FieldBackground, Themes.classic): the overscroll and the
     strip iPhone Safari paints under its toolbar take these */
  --s-field-mid: #FFF2DF;
  --s-field-foot: #F7E6CB;
  --s-fred: 'Fredoka', ui-rounded, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  /* night garden (Themes.night): ink, inkSoft, spudDeep, card, sky */
  --s-ink: #F2EEFF;
  --s-ink-dim: #B0AACC;
  --s-ink-faint: #9893B8;
  --s-line: rgba(176, 170, 204, 0.24);
  --s-brand: #F0B968;
  --s-cta: #7FC44C;              /* #2E7018 is unreadable on night */
  --s-nav-bg: rgba(33, 38, 60, 0.82);
  --s-pill: rgba(46, 52, 82, 0.6);
  --s-pill-hover: #2E3452;
  --s-pill-edge: rgba(176, 170, 204, 0.36);
  --s-menu: #2E3452;
  --s-menu-hover: #333852;
  --s-menu-on: #3A4166;
  --s-menu-shadow: 0 18px 42px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --s-top-bg: #2E3452;
  --s-field-mid: #21263C;
  --s-field-foot: #191C2F;
  color-scheme: dark;
}

/* ---------- the field (drawn by /site/field.js) ----------
   Pinned to the screen like the app's wallpaper, which never swipes, while the page
   scrolls over it. The page's own background goes on <html> so it never covers it. */
html { background: var(--s-field-mid); }
body { background: transparent; }
.field, .field-foliage { position: fixed; top: 0; left: 0; width: 100%; height: 100lvh; z-index: -1; pointer-events: none; }
.field svg, .field-foliage svg { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; }
/* iPhone Safari never draws the pinned field under its bottom bar; it fills that strip from
   a pinned, opaque element on the screen's bottom edge (8px is the least it takes). So this
   hairline carries the field's bottom colour down. Touch Safari only. */
.field-foot { display: none; }
@supports (-webkit-touch-callout: none) {
  .field-foot { display: block; position: fixed; left: 0; right: 0; bottom: 0; height: 8px; background: var(--s-field-foot); z-index: 30; pointer-events: none; }
}

/* ---------- header ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--s-nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--s-line);
  font-size: 16px; line-height: 1.5;
}
/* the same box on every page, so the moon, logo and right side never move between them */
header.nav .wrap {
  width: 100%; max-width: 1100px; margin: 0 auto; box-sizing: border-box;
  padding-left: clamp(20px, 5vw, 36px); padding-right: clamp(20px, 5vw, 36px);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.nav-left { display: inline-flex; align-items: center; gap: 12px; }
.nav a { text-decoration: none; }
.studio-home { display: inline-flex; align-items: center; opacity: 0.6; transition: opacity .18s ease; }
.studio-home:hover { opacity: 1; }
.studio-home .moon { width: 22px; height: 22px; display: block; }
.app-brand { display: inline-flex; align-items: center; gap: 9px; padding-left: 12px; border-left: 1px solid var(--s-line); }
.app-brand .app-mark { width: 26px; height: 26px; border-radius: 6px; display: block; }
.app-brand .app-name { font-family: var(--s-fred); font-weight: 600; font-size: 1.2rem; color: var(--s-ink); }
.app-brand .app-name .spud { color: var(--s-brand); }
.nav-right { display: inline-flex; align-items: center; gap: clamp(10px, 2vw, 18px); position: relative; }
.nav-cta {
  font-family: var(--s-fred); font-weight: 600; font-size: 1.02rem;
  color: var(--s-cta); transition: filter .16s ease;
}
.nav-cta:hover { filter: brightness(1.1); }
@media (max-width: 520px) { .app-brand .app-name { display: none; } }

/* the two pills (language, theme): one rule, so they are the same size side by side */
.lang-btn, .themer {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 6px; border-radius: 999px; margin: 0;
  border: 1px solid var(--s-line); background: var(--s-pill);
  color: var(--s-ink-dim); cursor: pointer; font: inherit; line-height: 1;
  -webkit-appearance: none; appearance: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.lang-btn:hover, .themer:hover { background: var(--s-pill-hover); border-color: var(--s-pill-edge); color: var(--s-ink); }
.lang-btn:focus-visible, .themer:focus-visible { outline: 2px solid var(--s-cta); outline-offset: 2px; }
.themer { padding: 5px 7px; }
.themer .ico { width: 18px; height: 16px; display: block; }
/* one icon at a time: the theme you would switch TO */
.themer .ico-sun { display: none; }
:root[data-theme="dark"] .themer .ico-sun { display: block; }
:root[data-theme="dark"] .themer .ico-moon { display: none; }

/* ---------- language picker ---------- */
/* The menu hangs from the right edge of the whole right-hand group (the Download link's edge),
   not from the language button: the theme toggle sits to the button's right, and a menu pinned
   to the button ran up to 85px off the left of a phone screen. From here it always fits. */
.langpick { position: static; }
/* the mark is square-edged SVG; the wrapper does the rounding and the soft ring */
.lang-mark {
  width: 22px; height: 16px; border-radius: 5px; overflow: hidden;
  display: block; flex: none; box-shadow: 0 0 0 1px rgba(90, 52, 12, 0.12);
}
.lang-mark svg { display: block; width: 100%; height: 100%; }
.lang-caret {
  width: 6px; height: 6px; margin: -3px 2px 0 0;
  border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor;
  border-radius: 0 0 2px 0; transform: rotate(45deg);
  transition: transform .2s ease, margin .2s ease;
}
.lang-btn[aria-expanded="true"] .lang-caret { transform: rotate(225deg); margin: 2px 2px 0 0; }
.lang-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  padding: 6px; min-width: 250px;
  background: var(--s-menu); border: 1px solid var(--s-line); border-radius: 16px;
  box-shadow: var(--s-menu-shadow);
}
.lang-menu[hidden] { display: none; }
.lang-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 11px;
  font-family: var(--s-fred); font-weight: 500; font-size: 0.95rem;
  color: var(--s-ink); white-space: nowrap; text-decoration: none;
  transition: background .14s ease;
}
.lang-opt + .lang-opt { margin-top: 2px; }
.lang-opt:hover { background: var(--s-menu-hover); }
.lang-opt:focus-visible { outline: 2px solid var(--s-cta); outline-offset: -2px; }
.lang-sub { color: var(--s-ink-faint); font-weight: 400; }
.lang-opt.is-on { background: var(--s-menu-on); color: var(--s-brand); }
.lang-opt.is-on .lang-sub { color: var(--s-brand); opacity: 0.72; }
.lang-tick { margin-left: auto; width: 12px; height: 12px; flex: none; opacity: 0; }
.lang-opt.is-on .lang-tick { opacity: 1; }
.lang-tick::before {
  content: ""; display: block; width: 5px; height: 9px; margin-left: 3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
@media (prefers-reduced-motion: reduce) { .lang-caret, .lang-opt, .lang-btn, .themer { transition: none; } }

/* ---------- footer ---------- */
footer.site-foot {
  background: transparent;
  color: var(--s-ink-faint);
  border-top: 1px solid var(--s-line);
  padding: 20px 0 28px; margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13.6px; line-height: 1.62;
}
footer.site-foot .wrap {
  width: 100%; max-width: 1100px; margin: 0 auto; box-sizing: border-box;
  padding-left: clamp(20px, 5vw, 36px); padding-right: clamp(20px, 5vw, 36px);
}
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
/* spudnote's Instagram, TikTok and YouTube (Lukas, 2026-11-08): small marks between the studio line and
   the legal links; on phones they get their own centered row above the other two */
.foot { align-items: center; }
.foot-social { display: inline-flex; align-items: center; gap: 6px; }
footer.site-foot .foot-social a {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; color: var(--s-ink-dim); transition: color .15s ease, background .15s ease;
}
footer.site-foot .foot-social a:hover { color: var(--s-ink); background: var(--s-pill); }
footer.site-foot .foot-social a:focus-visible { outline: 2px solid var(--s-cta); outline-offset: 1px; }
.foot-social svg { width: 19px; height: 19px; display: block; }
@media (max-width: 600px) {
  .foot-social { order: -1; width: 100%; justify-content: center; margin-bottom: 2px; }
}
@media (prefers-reduced-motion: reduce) { footer.site-foot .foot-social a { transition: none; } }
/* a line a page may add above the shared row (the watch page: when its numbers were true) */
.foot-note { margin-bottom: 10px; opacity: .85; text-align: center; }
footer.site-foot a { color: inherit; text-decoration: none; }
footer.site-foot a:hover { color: var(--s-ink); }

/* ---------- back to top (fades in on scroll, tap -> smooth scroll up) ---------- */
.to-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  width: 40px; height: 40px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--s-line);
  background: var(--s-top-bg);
  color: var(--s-ink-dim);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease, color .15s, border-color .15s, background .15s, transform .15s;
}
.to-top::before {
  content: ""; display: block;
  width: 10px; height: 10px;
  border-left: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: rotate(45deg) translate(1px, 1px); border-radius: 1px;
}
.to-top.is-visible { opacity: .55; pointer-events: auto; }
.to-top:focus-visible { outline: none; opacity: 1; }
@media (hover: hover) {
  .to-top:hover { color: var(--s-cta); border-color: var(--s-cta); opacity: 1; transform: translateY(-2px); }
}
@media (max-width: 700px) {
  /* room under the footer row so the button never sits on "Terms" at the bottom of the page */
  footer.site-foot { padding-bottom: 64px; }
  .to-top { bottom: 16px; right: 16px; width: 36px; height: 36px; }
  .to-top::before { width: 9px; height: 9px; }
}
@media (prefers-reduced-motion: reduce) { .to-top { transition: opacity .35s ease; } }

/* ---------- the hero's pills, under the header on every other page ----------
   (Lukas, 2026-11-08.) Written by tools/pills.py, the count + little map by site.js. The same pills
   as the landing hero (index.html .peek, same sizes and colors), the page you're on drawn pressed in.
   Phones: one row you can swipe, started with your page's pill in view. Its bottom margin is negative
   so the page's own top spacing absorbs most of it and the headings move down only a little. */
.subpeeks {
  position: relative; z-index: 2; box-sizing: border-box; width: 100%; min-width: 0;
  max-width: 1120px; margin: 0 auto -22px; padding: 16px 16px 0;
  display: flex; justify-content: center; gap: 9px;
}
.subpeeks .peek {
  display: flex; align-items: center; gap: 7px; flex: none;
  height: 34px; box-sizing: border-box; margin: 0; padding: 3px 14px 3px 10px; border-radius: 999px;
  background: #FFFDF8; border: 1px solid var(--s-line);
  box-shadow: 0 5px 14px -10px rgba(90, 52, 12, 0.35);
  color: var(--s-ink); text-decoration: none;
  font-family: var(--s-fred); font-weight: 500; font-size: 0.85rem; line-height: 1;
  transition: transform .2s ease, box-shadow .2s ease;
}
.subpeeks .peek:hover { transform: translateY(-1px); box-shadow: 0 9px 18px -10px rgba(90, 52, 12, 0.45); }
.subpeeks .peek:focus-visible { outline: 2px solid var(--s-brand); outline-offset: 3px; }
.subpeeks .peek[aria-current] {
  background: var(--s-menu-on); border-color: rgba(154, 85, 24, 0.42);
  box-shadow: inset 0 1px 3px rgba(90, 52, 12, 0.16); color: var(--s-brand);
  transform: none; cursor: default;
}
.subpeeks .peek-map { width: 34px; height: 19px; border-radius: 999px; overflow: hidden; background: #FDEEDA; flex: none; }
.subpeeks .peek-map svg { display: block; width: 100%; height: 100%; }
.subpeeks .peek-map path { fill: rgba(90, 52, 12, 0.16); }
.subpeeks .peek-map path.on { fill: #2E7018; }
.subpeeks .peek-text b { color: #2E7018; font-weight: 600; }
.subpeeks .peek-ico {
  width: 20px; height: 22px; border-radius: 999px; overflow: hidden; flex: none;
  background: #FDEEDA; display: flex; justify-content: center; align-items: flex-start;
}
.subpeeks .peek-ico img { height: 24px; width: auto; flex: none; }
.subpeeks .peek-wid { width: 24px; height: 24px; flex: none; border-radius: 7px; overflow: hidden; box-shadow: 0 1px 3px rgba(90, 52, 12, 0.18); }
.subpeeks .peek-wid img { width: 24px; height: 24px; display: block; }
.subpeeks .peek-pic { height: 21px; width: auto; flex: none; display: block; }
@media (max-width: 780px) {
  .subpeeks {
    justify-content: flex-start; gap: 5px; margin-bottom: -18px; padding: 12px 16px 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .subpeeks::-webkit-scrollbar { display: none; }
  .subpeeks > :first-child { margin-left: auto; }
  .subpeeks > :last-child { margin-right: auto; }
  .subpeeks .peek { height: 28px; padding: 3px 11px 3px 8px; gap: 6px; font-size: 0.7rem; }
  .subpeeks .peek-map { width: 28px; height: 16px; }
  .subpeeks .peek-ico { width: 17px; height: 18px; }
  .subpeeks .peek-ico img { height: 20px; }
  .subpeeks .peek-wid, .subpeeks .peek-wid img { width: 20px; height: 20px; }
  .subpeeks .peek-wid { border-radius: 6px; }
  .subpeeks .peek-pic { height: 17px; }
  .subpeeks.scrolls {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent);
            mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent);
  }
  .subpeeks.scrolls.moved {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 34px), transparent);
            mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 34px), transparent);
  }
  .subpeeks.scrolls.at-end {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px);
            mask-image: linear-gradient(to right, transparent 0, #000 16px);
  }
}
:root[data-theme="dark"] .subpeeks .peek { background: #2E3452; box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.7); }
:root[data-theme="dark"] .subpeeks .peek[aria-current] { background: #3A4166; border-color: rgba(240, 185, 104, 0.5); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35); }
:root[data-theme="dark"] .subpeeks .peek-map, :root[data-theme="dark"] .subpeeks .peek-ico { background: #232841; }
:root[data-theme="dark"] .subpeeks .peek-map path { fill: rgba(176, 170, 204, 0.28); }
:root[data-theme="dark"] .subpeeks .peek-map path.on, :root[data-theme="dark"] .subpeeks .peek-text b { fill: #7FC44C; color: #7FC44C; }
@media (prefers-reduced-motion: reduce) { .subpeeks .peek { transition: none; } }

/* ---------- moving between pages (2026-11-08) ----------
   Cross-document view transitions: on a click to another spudnote.com page, the header and the
   pill row stay put and the page's content fades across. Separate real pages still (search and share
   cards need them); browsers without it just change page. Off with reduced motion. (The pressed pill
   sliding to the new page and hover prefetch were tried the same day and removed: Lukas didn't like
   the slide.) */
@view-transition { navigation: auto; }
header.nav { view-transition-name: site-nav; }
.subpeeks { view-transition-name: site-pills; }
::view-transition-group(*) { animation-duration: .32s; animation-timing-function: cubic-bezier(.3, .7, .2, 1); }
::view-transition-old(root) { animation: vt-out .18s ease-in both; }
::view-transition-new(root) { animation: vt-in .3s ease-out .06s both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- the dressed crops in the header (2026-11-08) ----------
   Between the wordmark and the language menu on every page, each bobbing on its own clock (they came
   from the map page's hero). As small as the bar needs: smaller under 600px, three under 431, just the
   potato under 375. Small copies of public/art/*.png in /site/crops/ (90px wide). */
.nav-crops { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 40px; pointer-events: none; }
.nav-crops img { width: 24px; height: auto; flex: none; }
.nav-crops img.big { width: 30px; }
.nav-crops .c1 { --dur: 3.1s; --delay: -.4s; }
.nav-crops .c2 { --dur: 4.3s; --delay: -1.7s; }
.nav-crops .big { --dur: 3.6s; --delay: 0s; }
.nav-crops .c3 { --dur: 3.9s; --delay: -2.3s; }
.nav-crops .c4 { --dur: 4.7s; --delay: -.9s; }
@media (prefers-reduced-motion: no-preference) {
  .nav-crops img { animation: nav-bob var(--dur) ease-in-out var(--delay) infinite; }
}
@keyframes nav-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (max-width: 600px) { .nav-crops { gap: 2px; } .nav-crops img { width: 19px; } .nav-crops img.big { width: 23px; } }
@media (max-width: 430px) { .nav-crops .c1, .nav-crops .c4 { display: none; } }
@media (max-width: 374px) { .nav-crops .c2, .nav-crops .c3 { display: none; } }
