/* ============================================================
   Loreon — design system
   Inter (body) + Playfair Display italic (accents)
   Clean white canvas, ink typography, soft aurora color.
   `html.fx` is set by JS when motion is allowed — everything
   scroll/pointer-driven hangs off it so the site works without JS.
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-var.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/playfair-italic-var.woff2") format("woff2");
}

:root {
  --ink: #101114;
  --ink-2: #3d4149;
  --muted: #6c7078;
  --line: #e7e8ec;
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --accent: #3b5bfd;
  --accent-soft: #eef2ff;
  --radius: 16px;
  --radius-lg: 32px;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-soft: 0 24px 60px -24px rgba(16, 17, 20, 0.18);
}

/* ---------- Reset & base ---------- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.container {
  width: min(1160px, 92%);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 12px 12px;
  font-size: 0.875rem;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

section {
  scroll-margin-top: 24px;
}

.section {
  padding: clamp(80px, 12vh, 140px) 0;
}

h1 em,
h2 em,
h3 em {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head {
  margin-bottom: clamp(40px, 6vw, 64px);
}

.section-head h2 {
  margin-top: 10px;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease-out),
    background 0.2s,
    color 0.2s,
    box-shadow 0.3s;
}

.btn:hover {
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: #fff;
}

.btn-small {
  padding: 9px 20px;
  font-size: 0.85rem;
}

.btn-big {
  padding: 20px 44px;
  font-size: 1.15rem;
}

.btn-arrow {
  transition: transform 0.3s var(--ease-out);
}

.btn:hover .btn-arrow {
  transform: translate(3px, 0);
}

/* ---------- Brand (footer) ---------- */

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-dot {
  color: var(--accent);
}

/* ---------- Reveal on scroll ----------
   Hidden start state only under `.fx`, so the page reads fine without JS. */

.fx .reveal {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(8px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out),
    filter 0.8s var(--ease-out);
  transition-delay: var(--d, 0s);
}

.fx .reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: transform 0.6s var(--ease-out);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.78;
}

