/* Bevægelse for frahende.dk.
   Idé: logoets stykke forlader skiven. Det samme greb bærer headeren (stykket glider ud ved første besøg),
   footeren (ordmærket stiger op af kanten) og kortstakken (kortene spredes, når man ruller forbi).
   Alt indhold er synligt uden JavaScript; html.js + .is-in styrer kun ind-animationerne. */

:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-in: cubic-bezier(.7, 0, .84, 0); }

/* ===== Header ===== */
.site-header { transition: transform .35s var(--ease-out), background-color .3s var(--ease), box-shadow .3s var(--ease); }
.site-header-inner { transition: min-height .3s var(--ease-out); }
.site-header .logo-lockup { transition: height .3s var(--ease-out); }
.site-header.is-scrolled { background: color-mix(in srgb, var(--c-bg) 90%, transparent); box-shadow: 0 1px 0 var(--c-border), 0 12px 28px -22px rgba(23,18,26,.45); border-bottom-color: transparent; }
.site-header.is-scrolled .site-header-inner { min-height: 54px; }
.site-header.is-scrolled .logo-lockup { height: 28px; }
.site-header.is-hidden { transform: translateY(-100%); transition-duration: .25s; transition-timing-function: var(--ease-in); }

/* Læselinje: hvor langt man er på siden, i logoets gradient */
.header-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--g-signature); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; transition: opacity .3s var(--ease); pointer-events: none; }
.site-header.is-scrolled .header-progress { opacity: 1; }
@supports (animation-timeline: scroll()) {
  .header-progress { animation: header-progress linear both; animation-timeline: scroll(root); }
  @keyframes header-progress { to { transform: scaleX(1); } }
}

/* Navigationslinks: understregning tegnes fra venstre i gradienten */
.site-nav .nav-guides { position: relative; }
.site-nav .nav-guides::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 4px; height: 2px; border-radius: 2px; background: var(--g-signature); transform: scaleX(0); transform-origin: 0 50%; transition: transform .3s var(--ease-out); }
.site-nav .nav-guides:hover::after, .site-nav .nav-guides:focus-visible::after { transform: scaleX(1); }

/* Logoet: stykket glider ud af biden ved første besøg i sessionen, og et stykke længere ved hover */
.logo-lockup path[fill="#B23BBE"] { transform-box: fill-box; transform-origin: center; transition: transform .45s var(--ease-out); }
.site-logo:hover .logo-lockup path[fill="#B23BBE"], .site-logo:focus-visible .logo-lockup path[fill="#B23BBE"] { transform: translate(12%, -12%); }
html.logo-intro .site-header .logo-lockup path[fill="#B23BBE"] { animation: piece-out .9s var(--ease-out) .15s both; }
html.logo-intro .site-header .logo-lockup path[fill^="url"] { animation: disc-settle .9s var(--ease-out) .15s both; }
@keyframes piece-out { from { transform: translate(-62%, 62%) scale(.55); opacity: 0; } 35% { opacity: 1; } to { transform: none; } }
@keyframes disc-settle { from { transform: scale(.96); } 40% { transform: scale(1.015); } to { transform: none; } }
html.logo-intro .site-header .logo-lockup path[fill^="url"] { transform-box: fill-box; transform-origin: 30% 70%; }

