/*
  Global stylesheet for LaunchMe landing and docs
  - Dark, glassy look inspired by the screenshot
  - Clear class names; lots of comments for future edits
*/

:root {
  --bg: #071826;
  --bg-elev: #0f2536;
  --text: #e6f1fa;
  --muted: #a9c0d4;
  --brand: #52a8ff;
  --brand-2: #7c5cff;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.12);
  --radius: 14px;
  --radius-lg: 24px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --lm-card-height: 340px; /* unified height for wide and square cards */
}

/* Base resets */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: #fff; }

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  backdrop-filter: saturate(160%) blur(12px);
  background: rgba(7,24,38,0.85);
  border-bottom: none; /* remove stroke */
}
.site-header.minimal { position: static; }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand.small { font-size: 14px; }
.brand-mark { font-size: 20px; }
.brand-name { letter-spacing: 0.2px; }
.brand-img { height: 28px; display:block; }
.brand.small .brand-img { height: 22px; }
.header-download img { height: 36px; display: block; }

/* Hero */
.hero { padding: 128px 0 40px; text-align: center; }
.hero-inner { display: grid; gap: 18px; justify-items: center; }
.tagline { color: var(--muted); margin: 0; font-size: 26px; font-weight: 500; }
.hero-title { font-size: 60px; line-height: 1.1; margin: 0; font-weight: 800; }
.hero-sub { color: var(--muted); margin-top: -6px; font-size: 20px; font-weight: 500; }
.cta-group { display: flex; gap: 12px; margin-top: 6px; }

.button { display: inline-block; padding: 12px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: #fff; }
.button.primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-color: transparent; }
.button.ghost { background: transparent; }

/* App Store badge */
.app-badge img { height: 60px; display: block; }

/* Sections */
.section { padding: 64px 0; }
.section-kicker { text-align: center; color: var(--muted); margin: 0 0 8px; font-size: 26px; font-weight: 500; }
.section-title { text-align: center; margin: 0 0 8px; font-size: 60px; font-weight: 800; line-height: 1.1; }
.section-sub { text-align: center; color: var(--muted); margin: 0 0 48px; font-size: 20px; font-weight: 500; }

/* Cards and grids */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title { margin: 10px 0 2px; font-size: 18px; }
.card-text { margin: 0; color: var(--muted); }

