/* ── Landningssidan på desktop (≥ 768 px): extremt enkel ──────────────────
   Logotypens intro (samma som mobilen, större) dansar mitt i heron och flyger
   upp till menyn. Sedan en lugn hero över bild 1 – rubrik, en rad och en knapp
   till ansökan – följt av ansökan och footern. Mobilen (≤ 767 px) påverkas inte. */
@media (min-width: 768px) {
  html:has(.public-home__hero) { scroll-snap-type: none !important; }

  /* Bara hero, ansökan och footer. */
  .ph-m-steps,
  .public-home__fit,
  #principer, #flodet, #for-foretaget, #offerten,
  .public-home__hero :is(.public-home__webgl, .public-home__hero-veil, .public-home__plan-stage, .public-home__eyebrow,
    .public-home__lead, .public-home__hero-metrics,
    .public-home__hero-secondary, .public-home__hero-mobile-secondary, h1 .public-home__hero-desktop) { display: none !important; }

  .public-home__hero {
    display: grid !important;
    min-height: 100svh !important;
    place-items: center;
    padding: 0 !important;
    background:
      radial-gradient(ellipse 46% 40% at 50% 50%, rgb(246 248 243 / 94%), rgb(246 248 243 / 60%) 62%, rgb(246 248 243 / 0%) 88%),
      url("../images/landingpage/zimla_desktop_1.6419b37babb8.webp") center / cover no-repeat,
      #eef2ea !important;
  }
  .public-home__hero .public-home__hero-grid { display: grid !important; min-height: 100svh !important; place-items: center; width: 100%; max-width: none; padding: 0 32px; }
  .public-home__hero .public-home__hero-copy,
  .public-home.is-plan-revealed .public-home__hero .public-home__hero-copy {
    display: grid !important;
    justify-items: center;
    width: 100% !important;
    max-width: 860px;
    padding: 0 !important;
    text-align: center;
    transform: none !important;
  }
  .public-home__hero h1 {
    max-width: none !important;
    margin: 0 !important;
    color: #17201b;
    font-family: Newsreader, ui-serif, Georgia, serif;
    font-size: clamp(3.6rem, 7vw, 6.6rem) !important;
    font-weight: 400;
    line-height: 0.98 !important;
    letter-spacing: -0.03em;
    text-align: center;
  }
  .public-home__hero .ph-m-hero-title { display: block !important; }
  .public-home__hero .ph-m-lead { display: block !important; max-width: 560px; margin: 26px auto 0 !important; color: #5f6d64; font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.55; text-align: center; }
  .public-home .public-home__hero .public-home__hero-actions { display: flex !important; justify-content: center !important; justify-self: center; width: 100%; max-width: none !important; margin-top: 36px !important; }
  .public-home .public-home__hero .public-home__hero-actions :is(.public-home__hero-secondary, .public-home__hero-mobile-secondary) { display: none !important; }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button:not(.public-home__button--ghost) {
    gap: 10px;
    min-height: 56px !important;
    padding: 0 30px !important;
    border-radius: 999px !important;
    background: #0f4a37 !important;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 16px 34px -16px rgb(15 74 55 / 75%) !important;
    color: #fff !important;
    font-size: 1.02rem !important;
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease;
  }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button:not(.public-home__button--ghost):hover { transform: translateY(-2px); }
  /* Menyns knapp till ansökan syns alltid på desktop (mobilen döljer den på första helsidan). */
  .public-home.is-first-slide .public-home__header .public-home__button--small { display: inline-flex !important; }
  .public-home__hero .public-home__button .public-home__hero-desktop { display: inline !important; }

  /* Introt: samma dans som på mobilen, större och mitt i heron. JS krymper den till menyns logga under flygningen. */
  /* Bara så bred som loggan (JS skalar efter bredden) – centrerad med auto-marginaler. */
  .public-home__hero-intro:not(.is-flying):not(.is-done) { position: absolute !important; top: 44% !important; right: 0 !important; left: 0 !important; width: max-content !important; margin-inline: auto !important; }
  .public-home__hero-intro { gap: 1.1rem !important; }
  .public-home__hero-intro .public-home__brand-mark { grid-template-columns: repeat(2, 1.15rem) !important; gap: 0.32rem !important; }
  .public-home__hero-intro .public-home__brand-mark span { width: 1.15rem !important; height: 1.15rem !important; }
  .public-home__hero-intro-word { font-size: 3.1rem !important; }
  .public-home__hero-intro.is-flying { gap: 1.1rem !important; }

  /* Ansökan direkt under heron: hela sektionen mörkgrön med en kornig yta, sedan footern. */
  .public-home .public-home__beta-section {
    min-height: 0 !important;
    padding: clamp(5.5rem, 10vw, 8.5rem) 0 !important;
    background:
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .11 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
      radial-gradient(ellipse 60% 70% at 85% 10%, rgb(47 143 108 / 30%), transparent 60%),
      radial-gradient(ellipse 50% 60% at 10% 95%, rgb(7 131 92 / 25%), transparent 55%),
      #0f3a2c !important;
    background-size: 240px 240px, auto, auto, auto !important;
    background-position: 0 0, center, center, center !important;
    background-repeat: repeat, no-repeat, no-repeat, no-repeat !important;
  }
  .public-home .public-home__beta-section::before,
  .public-home .public-home__beta-section::after { display: none !important; }
  .public-home .public-home__beta-section > .public-home__container { width: min(1180px, calc(100% - 64px)) !important; max-width: none !important; margin-inline: auto !important; padding: 0 !important; }
  .public-home .public-home__beta-section .public-home__beta-panel { padding: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; backdrop-filter: none !important; }
  .public-home .public-home__beta-section .public-home__beta-panel::before,
  .public-home .public-home__beta-section .public-home__beta-panel::after { display: none !important; }
}

/* Heron: ett lätt, levande korn över bilden (som filmkorn). Fyra frön av samma brus ligger
   bredvid varandra i EN bild (ritas upp en gång – inga blinkningar när sidan laddas); ett steg på
   180 px byter mönster på plats, cirka sex gånger per sekund. Står still vid minskad rörelse. */
@media (min-width: 768px) {
  .public-home .public-home__hero { overflow: hidden; isolation: isolate; }
  .public-home .public-home__hero::after {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    display: block !important;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='720' height='180'><filter id='g1' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' seed='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .08 0 0 0 0 .12 0 0 0 0 .1 0 0 0 1.6 -.55'/></filter><filter id='g2' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' seed='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .08 0 0 0 0 .12 0 0 0 0 .1 0 0 0 1.6 -.55'/></filter><filter id='g3' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .08 0 0 0 0 .12 0 0 0 0 .1 0 0 0 1.6 -.55'/></filter><filter id='g4' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .08 0 0 0 0 .12 0 0 0 0 .1 0 0 0 1.6 -.55'/></filter><rect x='0' width='180' height='180' filter='url(%23g1)'/><rect x='180' width='180' height='180' filter='url(%23g2)'/><rect x='360' width='180' height='180' filter='url(%23g3)'/><rect x='540' width='180' height='180' filter='url(%23g4)'/></svg>");
    background-size: 720px 180px;
    opacity: .3;
    mix-blend-mode: multiply;
    animation: phd-grain .64s step-end infinite;
  }
  .public-home .public-home__hero .public-home__hero-grid { position: relative; z-index: 1; }
}
@keyframes phd-grain {
  0%, 100% { background-position: 0 0; }
  25% { background-position: -180px 0; }
  50% { background-position: -360px 0; }
  75% { background-position: -540px 0; }
}
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  .public-home .public-home__hero::after { animation: none; }
}

