/*
 * Landing page (index.html) only, scoped to body.landing so no other page changes.
 *
 * Background: a white-to-whisper-blue (#F0F7FF) gradient, three soft blurred
 * layers that drift with the mouse at different depths, and a pale glow that
 * follows the cursor. Icons: js/landing.js turns each one into a two-sided
 * tile that picks up spin from mouse movement and settles facing forward.
 *
 * Touch screens get lighter ambient motion and touch feedback. Reduced motion
 * hides the animated background and keeps icons still on every input device.
 */

body.landing {
  background: #fff;
}

.landing-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 18%, #F0F7FF 100%);
}

/* Layers are larger than the viewport so their edges never show as they move. */
.landing-bg-layer {
  position: absolute;
  inset: -15%;
  will-change: transform;
}

.landing-bg-layer--far {
  background:
    radial-gradient(34% 30% at 20% 28%, rgba(186, 214, 255, 0.55), transparent 70%),
    radial-gradient(32% 30% at 82% 74%, rgba(198, 222, 255, 0.55), transparent 70%);
  filter: blur(50px);
}

.landing-bg-layer--mid {
  background:
    radial-gradient(22% 20% at 74% 24%, rgba(205, 216, 255, 0.6), transparent 70%),
    radial-gradient(22% 20% at 28% 80%, rgba(194, 226, 250, 0.55), transparent 70%);
  filter: blur(40px);
}

.landing-bg-layer--near {
  background:
    radial-gradient(13% 12% at 58% 50%, rgba(214, 228, 255, 0.6), transparent 70%),
    radial-gradient(11% 10% at 90% 16%, rgba(220, 226, 255, 0.55), transparent 70%),
    radial-gradient(10% 9% at 8% 58%, rgba(208, 232, 255, 0.55), transparent 70%);
  filter: blur(28px);
}

/* The glow under the cursor. Positioned by the script with a transform. */
.landing-bg-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 720px;
  height: 720px;
  margin: -360px 0 0 -360px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(176, 210, 255, 1), rgba(204, 226, 255, 0.75) 45%, rgba(228, 240, 255, 0.35) 75%, transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: transform;
}
.landing-bg.is-live .landing-bg-glow { opacity: 1; }

/* Light gray digital rain, drawn by js/landing.js. It sits above the glow so
   the characters darken against it near the cursor. */
.landing-bg-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Let the background read as one surface behind the footer. */
body.landing .site-footer { background: rgba(255, 255, 255, 0.5); }

/* ── Type: the colours and lettering of crystallize.prism-on.tokyo ──
   Public Sans throughout; a deep crystal blue (#3F5BB1) for text and a
   periwinkle (#9AAFEA) it shades into, as on that site's SNOWFLAKE word. */

body.landing {
  --crystal: #3F5BB1;
  --crystal-light: #9AAFEA;
  --crystal-soft: rgba(63, 91, 177, 0.62);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--crystal);
}

body.landing .landing-hero {
  padding-top: clamp(4rem, 9vw, 6rem);
}

body.landing .landing-hero h1 {
  font-size: clamp(2.5rem, 7.5vw, 5.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--crystal);
  background: linear-gradient(100deg, var(--crystal) 20%, #6F86D6 55%, var(--crystal-light) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.landing .landing-hero p {
  color: var(--crystal);
  font-weight: 500;
  letter-spacing: 0.06em;
}

/* Link to the PingSolve Studio page (custom.html), above the headline. */
body.landing .studio-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  max-width: 100%;
  margin-bottom: 1.75rem;
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(63, 91, 177, 0.18);
  box-shadow: 0 6px 20px rgba(63, 91, 177, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #2E3F80;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
body.landing .studio-pill:hover {
  border-color: var(--crystal);
  box-shadow: 0 10px 26px rgba(63, 91, 177, 0.18);
  transform: translateY(-1px);
  text-decoration: none;
}
body.landing .studio-pill:focus-visible { outline: 3px solid var(--crystal); outline-offset: 3px; }
body.landing .studio-pill-tag {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--crystal);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body.landing .studio-pill-arrow { color: var(--crystal); transition: transform 0.2s ease; }
body.landing .studio-pill:hover .studio-pill-arrow { transform: translateX(3px); }
@media (max-width: 480px) {
  body.landing .studio-pill { flex-wrap: nowrap; gap: 8px; padding: 5px 12px 5px 5px; font-size: 0.8rem; }
  body.landing .studio-pill-tag { padding: 5px 9px; font-size: 0.64rem; white-space: nowrap; }
  body.landing .studio-pill-text { white-space: nowrap; }
  body.landing .studio-pill-more { display: none; }
}

body.landing .app-card { color: var(--crystal); }
body.landing .app-card-name {
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.landing .site-footer {
  color: var(--crystal-soft);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* The copyright line opens a prefilled email to support. */
body.landing .footer-contact {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
body.landing .footer-contact:hover,
body.landing .footer-contact:focus-visible {
  color: var(--crystal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A legal link has to be easy to see: full crystal blue (6:1 on white). */
body.landing .footer-legal { color: var(--crystal); }

/* ── Spinning icons (built by js/landing.js) ───────────── */

body.landing .app-card-icon.is-spinnable {
  overflow: visible;
  box-shadow: none;
  perspective: 700px;
}

.icon-spin {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.icon-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.icon-face--back { transform: rotateY(180deg); }

/* A light sweep across the face as it turns. --sheen runs 0 to 1. */
.icon-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%) no-repeat;
  background-size: 250% 100%;
  background-position: calc(var(--sheen, 0) * 100%) 0;
  opacity: var(--sheen-alpha, 0);
  pointer-events: none;
}

@media (hover: none), (pointer: coarse) {
  /* Gradients already have soft edges; skip the large mobile blur surfaces. */
  .landing-bg-layer { filter: none; }
  .landing-bg-glow {
    width: 320px;
    height: 320px;
    margin: -160px 0 0 -160px;
  }
  body.landing .app-card:hover { transform: none; box-shadow: none; }
  body.landing .app-card:active { transform: scale(0.97); }
  .icon-spin.mobile-enter { animation: mobile-icon-turn 900ms ease-out both; }
}

@keyframes mobile-icon-turn {
  from { transform: rotateY(-180deg); }
  to { transform: rotateY(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-bg-layer,
  .landing-bg-glow,
  .landing-bg-rain { display: none; }
  .icon-spin.mobile-enter { animation: none; }
  body.landing .app-card,
  body.landing .studio-pill,
  body.landing .studio-pill-arrow { transition: none; }
  body.landing .studio-pill:hover,
  body.landing .studio-pill:hover .studio-pill-arrow { transform: none; }
  body.landing .app-card:hover,
  body.landing .app-card:active { transform: none; }
}