/* Placeholder blocks to swap with real images later */
.placeholder { background: var(--bg-elev); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.placeholder-hero { width: 100%; max-width: 1100px; height: 300px; border-radius: var(--radius-lg); }
.hero-image { width: 100%; max-width: 1100px; height: auto; object-fit: contain; border-radius: var(--radius-lg); display:block; }
.ratio-16x9 { width: 100%; padding-top: 56.25%; position: relative; }
.ratio-16x9::after { content: ""; position: absolute; inset: 0; }
.ratio-1x1 { width: 100%; padding-top: 100%; position: relative; }
.ratio-1x1::after { content: ""; position: absolute; inset: 0; }
.wide { max-width: 900px; margin: 0 auto; }
.thumbs .small { height: 100px; }
.icon { width: 60px; height: 60px; border-radius: 12px; }

/* CTA card */
.cta-card { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border); padding: 18px; border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* Gallery */
.gallery { padding-top: 0; background: #000; }
.gallery .container { max-width: none; padding: 0; position: relative; /* Let the section height adapt; keep extra scroll via a variable */ min-height: calc(100vh + var(--gallery-extra-scroll, 60vh)); height: auto; display: flex; flex-direction: column; }
.gallery-main-image { display:block; width:100%; max-width:900px; margin:0 auto; border: none; box-shadow: none; border-radius: 0; background: transparent; }

/* Scroll-driven gallery stage */
.gallery-stage { position: sticky; top: 0; height: 100vh; min-height: 520px; width: 100vw; display: grid; align-items: start; justify-items: center; overflow: visible; --stage-final-shift-y: 60px; --stage-start-overshoot: 5vh; /* Unified frame width for both image and video */ --frame-w: min(1400px, 98vw); --final-scale-boost: 1.3; }
/* Ensure image and video scale from the same anchor to avoid desync while scrolling */
.gallery-stage__image, .gallery-stage__video, .gallery-stage__video-box { transform-origin: top center; }
.gallery-stage__video {
  /* Positioned overlay to simulate video playing inside laptop screen */
  position: absolute;
  top: 0; left: 0; right: 0; margin: 0 auto; /* true centering */
  width: var(--frame-w); height: 0; /* width anchor; children absolutely placed */
  display: grid;
  place-items: center;
  pointer-events: none; /* overlay is decorative */
  z-index: 1; /* below image, above stage background */
  will-change: transform, filter;
}
.gallery-stage__video-box {
  /* Define the exact screen window. This clips any overflow. */
  position: absolute;
  /* Use ratios relative to the unified frame width so video scales 1:1 with the PNG */
  left: calc(var(--screen-left-r, 0.09) * var(--frame-w));
  top: calc(var(--screen-top-r, 0.02) * var(--frame-w));
  width: calc(var(--screen-width-r, 0.82) * var(--frame-w));
  /* Maintain strict proportion; height derives from width automatically */
  aspect-ratio: var(--screen-aspect-ratio, 1.6);
  height: auto;
  border-radius: var(--screen-radius, 12px);
  overflow: hidden;
  pointer-events: none;
  /* Fine vertical nudge without changing geometry */
  transform: translateY(var(--screen-offset-y, 0px));
}
.gallery-stage__video-box video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* Optional mask to perfectly match the laptop screen shape.
     Provide a screen-only alpha mask (white=visible screen, black=hidden bezel) and set
     --screen-mask-url: url('images/screen-mask.png') on .gallery-stage (or container). */
  -webkit-mask-image: var(--screen-mask-url, none);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  /* Stretch mask to element box to avoid misalignment with laptop PNG */
  -webkit-mask-size: 100% 100%;
  -webkit-mask-mode: luminance;
  mask-image: var(--screen-mask-url, none);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  mask-mode: luminance;
}
.gallery-stage__image { position: absolute; top: 0; left: 0; right: 0; margin: 0 auto; transform: scale(1.6); z-index: 2; width: var(--frame-w); height: auto; filter: blur(8px); backface-visibility: hidden; will-change: transform, filter; }
.gallery-stage__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(6px); will-change: opacity; z-index: 5; }
.gallery-stage { contain: layout paint; }
.gallery-stage__label { position: absolute; inset: 0; display:flex; align-items:center; justify-content:center; text-align:center; font-size: 60px; font-weight: 800; letter-spacing: 0.2px; transition: opacity 0.2s linear; background: transparent; z-index: 6; }
.gallery-caption { text-align: center; color: var(--muted); font-size: 20px; font-weight: 500; max-width: 920px; margin: 12px auto 0; padding: 0 20px; }
/* Keep caption inside the gallery container but visually at the bottom under the image */
.gallery .gallery-caption { margin-top: auto; padding-top: 12px; }

/* Responsive tuning for mobile/portrait to keep the video fully inside the laptop screen
   We override the screen window variables so the video scales with the PNG cutout */
@media (max-width: 700px) {
  .gallery-stage { --frame-w: min(1800px, 98vw); --stage-final-shift-y: 140px; --stage-start-overshoot: 6vh; --final-scale-boost: 1; }
}

/* Responsive final scale tuning */
@media (max-width: 1700px) and (min-width: 1400px) {
  .gallery-stage { --final-scale-boost: 0.95; }
}
@media (max-width: 1399px) and (min-width: 1200px) {
  .gallery-stage { --final-scale-boost: 0.85; }
}
@media (max-width: 1199px) and (min-width: 1024px) {
  .gallery-stage { --final-scale-boost: 0.80; }
}
@media (max-width: 1024px) and (min-width: 900px) {
  .gallery-stage { --final-scale-boost: 0.8; }
}

