/* ============================================================
   Protech-T — landing page
   Theme tokens mirror the app (Design/Theme.swift)
   ============================================================ */

:root {
  --bg: #050505;
  --surface: #111111;
  --elevated: #1c1c1e;

  --accent: #1e6b84;
  --accent-light: #2a8fa8;
  --accent-bright: #3fb4d4;

  --text-primary: #f0f0f0;
  --text-secondary: #777777;
  --text-tertiary: #444444;
  --text-faint: #2a2a2a;

  --border: #1a1a1a;
  --border-elevated: #2a2a2a;

  --radius: 6px;
  --radius-sm: 4px;

  --font-display: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------- reset ----------------------------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  position: relative;
}

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

/* ----------------------------- intro ----------------------------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
html.intro #intro { display: flex; }

#intro video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the viewport at any aspect ratio (centred subject, edges crop) */
  object-position: center;
  background: var(--bg);
}

/* Cinematic dissolve: fade + gentle push-in + slight blur, revealing the
   site (which staggers in underneath at the same moment).
   `!important` + the high (#id.class) specificity keeps this dissolve alive even
   when the global prefers-reduced-motion rule zeroes out every transition — the
   intro is an explicit, opt-in experience that plays regardless of that setting. */
#intro.fade-out {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(4px);
  transition:
    opacity 1s var(--ease),
    transform 1s var(--ease),
    filter 1s var(--ease) !important;
  pointer-events: none;
}

.intro-skip {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom));
  right: 22px;
  z-index: 101;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.intro-skip:hover,
.intro-skip:focus-visible { color: var(--text-primary); border-color: var(--text-secondary); }

/* Hold the site's entrance animations until the intro hands off */
html.hold .reveal {
  animation: none !important;
  opacity: 0 !important;
  transform: translateY(10px);
}

/* --------------------------- atmosphere --------------------------- */
/* Soft teal glow behind the mark */
.glow {
  position: fixed;
  top: 38%;
  left: 50%;
  width: min(70vw, 620px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle at center,
    rgba(42, 143, 168, 0.16) 0%,
    rgba(30, 107, 132, 0.06) 32%,
    transparent 68%
  );
  pointer-events: none;
  z-index: 0;
  animation: breathe 7s var(--ease) infinite;
}

/* Fine grain overlay for depth (tiny inline SVG noise) */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Faint vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ----------------------------- stage ----------------------------- */
.stage {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px calc(48px + env(safe-area-inset-bottom));
  gap: 0;
}

/* ----------------------------- mark ----------------------------- */
.mark { margin-bottom: 30px; }

.appicon {
  width: 96px;
  height: 96px;
  display: block;
  border-radius: 22%; /* iOS-style squircle approximation */
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.7),
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;
  animation: floaty 6s var(--ease) infinite;
}

/* --------------------------- wordmark --------------------------- */
.wordmark {
  font-weight: 200;
  font-size: clamp(1.7rem, 8vw, 3.4rem);
  /* spacing shrinks on narrow screens so the line never overflows,
     even if a wide fallback font renders before Hanken loads */
  letter-spacing: clamp(0.1em, 2.6vw, 0.18em);
  line-height: 1;
  margin-bottom: 18px;
  max-width: 100%;
  padding-left: 0.1em; /* optical: balance the trailing letter-spacing */
}
.wordmark .hyphen { color: var(--accent-light); font-weight: 300; }

/* ---------------------------- tagline ---------------------------- */
.tagline {
  color: var(--text-secondary);
  font-weight: 300;
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  letter-spacing: 0.01em;
  margin-bottom: 40px;
}

/* --------------------------- waitlist --------------------------- */
.waitlist {
  width: min(360px, 100%);
  margin-bottom: 34px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-elevated);
  transition: border-color 0.35s var(--ease);
}
.field::after {
  /* animated teal underline that draws from center on focus */
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: left 0.4s var(--ease), right 0.4s var(--ease);
}
.field:focus-within::after { left: 0; right: 0; }

.field input[type="email"] {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  padding: 14px 4px;
}
.field input::placeholder { color: var(--text-tertiary); }

.field button {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.field button:hover { color: var(--accent-bright); }
.field button:active { transform: scale(0.9); }
.field button:focus-visible {
  outline: 1px solid var(--accent-light);
  outline-offset: 2px;
}

/* status / confirmation line */
.status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  min-height: 1.1em;
  margin-top: 14px;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.status.show { opacity: 1; transform: translateY(0); }
.status.error { color: #c4564f; }
.status.ok { color: var(--accent-bright); }

/* success state: hide the field, center the confirmation */
.waitlist.done .field { display: none; }
.waitlist.done .status { font-size: 0.82rem; }

/* loading state on the button */
.field button.loading { pointer-events: none; color: var(--text-tertiary); }
.field button.loading svg { animation: spin 0.8s linear infinite; }

/* --------------------------- microlabel --------------------------- */
.microlabel {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
}

/* ----------------------------- footer ----------------------------- */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  text-align: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}
.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}
.site-footer a:hover,
.site-footer a:focus-visible { color: var(--accent-light); }
.site-footer .sep { color: var(--text-faint); }
.site-footer .copyright {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* ========================= document pages ========================= */
/* Privacy / Support — readable prose, scrollable, in-flow footer. */
body.doc {
  overflow: visible;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.doc-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.doc-header a.home {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.doc-header img { width: 30px; height: 30px; border-radius: 22%; }
.doc-header .home-word {
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  color: var(--text-primary);
}
.doc-header .home-word .hyphen { color: var(--accent-light); }

.doc-wrap {
  position: relative;
  z-index: 3;
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.prose { color: var(--text-primary); }
.prose .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-light);
  margin-bottom: 14px;
}
.prose h1 {
  font-weight: 200;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.prose .updated {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 36px;
}
.prose h2 {
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  margin: 34px 0 12px;
}
.prose p,
.prose li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 1.1em; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text-primary); font-weight: 500; }
.prose a { color: var(--accent-light); text-decoration: none; }
.prose a:hover,
.prose a:focus-visible { text-decoration: underline; }

.doc-foot {
  position: relative;
  z-index: 3;
  border-top: 1px solid var(--border);
  padding: 22px 24px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}
.doc-foot a { color: var(--text-secondary); text-decoration: none; }
.doc-foot a:hover { color: var(--accent-light); }
.doc-foot .sep { color: var(--text-faint); margin: 0 8px; }

/* =============================== motion =============================== */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: revealIn 0.7s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes revealIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* larger screens: a touch more presence */
@media (min-width: 720px) {
  .appicon { width: 112px; height: 112px; }
  .mark { margin-bottom: 36px; }
}

/* respect reduced motion: show everything, kill all animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .appicon { animation: none; }
  .glow { animation: none; }
  .field::after { transition: none; }
}