.blob-a {
  width: 540px;
  height: 540px;
  left: -140px;
  top: -100px;
  background: radial-gradient(circle at 30% 30%, #dbe4ff, transparent 70%);
  animation: drift 16s ease-in-out infinite alternate;
}

.blob-b {
  width: 480px;
  height: 480px;
  right: -120px;
  top: 8%;
  background: radial-gradient(circle at 60% 40%, #ffe8d9, transparent 70%);
  animation: drift 20s ease-in-out infinite alternate-reverse;
}

.blob-c {
  width: 440px;
  height: 440px;
  left: 32%;
  bottom: -180px;
  background: radial-gradient(circle at 50% 50%, #e2f4ea, transparent 70%);
  animation: drift 24s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(60px, 40px) scale(1.08);
  }
}

.hero-inner {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding-block: 48px;
}

.hero-title {
  font-size: clamp(2.9rem, 7.4vw, 5.8rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.hero-dot {
  color: var(--accent);
}

.hero-sub {
  max-width: 46ch;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* Letter intro — JS splits the h1 into .w (words) of .lt (letters).
   Until it does, .fx hides the title to avoid a flash of unsplit text. */

.fx .hero-title[data-split]:not(.split) {
  opacity: 0;
}

.w {
  display: inline-block;
  white-space: nowrap;
}

.lt,
.ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em);
  filter: blur(8px);
  animation: letter-in 0.6s var(--ease-out) forwards;
}

.ch.out {
  opacity: 1;
  transform: none;
  filter: none;
  animation: letter-out 0.3s ease forwards;
}

@keyframes letter-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes letter-out {
  to {
    opacity: 0;
    transform: translateY(-0.4em);
    filter: blur(6px);
  }
}

.hero-title.split .hero-dot {
  display: inline-block;
  opacity: 0;
  animation: letter-in 0.6s var(--ease-out) 0.85s forwards;
}

.rotator {
  color: var(--ink);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  translate: -50% 0;
  width: 26px;
  height: 42px;
  border: 1.5px solid var(--muted);
  border-radius: 999px;
  opacity: 0.7;
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--muted);
  animation: cue 1.9s ease-in-out infinite;
}

@keyframes cue {
  50% {
    transform: translateY(15px);
    opacity: 0.25;
  }
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 16px 0;
  background: var(--bg);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

/* main.js takes the loop over with GSAP so scrolling can speed it up */
.marquee-track.is-gsap {
  animation: none;
}

.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee-track > * {
  margin-right: 44px;
}

.marquee span {
  font-size: 0.95rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  white-space: nowrap;
}

.marquee i {
  font-style: normal;
  color: var(--accent);
  font-size: 0.8rem;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Work rail ----------
   A horizontal scroll-snap rail: any number of .work-tile articles.
   Tiles centre themselves while they fit (auto margins on first/last);
   once they overflow, the rail scrolls — drag, wheel, or the arrows
   (main.js unhides .rail-nav only when there is overflow). */

.work-rail {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 8px 4px 12px;
  scrollbar-width: none;
  cursor: grab;
}

.work-rail::-webkit-scrollbar {
  display: none;
}

.work-rail.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}

.work-rail.dragging .work-tile {
  pointer-events: none;
}

.work-rail .work-tile:first-child {
  margin-left: auto;
}

.work-rail .work-tile:last-child {
  margin-right: auto;
}

.work-tile {
  position: relative;
  flex: none;
  width: min(480px, 84vw);
  scroll-snap-align: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: clamp(44px, 6vw, 68px) 32px;
  text-align: center;
  transition: box-shadow 0.35s var(--ease-out);
}

.work-tile:hover {
  box-shadow: var(--shadow-soft);
}

/* soft light that follows the pointer across a tile (main.js sets --mx/--my) */
.tile-spot {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.7), transparent 55%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}

.work-tile:hover .tile-spot {
  opacity: 1;
}

/* the app icon itself, blown up and blurred, as the tile's backdrop */
.tile-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.tile-bg img {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 125%;
  max-width: none;
  transform: translate(-50%, -50%);
  filter: blur(70px) saturate(1.3);
  opacity: 0.4;
  transition: opacity 0.4s;
}

.work-tile:hover .tile-bg img {
  opacity: 0.55;
}

.tile-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tile-icon {
  width: clamp(88px, 10vw, 112px);
  border-radius: 24%;
  box-shadow: 0 20px 44px -16px rgba(21, 29, 51, 0.45);
  transition: transform 0.35s var(--ease-out);
}

.work-tile:hover .tile-icon {
  transform: scale(1.05) translateY(-2px);
}

.tile-content h3 {
  margin-top: 8px;
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tile-tagline {
  color: var(--muted);
  max-width: 32ch;
}

.tile-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.tile-links a {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s, transform 0.25s var(--ease-out);
}

.tile-links a svg {
  width: 20px;
  height: 20px;
}

.tile-links a:hover {
  background: var(--ink);
  color: #fff;
  transform: translateY(-3px);
}

/* invitation tile at the end of the rail */
.work-tile-cta {
  border-style: dashed;
  border-color: #d6d8de;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-plus {
  display: grid;
  place-items: center;
  width: clamp(88px, 10vw, 112px);
  aspect-ratio: 1;
  border-radius: 24%;
  border: 1.5px dashed #c9ccd4;
  color: var(--muted);
  font-size: 2.6rem;
  font-weight: 300;
  line-height: 1;
}

.work-tile-cta h3 em {
  color: var(--accent);
}

.work-tile-cta .btn {
  margin-top: 12px;
}

.rail-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.rail-nav[hidden] {
  display: none;
}

.rail-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.25s var(--ease-out), opacity 0.2s;
}

.rail-btn svg {
  width: 20px;
  height: 20px;
}

.rail-btn:hover:not(:disabled) {
  background: var(--ink);
  color: #fff;
  transform: translateY(-2px);
}

.rail-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---------- Screens — floating phone wall ----------
   Without JS (or with reduced motion): a plain horizontal scroller.
   With JS (`html.fx`): the section grows tall, the inner block goes
   sticky, and the phones become an overlapping collage. As you scroll,
   main.js drives each slot's --dy so neighbouring phones drift past
   each other in opposite directions (and the stage eases up to full
   scale via --sp). A slow CSS float keeps everything gently moving
   even when scrolling stops. */

.shots {
  padding-block: clamp(80px, 12vh, 140px);
  overflow: clip;
}

.shots-sticky {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 2vh, 28px);
}

.shots-head {
  position: relative;
  z-index: 6; /* above every .phone-slot, so drifting frames pass beneath it */
  text-align: center;
  margin-bottom: 0;
}

.shots-stage {
  --pw: clamp(200px, 23vw, 290px);
  display: flex;
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: clamp(36px, 6vh, 56px) 6vw;
}

.shots-stage::-webkit-scrollbar {
  display: none;
}

.phone-slot {
  flex: none;
  width: calc(var(--pw) * var(--scale, 1));
}

.fx .shots {
  height: 330vh;
  padding-block: 0;
}

.fx .shots-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
}