/* Phones and small tablets */
@media (max-width: 899px) and (min-width: 768px) {
  .gallery-stage { --final-scale-boost: 0.85; }
}
@media (max-width: 767px) and (min-width: 600px) {
  .gallery-stage { --final-scale-boost: 0.85; }
}
/* Phones granular sizes */
@media (max-width: 599px) and (min-width: 440px) {
  .gallery-stage { --final-scale-boost: 0.85; }
}
@media (max-width: 439px) and (min-width: 375px) {
  .gallery-stage { --final-scale-boost: 0.80; }
}
@media (max-width: 374px) {
  .gallery-stage { --final-scale-boost: 0.60; }
}

/* Reduce gallery section height on mobile to ~half */
@media (max-width: 767px) {
  .gallery { padding-top: 26px; }
  .gallery .container { min-height: auto; height: auto; }
  /* Make stage a normal block with intrinsic height via aspect-ratio */
  .gallery-stage { position: relative; top: auto; height: auto; min-height: 0; aspect-ratio: var(--mobile-stage-aspect, 16/10); width: var(--mobile-stage-width, 100%); margin: 0 auto; }
  /* Lay out frame and video to fill the stage area */
  .gallery-stage__image { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; transform: none; filter: none; }
  .gallery-stage__video { position: absolute; inset: 0; width: 100%; height: 100%; transform: none; filter: none; }
  .gallery-stage__video-box { left: calc(var(--screen-left-r, 0.09) * 100%); top: calc(var(--screen-top-r, 0.02) * 100% + var(--mobile-screen-shift,2px)); width: calc(var(--screen-width-r, 0.82) * 100%); aspect-ratio: var(--screen-aspect-ratio, 1.6); height: auto; transform: none; }
  .gallery-stage__overlay, .gallery-stage__label { display: none; }
  /* Left-align caption on mobile for readability */
  .gallery-caption { text-align: left; margin-left: 20px; margin-right: 20px; }
  /* Ensure feature card hero images hug the bottom on mobile */
  .lm-card__image[src*="liquid-glass"],
  .lm-card__image[src*="dynamic-wallpaper"] { top: auto; bottom: 0; height: auto; }
}
@media (max-width: 599px) {
  .gallery .container { min-height: auto; }
  .gallery-stage { height: auto; }
}

/* Ensure the hero card image sits at the bottom on mobile */
@media (max-width: 767px) {
  .lm-card__image { bottom: 0; top: auto; height: auto; }
}

