/* Lokal footer: shared by every Lokal app site. Master copy: ~/code/workbench/lokal-footer (don't edit a site's copy).
   Top: the product (icon, name, description), with the language menu on the right, centred on it.
   Bottom: the Lokal line, which ends in the newsletter: a hand of Lokal app icons with an empty slot for the next app,
   the "Made by ... Lokal" sentence, and the email field. Uses the site's --line token (with a fallback) and two colours
   each site's build appends at the end of this file: --news-ink (the site's main text colour) and --news-bg (the
   footer's background). */

@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(schibsted-grotesk-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(schibsted-grotesk-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; }

/* One footer font on every Lokal site, whatever the page above uses. */
.site-footer:has(.footer-lokal) { font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans JP", "Noto Sans KR", sans-serif; }
/* The old footer grid stays as the container (it carries some sites' width), but its grid is switched off. */
.footer-top:has(.footer-lokal) { display: block; }

.footer-main { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px 40px; }
.footer-main p, .footer-lokal p { margin: 0; }
.footer-product { display: grid; gap: 6px; justify-items: start; max-width: 460px; }
.footer-product .footer-brand { grid-area: auto; justify-self: start; margin: 0; }
.footer-side { display: grid; justify-items: end; }
.footer-side .footer-lang { grid-area: auto; justify-self: end; margin: 0; }

/* The two rows are kept apart by space alone, no line between them. */
.footer-lokal { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 290px); align-items: center; gap: 14px 28px;
  margin-top: 28px; font-size: 14px; }

/* The hand: each icon sits in a card, so a new icon can fade in on top of the old one. */
.footer-lokal-apps { display: flex; align-items: flex-end; padding: 6px 4px 2px 6px; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.footer-lokal-card, .footer-lokal-next { flex: none; width: 26px; height: 26px; margin-left: -9px; border-radius: 7px; transform-origin: 50% 130%;
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), margin .35s cubic-bezier(.3, 1.4, .5, 1); }
.footer-lokal-card { position: relative; }
.footer-lokal-card img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; border-radius: 7px; transition: opacity .7s ease; }
.footer-lokal-apps > :first-child { margin-left: 0; }  /* with the padding, the tilted first card stays inside the content edge */
.footer-lokal-apps > :nth-child(1) { transform: rotate(-12deg); }
.footer-lokal-apps > :nth-child(2) { transform: rotate(-8deg); }
.footer-lokal-apps > :nth-child(3) { transform: rotate(-4deg); }
.footer-lokal-apps > :nth-child(4) { transform: rotate(0deg); }
.footer-lokal-apps > :nth-child(5) { transform: rotate(4deg); }
.footer-lokal-apps > :nth-child(6) { transform: rotate(8deg); }
.footer-lokal-apps > :nth-child(7) { transform: rotate(12deg); }
/* Spread out: the mouse anywhere on the Lokal line, keyboard focus or typing in the field (:focus-visible, so a mouse
   click on the hand doesn't leave it stuck open), or the first tap on the icons on a touch screen (.is-open). */
.footer-lokal:hover .footer-lokal-apps > *, .footer-lokal:has(:focus-visible) .footer-lokal-apps > *, .footer-lokal-apps.is-open > * { transform: none; margin-left: 4px; }
.footer-lokal:hover .footer-lokal-apps > :first-child, .footer-lokal:has(:focus-visible) .footer-lokal-apps > :first-child, .footer-lokal-apps.is-open > :first-child { margin-left: 0; }