/* ===== Footer ===== */
.site-footer { overflow: hidden; padding-bottom: 0; }
.footer-lead { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-5); padding-bottom: var(--sp-7); margin-bottom: var(--sp-7); border-bottom: 1px solid var(--c-border); }
.footer-statement { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(2.2rem, 5.4vw, 4.4rem); line-height: 1; letter-spacing: -.035em; color: var(--c-text); }
.footer-statement .script { font-weight: 400; letter-spacing: 0; font-size: 1.05em; line-height: .9; }
.footer-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Kæmpe-ordmærket: stiger op af footerens underkant; gradienten flyder, mens man ruller */
.footer-word { position: relative; z-index: 1; margin: var(--sp-7) auto 0; width: min(100% - 2 * var(--sp-4), 1320px); aspect-ratio: 4130 / 769; overflow: visible; clip-path: inset(-40% -6% 0 -6%); /* kun bunden skæres (ordet stiger op af kanten); stykket må stikke ud foroven */ }
.footer-word-ink { position: absolute; inset: 0 0 -18% 0; background: linear-gradient(100deg, #FF7A59, #F2427A 30%, #B23BBE 55%, #F2427A 78%, #FF7A59); background-size: 220% 100%; background-position: 0% 0; -webkit-mask: url(/assets/brand/wordmark.svg) top center / 100% auto no-repeat; mask: url(/assets/brand/wordmark.svg) top center / 100% auto no-repeat; }
.footer-word-dot { position: absolute; width: 3.6%; aspect-ratio: 1; border-radius: 50%; background: #B23BBE; right: -1.4%; top: -6%; }
html.motion .footer-word .footer-word-ink { transform: translateY(38%); transition: transform 1.1s var(--ease-out); }
html.motion .footer-word .footer-word-dot { transform: translate(-260%, 260%) scale(.3); opacity: 0; transition: transform 1s var(--ease-out) .35s, opacity .4s var(--ease) .35s; }
html.motion .footer-word.is-in .footer-word-ink { transform: none; }
html.motion .footer-word.is-in .footer-word-dot { transform: none; opacity: 1; }
@supports (animation-timeline: view()) {
  .footer-word-ink { animation: word-flow linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
  @keyframes word-flow { to { background-position: 100% 0; } }
}

/* ===== Ind-animationer ved scroll ===== */
html.motion [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--d, 0ms); }
html.motion [data-reveal].is-in { opacity: 1; transform: none; }
/* Overskrifter tørres op bag en maske i stedet for at fade */
html.motion [data-reveal-title] { clip-path: inset(0 0 100% 0); transform: translateY(.35em); transition: clip-path .8s var(--ease-out), transform .8s var(--ease-out); }
html.motion [data-reveal-title].is-in { clip-path: inset(0 0 -10% 0); transform: none; }
/* Lister ankommer som lister: kort med kort forsinkelse, højst seks trin */
html.motion [data-stagger] > * { opacity: 0; transform: translateY(28px) scale(.98); transition: opacity .6s var(--ease-out), transform .7s var(--ease-out); transition-delay: calc(min(var(--i, 0), 6) * 60ms); }
html.motion [data-stagger].is-in > * { opacity: 1; transform: none; }

/* Forsidens kortstak: kortene deles ved første visning og spredes, når man ruller forbi */
@media (min-width: 960px) {
  html.js .hero2-card { animation: card-deal .9s var(--ease-out) both; }
  html.js .hero2-card-1 { animation-delay: .2s; }
  html.js .hero2-card-2 { animation-delay: .1s; }
  html.js .hero2-card-3 { animation-delay: .3s; }
  @keyframes card-deal { from { translate: 0 40px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
  @supports (animation-timeline: scroll()) {
    .hero2-stack .hero2-card > .ad-card { animation: var(--fan) linear both; animation-timeline: scroll(root); animation-range: 0 70vh; }
    .hero2-card-1 { --fan: fan-left; }
    .hero2-card-2 { --fan: fan-mid; }
    .hero2-card-3 { --fan: fan-right; }
    @keyframes fan-left { to { transform: translate(-46px, 26px) rotate(-7deg); } }
    @keyframes fan-mid { to { transform: translate(0, -34px); } }
    @keyframes fan-right { to { transform: translate(52px, 40px) rotate(8deg); } }
  }
}

/* Smalle skærme: logoet er bredere end det gamle ordmærke */
.site-nav .icon-btn { flex-shrink: 0; }
.cta-short { display: none; }
@media (max-width: 520px) {
  .site-header .logo-lockup, .site-header.is-scrolled .logo-lockup { height: 24px; }
  .header-cta .cta-long { display: none; }
  .header-cta .cta-short { display: inline; }
  .header-cta .btn-primary { padding-inline: var(--sp-4); }
}
@media (max-width: 400px) { .site-nav .theme-toggle, .site-nav .site-search-link { display: none; } }


/* ===== Efter købet: belønningen ===== */
/* Kvitteringen: billederne deles ud, seglet trykkes på, trinene fyldes ud */
html.js .receipt-hero.is-paid .receipt-shot { animation: shot-in .9s var(--ease-out) both; }
html.js .receipt-hero.is-paid .receipt-shot-1 { animation-delay: .25s; }
html.js .receipt-hero.is-paid .receipt-shot-2 { animation-delay: .1s; }
html.js .receipt-hero.is-paid .receipt-shot-3 { animation-delay: .4s; }
@keyframes shot-in { from { translate: 0 60px; scale: .9; opacity: 0; } to { translate: 0 0; scale: 1; opacity: 1; } }
html.js .receipt-hero.is-paid .receipt-seal { animation: seal-in .7s cubic-bezier(.34, 1.56, .64, 1) .85s both; }
@keyframes seal-in { from { scale: 0; rotate: -30deg; } to { scale: 1; rotate: 0deg; } }
html.js .receipt-hero.is-paid .receipt-kicker, html.js .receipt-hero.is-paid h1, html.js .receipt-hero.is-paid .lead, html.js .receipt-hero.is-paid .cluster { animation: rise .8s var(--ease-out) both; }
html.js .receipt-hero.is-paid h1 { animation-delay: .08s; }
html.js .receipt-hero.is-paid .lead { animation-delay: .16s; }
html.js .receipt-hero.is-paid .cluster { animation-delay: .24s; }
@keyframes rise { from { translate: 0 18px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
html.js .receipt-steps li { animation: rise .6s var(--ease-out) both; }
html.js .receipt-steps li:nth-child(1) { animation-delay: 1s; } html.js .receipt-steps li:nth-child(2) { animation-delay: 1.1s; }
html.js .receipt-steps li:nth-child(3) { animation-delay: 1.2s; } html.js .receipt-steps li:nth-child(4) { animation-delay: 1.3s; }
.receipt-steps .is-now .step-dot { animation: step-pulse 2.4s ease-in-out 2s infinite; }
@keyframes step-pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c-primary) 6%, transparent); } }

/* Velkomsten: ringen tændes, fordelene krydses af, og opslagene låses op ét for ét */
html.js .welcome .welcome-ring { animation: ring-on 1s var(--ease-out) both; }
@keyframes ring-on { from { scale: .6; opacity: 0; filter: saturate(0); } 60% { scale: 1.06; } to { scale: 1; opacity: 1; filter: none; } }
html.js .welcome .welcome-plan, html.js .welcome h1, html.js .welcome .lead { animation: rise .8s var(--ease-out) both; }
html.js .welcome .welcome-plan { animation-delay: .3s; } html.js .welcome h1 { animation-delay: .15s; } html.js .welcome .lead { animation-delay: .25s; }
html.js .welcome-perks li { animation: rise .5s var(--ease-out) both; animation-delay: calc(.6s + var(--i) * .12s); }
html.js .welcome-perks li .icon { animation: tick .45s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(.75s + var(--i) * .12s); }
@keyframes tick { from { scale: 0; } to { scale: 1; } }
html.js .welcome-wall .unlock-tile:not(.is-locked) img, html.js .welcome-wall .unlock-tile:not(.is-locked) .unlock-text { animation: unblur 1s var(--ease-out) both; animation-delay: calc(.9s + var(--i) * .18s); }
@keyframes unblur { from { filter: blur(18px) saturate(.6); scale: 1.08; } to { filter: none; scale: 1; } }
html.js .welcome-wall .unlock-tile:not(.is-locked) .unlock-icon { animation: unlock .9s var(--ease-out) both; animation-delay: calc(.6s + var(--i) * .18s); }
@keyframes unlock { 0% { opacity: 1; scale: 1; } 45% { opacity: 1; scale: 1.15; } 100% { opacity: 0; scale: .6; translate: 0 -10px; } }
html.js .welcome-wall .unlock-tile { animation: rise .7s var(--ease-out) both; animation-delay: calc(.3s + var(--i) * .1s); }
.unlock-tile img { transition: scale .5s var(--ease-out); }
.unlock-tile:hover img { scale: 1.04; }

/* Konfetti fra logoets skive og stykke (tegnes af site.js, kun første gang) */
.celebrate-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 95; }

/* Lagt i kurven */
.cart-toast { animation: toast-in .45s var(--ease-out) both; }
.cart-toast.is-leaving { animation: toast-out .25s var(--ease-in) both; }
@keyframes toast-in { from { translate: 0 -12px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes toast-out { to { translate: 0 -8px; opacity: 0; } }

/* ===== Mindre bevægelse ===== */
@media (prefers-reduced-motion: reduce) {
  .site-header, .site-header.is-hidden { transform: none !important; transition: background-color .2s, box-shadow .2s; }
  .header-progress { animation: none; display: none; }
  html.logo-intro .site-header .logo-lockup path { animation: none; }
  .logo-lockup path[fill="#B23BBE"] { transition: none; }
  .site-logo:hover .logo-lockup path[fill="#B23BBE"] { transform: none; }
  html.motion [data-reveal], html.motion [data-stagger] > * { transform: none; transition: opacity .3s ease; transition-delay: 0ms; }
  html.motion [data-reveal-title] { clip-path: none; transform: none; opacity: 0; transition: opacity .3s ease; }
  html.motion [data-reveal-title].is-in { opacity: 1; }
  html.motion .footer-word .footer-word-ink, html.motion .footer-word .footer-word-dot { transform: none; transition: opacity .3s ease; }
  .footer-word-ink { animation: none; }
  html.js .hero2-card { animation: none; }
  .hero2-stack .hero2-card > .ad-card { animation: none; }
  html.js .receipt-hero .receipt-shot, html.js .receipt-hero .receipt-seal, html.js .receipt-hero *, html.js .receipt-steps li, .receipt-steps .is-now .step-dot,
  html.js .welcome *, html.js .welcome-wall .unlock-tile, html.js .welcome-wall .unlock-tile * { animation: none !important; }
  html.js .welcome-wall .unlock-tile:not(.is-locked) .unlock-icon { opacity: 0; }
  .celebrate-canvas { display: none; }
  .cart-toast, .cart-toast.is-leaving { animation: none; }
  .cart-count.is-bumped { animation: none; }
}

/* ===== Header: tema og kurv ===== */
/* Lys/mørk: månen vises i lyst tema (skift til mørkt), solen i mørkt */
.theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .theme-moon { display: none; }
}
.theme-toggle .icon { transition: rotate .5s var(--ease-out), scale .3s var(--ease-out); }
.theme-toggle:hover .icon { rotate: -18deg; scale: 1.08; }

/* Kurven: posen med tal for antal varer. Ved hover falder et lille stykke (logoets) ned i posen */
.cart-link { position: relative; overflow: visible; }
.cart-link .cart-bag { position: relative; z-index: 1; }
.cart-link::before { content: ""; position: absolute; left: 50%; top: 4px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--g-signature-ink); opacity: 0; z-index: 2; pointer-events: none; }
.cart-link:hover::before, .cart-link:focus-visible::before { animation: drop-in .6s cubic-bezier(.5, 0, .75, 0) both; }
.cart-link:hover .cart-bag, .cart-link:focus-visible .cart-bag { animation: bag-catch .6s var(--ease-out) .42s both; }
@keyframes drop-in { 0% { translate: 0 -14px; opacity: 0; } 25% { opacity: 1; } 80% { translate: 0 10px; opacity: 1; } 100% { translate: 0 13px; opacity: 0; } }
@keyframes bag-catch { 0% { translate: 0 0; } 35% { translate: 0 3px; scale: 1.06 .94; } 70% { translate: 0 -1px; } 100% { translate: 0 0; scale: 1; } }
.cart-link.is-catching .cart-bag { animation: bag-catch .6s var(--ease-out) both; }
.cart-count { position: absolute; top: -5px; right: -5px; z-index: 3; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: var(--g-signature-ink); color: #fff; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; box-shadow: 0 0 0 2px var(--c-bg); }
.cart-count.is-empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .cart-link:hover::before, .cart-link:focus-visible::before, .cart-link:hover .cart-bag, .cart-link.is-catching .cart-bag, .theme-toggle:hover .icon { animation: none; rotate: none; scale: none; }
}