/* Centrerat hela vägen ned till mobilen: surfplattans äldre regler lade heron och ansökan till vänster. */
@media (min-width: 768px) {
  /* En kolumn: surfplattans regler (861–1366 px) gav heron två kolumner, och den dolda planritningen tog högerhalvan. */
  .public-home .public-home__hero .public-home__hero-grid { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto !important; place-items: center !important; justify-content: center !important; align-items: center !important; }
  .public-home .public-home__hero .public-home__hero-grid > * { grid-column: 1 / -1 !important; grid-row: 1 !important; }
  .public-home .public-home__hero .public-home__hero-copy,
  .public-home.is-plan-revealed .public-home__hero .public-home__hero-copy { justify-self: center !important; align-self: center !important; margin-inline: auto !important; justify-items: center !important; text-align: center !important; }
  .public-home .public-home__hero h1, .public-home .public-home__hero .ph-m-hero-title { margin-inline: auto !important; text-align: center !important; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .public-home .public-home__beta-section .public-home__beta-panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: center;
    gap: 2.5rem !important;
    max-width: 620px;
    margin-inline: auto !important;
    text-align: center;
  }
  .public-home .public-home__beta-section .public-home__beta-copy { display: grid; justify-items: center; }
  .public-home .public-home__beta-section .public-home__beta-copy p { margin-inline: auto; }
  .public-home .public-home__beta-section .public-home__eyebrow { justify-content: center; }
  .public-home .public-home__beta-section .public-home__notify-form { width: 100%; max-width: 480px; margin-inline: auto !important; padding-top: 0 !important; border-top: 0 !important; text-align: left; }
}

