/* ============================================================
   Random Apps — homepage
   A minimal app gallery: brand, then a grid of app icons + names.
   Clean, Apple-inspired. Tap an icon to open that app's info page.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --ink-faint: #86868b;
  --accent: #e0392b;
  --hairline-soft: rgba(0, 0, 0, 0.06);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.16);
  --maxw: 920px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

::selection { background: rgba(224, 57, 43, 0.16); }

/* ---------- sea waves above the footer (homepage) ---------- */
.waves-band { width: 100%; height: clamp(90px, 15vh, 160px); margin-bottom: -1px; line-height: 0; }
.waves { width: 100%; height: 100%; display: block; }
.waves use { animation: wave-sway 24s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; }
.waves .w1 { fill: rgba(255, 122, 92, 0.5); animation-duration: 8s;  animation-delay: -2s; }
.waves .w2 { fill: rgba(255, 90, 70, 0.5);  animation-duration: 11s; animation-delay: -3s; }
.waves .w3 { fill: rgba(224, 57, 43, 0.4);  animation-duration: 15s; animation-delay: -4s; }
.waves .w4 { fill: rgba(224, 57, 43, 0.9);  animation-duration: 20s; animation-delay: -5s; }
@keyframes wave-sway {
  0%   { transform: translate3d(-90px, 0, 0); }
  100% { transform: translate3d(85px, 0, 0); }
}
@media (prefers-reduced-motion: reduce) { .waves use { animation: none; } }

a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */

.home {
  flex: 1;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: clamp(72px, 14vh, 130px) 24px 80px;
  display: flex; flex-direction: column; align-items: center;
}

/* ---------- up-a-level glyph (top left) ----------
   Same 2x2 mark and tap target as the app pages' .nav-home, so "go up" sits in
   the same place and looks the same wherever you are on the site. */
.home-up {
  position: absolute; top: 28px; left: 24px; z-index: 50;
  display: inline-flex; align-items: center; color: var(--ink-soft);
  padding: 11px; margin: -11px;   /* ~44px tap target without shifting the icon */
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.home-up:hover { color: var(--accent); transform: translateY(-1px); }
.home-up:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 8px; }
.home-up svg { width: 22px; height: 22px; }

/* ---------- intro ---------- */

.intro { text-align: center; margin-bottom: clamp(48px, 8vh, 80px); }

.brand-mark { width: 64px; height: 64px; margin: 0 auto 26px; view-transition-name: brand-mark; }
.brand-mark svg {
  width: 100%; height: 100%;
  border-radius: 15px;
  box-shadow: 0 6px 20px rgba(224, 57, 43, 0.28);
}

.intro h1 {
  font-family: "Sora", var(--font);
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
  margin-bottom: 14px;
  color: var(--ink);
  /* clean reveal: a simple fade in on load (no transform, so nothing snaps at the end) */
  animation: title-in 0.6s ease both;
}
@keyframes title-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .intro h1 { animation: none; }
}

/* On leaving for an app page the heading just fades out with the rest of the page (it's no
   longer a separate transition element). The load reveal above still plays on every load. */
.intro-sub { font-size: clamp(16px, 2vw, 19px); color: var(--ink-soft); font-weight: 400; }

/* ============================================================
   APP GALLERY
   ============================================================ */

.gallery {
  width: 100%;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: clamp(30px, 5vw, 60px);
}

.app {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: clamp(120px, 20vw, 150px);
  padding: 8px;
  border-radius: 24px;
  transition: transform 0.3s var(--ease);
}
.app:hover { transform: translateY(-6px); }
.app:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---------- app icon (real image, clipped to a uniform iOS squircle) ---------- */

.app-icon {
  width: clamp(96px, 13vw, 116px); height: auto; display: block;
  border-radius: 22.37%;            /* iOS continuous-corner squircle */
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.20);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.app:hover .app-icon { box-shadow: 0 20px 38px rgba(0, 0, 0, 0.28); }
/* tactile button press: the icon dips in quickly, then springs back on release */
.app:active .app-icon { transform: scale(0.92); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); transition-duration: 0.1s; }

.app-name { font-size: 16px; font-weight: 500; color: var(--ink); text-align: center; transition: color 0.2s; }
.app:hover .app-name { color: var(--accent); }

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  text-align: center;
  padding: 28px 24px;
  background: #e23e30; /* exact stacked tone at the wave band's bottom edge — seamless join */
}
.footer p { font-size: 13px; color: #fff; }

/* ============================================================
   REVEAL ON LOAD
   ============================================================ */

/* Entrance fade intentionally disabled (see app.css): avoids a flash on settle
   when the view transition already cross-fades the page in. */
.reveal { opacity: 1; }
/* Sleek scroll reveals: script.js tags below-fold .reveal elements with .will-reveal
   (hidden), then .is-in once they scroll into view. On-screen content stays visible. */
.reveal.will-reveal { opacity: 0; transform: translateY(26px); }
.reveal.will-reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- cross-page shared-element transition (icons fly to their new spots) ---------- */
@view-transition { navigation: auto; }
::view-transition-group(*) {
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
/* the leaving page recedes (slight scale + fade) as the new one rises in */
@keyframes page-recede { to { opacity: 0; transform: scale(0.965); } }
::view-transition-old(root) { animation: page-recede 0.55s cubic-bezier(0.4, 0, 0.2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001s !important; }
  .reveal { opacity: 1; transform: none; }
}