/* The empty slot for the next app. The + and the tick are drawn, not typed: a font glyph sits differently in every font. */
.footer-lokal-next { display: grid; place-items: center; box-sizing: border-box; border: 1.5px dashed currentColor; background: var(--news-bg, #fff); box-shadow: 0 0 0 3px var(--news-bg, #fff); }
.footer-lokal-next svg { display: block; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.footer-lokal-next .done { display: none; }

.footer-lokal-text { text-wrap: pretty; }  /* no max width: it uses its whole column */
/* Desktop: the sentence runs from the hand to the field and is always exactly two lines tall, cut with an ellipsis
   when it's longer. When the hand spreads, the sentence column narrows and the text rewraps inside those two lines,
   so nothing changes height and the field doesn't move. */
@media (min-width: 761px) {
  .footer-lokal-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
    height: 3em; line-height: 1.5; }
}
.footer-lokal-text b { color: var(--news-ink, inherit); font-weight: 600; }
.footer-news-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.footer-news-field { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line, color-mix(in srgb, currentColor 22%, transparent)); border-radius: 999px; padding: 3px 3px 3px 16px; transition: border-color .2s; }
.footer-news-field:focus-within { border-color: color-mix(in srgb, currentColor 55%, transparent); }
.footer-lokal input[type=email] { flex: 1; min-width: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--news-ink, inherit); font: inherit; padding: 6px 0; outline: none; box-shadow: none; -webkit-appearance: none; appearance: none; }
.footer-lokal input::placeholder { color: inherit; opacity: .6; }
.footer-lokal button { flex: none; margin: 0; border: 0; border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 600; line-height: 1.5; color: var(--news-bg, #fff); background: var(--news-ink, currentColor); cursor: pointer; transition: opacity .2s; box-shadow: none; }
.footer-lokal button:hover { opacity: .85; }
.footer-lokal button:disabled { cursor: default; }

/* The paper plane. The label and the plane share one grid cell, so the button keeps its size until the script folds
   it into a circle (it sets the width; the transition does the folding). The plane keeps the button's text colour in
   flight and has an outline in the site's text colour, so it reads on any footer; inside the button the outline
   matches the circle and doesn't show. */
.footer-lokal button { display: inline-grid; place-items: center; overflow: visible;
  transition: width .35s cubic-bezier(.3, 1.2, .5, 1), padding .35s ease, background-color .25s ease, opacity .2s; }
.footer-lokal button > * { grid-area: 1 / 1; }
.footer-lokal .plane { display: none; width: 20px; height: 20px; translate: -1px 1px; }
.footer-lokal .plane path { fill: currentColor; stroke: var(--news-ink, currentColor); stroke-width: 1.5; stroke-linejoin: round; paint-order: stroke; }
.footer-lokal.is-busy button, .footer-lokal.is-flying button { padding: 0; opacity: 1; }
.footer-lokal.is-busy .lbl, .footer-lokal.is-flying .lbl { display: none; }
.footer-lokal.is-busy .plane { display: block; animation: lokal-rock .9s ease-in-out infinite; }
.footer-lokal.is-flying .plane { display: block; position: relative; z-index: 2; }
.footer-lokal.is-flying button { background-color: transparent; }
@keyframes lokal-rock { 0%, 100% { rotate: -9deg; translate: -1px 2px; } 50% { rotate: 7deg; translate: -1px -1px; } }
@keyframes lokal-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.footer-lokal.is-sent .footer-news-done { animation: lokal-rise .45s ease-out both; }
/* The confetti: a layer over the whole page, the pieces animated by the script. */
.lokal-confetti { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; overflow: hidden; }
.lokal-confetti i { position: absolute; left: 0; top: 0; display: block; border-radius: 1.5px; }
@media (prefers-reduced-motion: reduce) { .footer-lokal.is-busy .plane { animation: none; } .footer-lokal button { transition: none; } }
.footer-lokal .hp { position: absolute; left: -9999px; }
.footer-lokal .footer-news-done { display: none; color: var(--news-ink, inherit); font-weight: 600; }
.footer-lokal .footer-news-error { display: none; grid-column: 3; margin-top: -6px; padding-left: 16px; font-size: 13px; }
.footer-lokal.is-error .footer-news-error { display: block; }
.footer-lokal.is-sent .footer-news-field, .footer-lokal.is-sent .footer-news-error { display: none; }
.footer-lokal.is-sent .footer-news-done { display: block; }
.footer-lokal.is-sent .footer-lokal-next { border-style: solid; border-color: var(--news-ink, currentColor); background: var(--news-ink, currentColor); color: var(--news-bg, #fff); }
.footer-lokal.is-sent .footer-lokal-next .plus { display: none; }
.footer-lokal.is-sent .footer-lokal-next .done { display: block; }

@media (max-width: 760px) {
  .footer-main { flex-wrap: nowrap; gap: 16px; }
  .footer-product { flex: 1; min-width: 0; }
  .footer-side { flex: none; }
  .footer-lokal { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 24px; }
  /* On a phone the hand is centred, a separator between the app and the Lokal line, and spreads out from the middle. */
  .footer-lokal-apps { justify-self: center; }
  .footer-lokal .footer-news-error { grid-column: auto; margin-top: -4px; }
}

/* This site's colours (set by its build). */
.footer-lokal { --news-ink: var(--fg); --news-bg: var(--bg); }