/* Övergången hero → ansökan: halvtonsprickar (masken ritas i public-home.js). Ansökan dras upp
   bandets höjd över heron; masken släpper igenom heron mellan prickarna. */
.phd-wave-accent { display: none; }
@media (min-width: 768px) {
  .public-home .public-home__beta-section.has-wave {
    position: relative;
    z-index: 2;
    margin-top: calc(-1 * var(--phd-wave-h, 290px)) !important;
    padding-top: calc(clamp(5.5rem, 10vw, 8.5rem) + var(--phd-wave-h, 290px)) !important;
    -webkit-mask:
      var(--phd-wave) left top / 100% var(--phd-wave-h, 290px) no-repeat,
      linear-gradient(#000 0 0) left var(--phd-wave-h, 290px) / 100% calc(100% - var(--phd-wave-h, 290px)) no-repeat;
    mask:
      var(--phd-wave) left top / 100% var(--phd-wave-h, 290px) no-repeat,
      linear-gradient(#000 0 0) left var(--phd-wave-h, 290px) / 100% calc(100% - var(--phd-wave-h, 290px)) no-repeat;
  }
  .public-home__beta-section.has-wave .phd-wave-accent {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    display: block;
    height: var(--phd-wave-h, 290px);
    background: no-repeat left top / 100% var(--phd-wave-h, 290px);
    pointer-events: none;
  }
}

/* "Ansök till betan"-knapparna (menyn, heron, formuläret): Zimlas gröna #02854f på alla bredder. */
.public-home .public-home__header .public-home__button--small,
.public-home .public-home__hero .public-home__hero-actions .public-home__button:not(.public-home__button--ghost),
.public-home .public-home__notify-control button {
  border-color: #02854f !important;
  background: #02854f !important;
  color: #fff !important;
}
.public-home .public-home__notify-control button * { color: inherit !important; }
.public-home .public-home__hero .public-home__hero-actions .public-home__button:not(.public-home__button--ghost) {
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 16px 34px -16px rgb(2 138 81 / 70%) !important;
}
.public-home .public-home__header .public-home__button--small:hover,
.public-home .public-home__hero .public-home__hero-actions .public-home__button:not(.public-home__button--ghost):hover,
.public-home .public-home__notify-control button:hover {
  border-color: #027a47 !important;
  background: #027a47 !important;
}

/* Menyn: "Logga in" och "Ansök till betan" tonas mjukt in när loggan landat (inte medan den dansar).
   Landar introt aldrig kommer de ändå efter 3,5 s. */
.public-home .public-home__header .public-home__nav-actions {
  transition: opacity 700ms cubic-bezier(.22, 1, .36, 1) 120ms, transform 700ms cubic-bezier(.22, 1, .36, 1) 120ms;
}
.public-home.is-awaiting-logo .public-home__header .public-home__nav-actions {
  opacity: 0;
  transform: translateY(-4px);
  animation: phd-nav-failsafe 1ms linear 3.5s forwards;
}
@keyframes phd-nav-failsafe { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .public-home .public-home__header .public-home__nav-actions { transition: none; }
}

/* 1100–1366 px: surfplattans regler gjorde ansökan till ett vänsterställt block (texten och ett
   smalt formulär till vänster, tomt till höger). Samma två kolumner som på bredare skärmar. */
@media (min-width: 1100px) and (max-width: 1366px) {
  .public-home .public-home__beta-section .public-home__beta-panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: center;
    gap: clamp(3rem, 6vw, 5.5rem) !important;
    max-width: 1080px;
    margin-inline: auto !important;
  }
  .public-home .public-home__beta-section .public-home__notify-form {
    justify-self: end;
    width: 100%;
    max-width: 30rem !important;
    padding-top: 0 !important;
    border-top: 0 !important;
  }
}
/* Sidfoten låg 24 px från kanten mellan 900 och 1366 px – samma bredd som ansökan ovanför. */
@media (min-width: 900px) and (max-width: 1366px) {
  .public-home .public-home__footer > .public-home__container { width: min(1080px, calc(100% - 64px)) !important; max-width: none !important; margin-inline: auto !important; }
}

/* Heroknappen som ett rum på planritningen. Väggarna ritas upp när loggan landat;
   vid hover spårar pennan väggarna, dörren slår upp och måttet säger "Öppen".
   Bara desktop – mobilens knapp har ingen ritning. */
.ph-plan { display: none; }
@media (min-width: 768px) {
  .public-home .public-home__hero .public-home__hero-actions .public-home__button.ph-plan-btn {
    --plan-ink: #0f4a37;
    --plan-grid: rgb(15 74 55 / 4%);
    position: relative;
    isolation: isolate;
    overflow: visible;
    flex: none !important;
    width: 232px !important;
    height: 58px !important;
    min-height: 58px !important;
    padding: 0 !important;
    gap: 12px;
    border: 0 !important;
    border-radius: 0 !important;
    background:
      linear-gradient(var(--plan-grid) 1px, transparent 1px) 0 0 / 100% 8px,
      linear-gradient(90deg, var(--plan-grid) 1px, transparent 1px) 0 0 / 8px 100%,
      rgb(248 249 244 / 84%) !important;
    box-shadow: none !important;
    color: var(--plan-ink) !important;
    font-weight: 500;
    letter-spacing: 0.01em;
    transform: none !important;
    transition: color 260ms ease;
  }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button.ph-plan-btn:hover {
    --plan-grid: rgb(15 74 55 / 10%);
    background:
      linear-gradient(var(--plan-grid) 1px, transparent 1px) 0 0 / 100% 8px,
      linear-gradient(90deg, var(--plan-grid) 1px, transparent 1px) 0 0 / 8px 100%,
      rgb(250 251 247 / 94%) !important;
    color: #0a3a2b !important;
  }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button.ph-plan-btn:focus-visible { outline: 2px solid var(--plan-ink); outline-offset: 10px; }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button.ph-plan-btn .material-symbols-outlined { color: inherit !important; transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1); }
  .public-home .public-home__hero .public-home__hero-actions .public-home__button.ph-plan-btn:hover .material-symbols-outlined { transform: translateX(4px); }

  /* Knappen sitter i (24, 30) i ritningens 280 × 122. */
  .ph-plan { position: absolute; top: -30px; left: -24px; z-index: -1; display: block; width: 280px; height: 122px; overflow: visible; pointer-events: none; fill: none; stroke: var(--plan-ink); stroke-linecap: square; }
  .ph-plan__guides { stroke-width: 1; opacity: 0.16; transition: opacity 300ms ease; }
  .ph-plan__dim { opacity: 0.3; transform: scaleX(0.9); transform-origin: 140px 12px; transition: opacity 300ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1); }
  .ph-plan__dim path { stroke-width: 1; }
  .ph-plan__dim rect { fill: #f3f4ef; stroke: none; }
  .ph-plan__label { fill: var(--plan-ink); stroke: none; font: 500 9.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.16em; text-anchor: middle; text-transform: uppercase; transition: opacity 220ms ease; }
  .ph-plan__label.is-open { opacity: 0; }
  .ph-plan__wall { stroke-width: 2; stroke-dasharray: 100; stroke-dashoffset: 0; opacity: 0.45; transition: stroke-dashoffset 1100ms cubic-bezier(0.65, 0, 0.35, 1) 150ms; }
  .ph-plan__wall.is-ink { stroke-width: 2.4; opacity: 1; stroke-dashoffset: 100; transition: stroke-dashoffset 700ms cubic-bezier(0.65, 0, 0.35, 1); }
  .ph-plan__leaf { stroke-width: 1.5; opacity: 0.55; transform-box: view-box; transform-origin: 46px 88px; transition: transform 520ms cubic-bezier(0.34, 1.4, 0.64, 1), opacity 260ms ease; }
  .ph-plan__arc { stroke-width: 1; stroke-dasharray: 2.5 3; opacity: 0; transition: opacity 260ms ease 140ms; }

  /* Tills loggan landat står rummet oritat; en reserv ritar det ändå efter 3,5 s. */
  .public-home.is-awaiting-logo .ph-plan__wall:not(.is-ink) { stroke-dashoffset: 100; animation: ph-plan-draw 1100ms cubic-bezier(0.65, 0, 0.35, 1) 3500ms forwards; }
  .public-home.is-awaiting-logo :is(.ph-plan__guides, .ph-plan__dim, .ph-plan__leaf) { opacity: 0; }

  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__guides { opacity: 0.5; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__dim { opacity: 0.9; transform: none; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__label { opacity: 0; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__label.is-open { opacity: 1; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__wall.is-ink { stroke-dashoffset: 0; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__leaf { transform: rotate(90deg); opacity: 1; }
  .ph-plan-btn:is(:hover, :focus-visible) .ph-plan__arc { opacity: 0.8; }
}
@keyframes ph-plan-draw { to { stroke-dashoffset: 0; } }
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  .ph-plan *, .ph-plan-btn .material-symbols-outlined { transition: none !important; animation: none !important; }
  .public-home.is-awaiting-logo .ph-plan__wall:not(.is-ink) { stroke-dashoffset: 0; }
}
