/*
 * Skyle Firmware Update landing page.
 * Brand tokens shared with the Skyle app and the eyeV downloads site: dark teal, off-white,
 * pink accent. Fonts are the eyeV web fonts, served from the eyev.de asset host.
 *
 * Background: a lava lamp simulated in assets/lava.js on the fixed #lava canvas. The upper
 * band (.sky) shows the page background, the lower band (.pool) is filled with wax; its flat
 * CSS background doubles as the no-script fallback and the canvas draws the moving surface
 * and bubbles above it. #lava-ink sits above the page and repaints, in the accent color,
 * the parts of the heading and the instructions that lie behind wax, and the parts of the
 * form controls that a trough leaves on the sky.
 */

@font-face {
  font-family: "Open Sauce One";
  src: url("https://cdn.prod.website-files.com/667957d891552da569d89030/668c905d88510c453fb212c9_OpenSauceOne-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Open Sauce One";
  src: url("https://cdn.prod.website-files.com/667957d891552da569d89030/668c905d0d53875ac917f51d_OpenSauceOne-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Open Sauce Sans";
  src: url("https://cdn.prod.website-files.com/667957d891552da569d89030/668c90a046c19a92395b905a_OpenSauceSans-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Open Sauce Sans";
  src: url("https://cdn.prod.website-files.com/667957d891552da569d89030/668c90a0582347ea8d91a64d_OpenSauceSans-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --teal-dark: #012D35;
  --pink: #AD1457;
  --mint-tint: rgba(172, 224, 212, 0.14);
  --mint-line: rgba(172, 224, 212, 0.28);
  --mint-fill: rgba(172, 224, 212, 0.32);
  --white: #FFFFFF;
  --white-soft: rgba(255, 255, 255, 0.82);
  --white-faint: rgba(255, 255, 255, 0.55);
  --ink-soft: rgba(1, 45, 53, 0.78);
  --sky: #F4FAF8;
  --font-display: "Open Sauce One", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Open Sauce Sans", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --control-height: 56px;
  --control-border: 2px;
  --form-width: 340px;
  --radius: 4px;
  --ease: 180ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sky);
  color: var(--teal-dark);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--pink);
  color: var(--white);
}

/* Page: two stacked bands. Extra height is shared, so the wax stays about half full. */
#lava,
#lava-ink {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#lava-ink {
  z-index: 2;
}

/* With the script running, the canvas draws all of the wax; the flat band is for no-script */
.has-lava .pool {
  background: transparent;
}

#intro {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
}

.sky,
.pool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sky {
  z-index: 2;
  flex: 1 1 50%;
  padding: clamp(20px, 3.5vh, 48px) 20px clamp(26px, 3.5vh, 36px);
}

/* The form hugs the wave; spare height in the band goes between it and the footer */
.pool {
  z-index: 1;
  flex: 1 1 50%;
  justify-content: flex-start;
  padding: clamp(12px, 1.6vh, 16px) 20px 16px;
  background: var(--teal-dark);
  color: var(--white);
}

/* Hero: device render, eye mark, title, instructions (upper band, dark on off-white).
   A press-and-drag on this band plays with the wax, so it must not select or drag anything */
.hero,
.lead {
  -webkit-user-select: none;
  user-select: none;
}

.hero img {
  -webkit-user-drag: none;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.hero-device {
  width: 40%;
  max-width: 600px;
  min-width: 240px;
}

.hero-logo {
  width: clamp(56px, 7vw, 100px);
  margin-top: clamp(14px, 1.8vw, 26px);
}

h1 {
  margin: clamp(10px, 1.6vw, 20px) 0 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 72px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--teal-dark);
  transition: color 250ms ease;
}

/* The title lights up in the accent when the pointer rests on it; bubbles recolor it per glyph */
h1:hover {
  color: var(--pink);
}

h1::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  margin: clamp(18px, 2.4vw, 30px) auto 0;
  background: var(--teal-dark);
}

.lead {
  max-width: 44em;
  margin: clamp(20px, 2.4vw, 30px) 0 0;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.45;
  color: var(--ink-soft);
}

.lead label {
  cursor: pointer;
}

/* Form (lower band, white on wax) */
.update-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.input-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: var(--form-width);
}

/* Shared outlined control style for the serial field and the button */
.btn,
input[type="text"] {
  height: var(--control-height);
  padding: 0 22px;
  border: var(--control-border) solid var(--white);
  border-radius: var(--radius);
  background: transparent;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--ease), border-color var(--ease), background-color var(--ease);
}

input[type="text"] {
  flex: 1 1 300px;
  min-width: 0;
  text-align: center;
}

input[type="text"]::placeholder {
  color: var(--white-faint);
  opacity: 1;
}

/* Channel switch above the serial field: the segmented pill from downloads.eyev.de, translucent
   mint on the wax. The radios themselves are visually hidden; their labels are the two segments. */
.channel-toggle {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: var(--form-width);
  height: var(--control-height);
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--mint-line);
  border-radius: 999px;
  background: var(--mint-tint);
}

.channel-toggle input {
  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;
}

.channel-toggle label {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--ease), background-color var(--ease);
}

.channel-toggle label:hover {
  color: var(--white);
}

.channel-toggle input:checked + label {
  background: var(--mint-fill);
  color: var(--white);
}

.btn {
  flex-shrink: 0;
  width: 100%;
  max-width: var(--form-width);
  margin-top: clamp(22px, 2.4vw, 30px);
  cursor: pointer;
}

/* Firmware the selected channel currently delivers, appended to the button label */
.btn .fwversion {
  text-transform: none;
  white-space: nowrap;
}

.btn:hover,
input[type="text"]:hover {
  color: var(--pink);
  border-color: var(--pink);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
input[type="text"]:focus-visible,
.channel-toggle input:focus-visible + label,
.eula:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 3px;
}

/* Footer */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
  padding-top: clamp(24px, 3vh, 36px);
}

.eula {
  display: inline-block;
  padding: 13px 24px;
  border-radius: var(--radius);
  background: var(--pink);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity var(--ease);
}

.eula:hover,
.eula:active {
  opacity: 0.8;
}

.site-footer small {
  display: block;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--white-faint);
}

.site-footer .copyright {
  margin-top: 14px;
}

.site-footer .version {
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Narrow screens: bigger device render, stacked full-width controls, only the edge bubbles */
@media only screen and (max-width: 600px) {
  .sky,
  .pool {
    padding-left: 16px;
    padding-right: 16px;
  }
  .hero-device {
    width: 70%;
    min-width: 0;
  }
  .lead br {
    display: none;
  }
  input[type="text"] {
    flex-basis: 100%;
    width: 100%;
  }
}

/* Short desktop viewports (e.g. 1366x768 laptops): tighter hero so the form stays above the fold */
@media only screen and (min-width: 601px) and (max-height: 820px) {
  .sky {
    padding-top: 16px;
    padding-bottom: 30px;
  }
  .pool {
    padding-top: 12px;
    padding-bottom: 16px;
  }
  .hero-device {
    width: 30%;
  }
  .hero-logo {
    width: 68px;
    margin-top: 12px;
  }
  h1 {
    margin-top: 10px;
    font-size: clamp(32px, 4.4vw, 60px);
  }
  h1::after {
    margin-top: 14px;
  }
  .lead {
    margin-top: 14px;
  }
  .btn {
    margin-top: 18px;
  }
  .site-footer {
    padding-top: 18px;
  }
  .site-footer .copyright {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