.fx .shots-stage {
  position: relative;
  overflow: visible;
  padding: 0;
  height: min(62svh, 640px);
  scale: calc(0.88 + var(--sp, 0) * 0.12);
  transform-origin: 50% 40%;
}

.fx .phone-slot {
  position: absolute;
  left: var(--x, 50%);
  top: 50%;
  z-index: var(--z, 1);
  transform: translate(-50%, calc(-50% + var(--lift, 0vh) + var(--dy, 0px)));
  will-change: transform;
}

/* entrance: phones rise into place one by one when the stage scrolls in */
.fx .phone-float {
  opacity: 0;
  translate: 0 9vh;
  filter: blur(12px);
  transition:
    opacity 0.9s var(--ease-out),
    translate 0.9s var(--ease-out),
    filter 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 110ms);
}

.fx .shots-stage.on .phone-float {
  opacity: 1;
  translate: 0 0;
  filter: none;
}

/* GSAP mode — main.js scrubs each slot through deck → fan → drift with
   transforms (centring included, via xPercent/yPercent), so the resting
   lift moves to a margin and the CSS entrance above stands down. */
.fx .shots-stage.gsap-wall {
  --pw: clamp(180px, 21vw, 270px);
  scale: 1;
}

.fx .gsap-wall .phone-slot {
  transform: none;
  margin-top: var(--lift, 0vh);
}

.fx .gsap-wall .phone-float {
  opacity: 1;
  translate: none;
  filter: none;
  transition: none;
}

/* a light sweep across each screen as the phones settle into place */
.phone-glint {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.6) 48%, rgba(255, 255, 255, 0.15) 56%, transparent 70%);
}

/* endless idle drift, staggered per phone via --dur / --fdelay */
.phone-float {
  animation: idle-float var(--dur, 8s) ease-in-out var(--fdelay, 0s) infinite alternate;
}

@keyframes idle-float {
  from {
    transform: translateY(-1.5%) rotate(-0.5deg);
  }
  to {
    transform: translateY(1.5%) rotate(0.5deg);
  }
}

.phone {
  position: relative;
  width: 100%;
  container-type: inline-size;
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 30px 38px rgba(21, 29, 51, 0.22));
}

/* smaller = further away: soften back-row phones a touch */
.fx .phone-slot .phone {
  filter: drop-shadow(0 30px 38px rgba(21, 29, 51, 0.22))
    blur(calc(max(0px, (0.94 - var(--scale, 1)) * 10px)));
}

.phone-frame {
  position: relative;
  z-index: 2;
  width: 100%;
}

/* the screen behind the frame's transparent cut-out — the frame's screen
   box (20, 24, 440, 936 on the 460×960 frame, radius 52), as in the App
   Store screenshots; the full, uncropped capture covers it */
.phone-screen {
  position: absolute;
  z-index: 1;
  left: 4.348%;
  right: 4.348%;
  top: 2.5%;
  bottom: 2.5%;
  border-radius: 11.3cqw;
  overflow: hidden;
  background: linear-gradient(165deg, var(--scr-a, #eef2ff) 0%, var(--scr-b, #fbeee4) 100%);
}

.phone-screen > img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Contact ---------- */

.contact {
  position: relative;
  overflow: hidden;
  padding: clamp(110px, 16vh, 180px) 0;
  text-align: center;
}

/* a quieter echo of the hero aurora */
.contact-bg .blob {
  opacity: 0.55;
}

.contact-bg .blob-a {
  left: -180px;
  top: auto;
  bottom: -220px;
}

.contact-bg .blob-b {
  top: -160px;
  right: -160px;
}

.contact-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.contact-title {
  font-size: clamp(2.6rem, 6.6vw, 5rem);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.contact-alt {
  font-size: 0.95rem;
  color: var(--muted);
}

.contact-alt a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand p,
.footer-right p {
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-clock time {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.footer-right {
  text-align: right;
}

.footer-right a {
  font-size: 0.92rem;
  font-weight: 500;
}

.footer-right a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 404 ---------- */

.error-page {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.error-page .container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.error-code {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(6rem, 18vw, 11rem);
  line-height: 1;
  color: var(--ink);
}

.error-page h1 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.error-page p:not(.error-code) {
  color: var(--muted);
  max-width: 44ch;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .shots-stage,
  .fx .shots-stage.gsap-wall {
    --pw: clamp(150px, 40vw, 220px);
  }

  .fx .shots-stage {
    height: min(56svh, 560px);
  }

  .footer-inner,
  .footer-right {
    text-align: left;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .blob,
  .marquee-track,
  .scroll-cue span,
  .phone-float {
    animation: none;
  }

  .lt,
  .ch {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }
}