/* Accordion */
.accordion { max-width: 800px; margin: 0 auto; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-trigger { width: 100%; text-align: left; background: transparent; border: 0; color: #fff; padding: 14px 0; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.accordion-trigger::after { content: "+"; font-size: 20px; font-weight: 300; transition: transform 0.2s ease; }
.accordion-trigger[aria-expanded="true"]::after { content: "−"; }
.accordion-panel { color: var(--muted); padding: 0 0 14px; }

/* Footer */
.site-footer { border-top: none; background: #06131e; margin-top: 40px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px; }
.footer-nav a { color: var(--muted); margin-left: 14px; }
.footer-nav a:hover { color: #fff; }

/* Docs page typography */
.doc .doc-main { padding: 40px 0; }
.doc .doc-main h1 { border-bottom: 2px solid var(--brand); padding-bottom: 10px; }
.doc .doc-main h2 { margin-top: 28px; }
.last-updated { color: var(--muted); font-style: italic; }

/* =============================
   Reusable Card Components (Wide & Square)
   - Title: 16px, uppercase, bold
   - Subtitle: 26px, bold (optional)
   - Background: color or image via CSS variables
   - Foreground image sticks to bottom, spans full width
   ============================= */

.lm-cards-row {
  /* Row that holds one wide card or two square cards */
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px; /* required spacing between cards */
}
@media (min-width: 900px) {
  .lm-cards-row.lm-cards-row--split {
    grid-template-columns: 1fr 1fr; /* two squares next to each other */
  }
}

.lm-card {
  position: relative;
  overflow: hidden;
  border-radius: 50px; /* per spec: large rounded corners */
  box-shadow: none; /* remove shadows as requested */
  border: none; /* remove strokes/borders as requested */
  /* Allow custom backgrounds */
  background-image: var(--card-bg-image, none);
  background-color: var(--card-bg-color, #000);
  background-size: cover;
  background-position: center;
}

/* internal layout */
.lm-card__content { position: relative; z-index: 2; padding: 40px 20px 18px 20px; text-align: center; }
.lm-card__title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.lm-card__subtitle { margin: 6px 0 0; font-size: 26px; font-weight: 800; line-height: 1.1; }

/* bottom-anchored foreground image */
.lm-card__image {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  width: 100%; height: auto; display: block;
}
.lm-card__image[src*="dynamic-wallpaper"],
.lm-card__image[src*="liquid-glass"] {
  top: 20%; /* leave 20% space at top */
  height: 80%; /* fill remaining 80% */
  object-fit: contain; /* scale down to fit, maintain aspect ratio */
}
.lm-card--square .lm-card__image {
  top: 0; /* no top offset for square cards */
  height: 100%; /* fill full height */
}
@media (max-width: 800px) {
  .lm-card__image[src*="dynamic-wallpaper"],
  .lm-card__image[src*="liquid-glass"] {
    top: 20%; /* same behavior on mobile */
    height: 80%;
    object-fit: contain;
  }
  .lm-card--square .lm-card__image {
    top: 0; /* no top offset for square cards on mobile */
    height: 100%;
  }
}

/* Sizes */
.lm-card--wide { height: auto; }
.lm-card--square { height: auto; aspect-ratio: 1 / 1; }

/* Placeholder visual if no real image is provided */
.lm-card__image.placeholder-img { height: 46%; background: #000; }

/* =============================
   Dedicated CTA Pill component (bottom card)
   - Fixed size 870x290 on desktop
   - Black background, no border/shadow
   - Radius 85, text left, large icon right
   ============================= */
.cta-pill { width: 870px; min-height: 290px; height: auto; margin: 0 auto; background: #000; border: none; box-shadow: none; border-radius: 85px; display: grid; grid-template-columns: 1fr 220px; align-items: center; padding: 40px; gap: 24px; }
.cta-pill__title { margin: 0 0 18px; font-size: 28px; font-weight: 800; line-height: 1.25; }
.cta-pill__icon { width: 180px; height: 180px; display: block; margin-left: auto; object-fit: contain; }
.cta-pill__left { display: flex; flex-direction: column; align-items: flex-start; }
@media (max-width: 940px) {
  .cta-pill { width: calc(100% - 40px); min-height: 290px; height: auto; grid-template-columns: 1fr 180px; padding: 24px; }
  .cta-pill__icon { width: 160px; height: 160px; }
}

/* Mobile layout: vertical stack like the mock */
@media (max-width: 767px) {
  .cta-pill { width: calc(100% - 32px); padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; border-radius: 50px; margin: 24px auto; }
  /* Order: icon, text, button (button is inside left block after title) */
  .cta-pill__icon { order: 0; width: 140px; height: 140px; margin: 0 auto; }
  .cta-pill__left { order: 1; align-items: center; }
  .cta-pill__title { font-size: 22px; line-height: 1.3; }
  .app-badge img { height: 52px; }
}

/* Variant: icon on the left within content for specific card */
.lm-card--icon-left { border-radius: 85px; background: #000; box-shadow: none; border: none; }
.lm-card--icon-left .lm-card__content { display: inline-flex; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.lm-card__icon { width: 40px; height: 40px; display: inline-block; }

/* CTA fixed-size variant (bottom card) */
.lm-card--fixed-cta { width: 870px; height: 290px; margin: 0 auto; }
@media (max-width: 940px) {
  .lm-card--fixed-cta { width: calc(100% - 40px); height: 290px; }
}

