@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --max-width: 960px;

  /* Default: dark theme */
  --color-bg: #0e0e10;
  --color-surface: rgba(255,255,255,0.06);
  --color-text: #f0f0f0;
  --color-text-secondary: rgba(255,255,255,0.55);
  --color-accent: #7eb0ff;
  --color-border: rgba(255,255,255,0.1);
  --color-tag-bg: rgba(255,255,255,0.1);
  --color-tag-text: rgba(255,255,255,0.7);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);

  --app-accent: #7eb0ff;
}

/* ── Per-app full-page themes ── */

.theme-auth-for-tesla {
  --color-bg: #1a0508;
  --color-surface: rgba(196,30,42,0.12);
  --color-border: rgba(196,30,42,0.2);
  --color-tag-bg: rgba(196,30,42,0.15);
  --app-accent: #e84650;
  --color-accent: #ff6b73;
}

.theme-caravan-leveler {
  --color-bg: #170d06;
  --color-surface: rgba(196,74,26,0.1);
  --color-border: rgba(196,74,26,0.2);
  --color-tag-bg: rgba(196,74,26,0.15);
  --app-accent: #d4652e;
  --color-accent: #e88a5a;
}

.theme-manascope {
  --color-bg: #120820;
  --color-surface: rgba(147,51,234,0.1);
  --color-border: rgba(147,51,234,0.18);
  --color-tag-bg: rgba(147,51,234,0.15);
  --app-accent: #b05ce6;
  --color-accent: #d07aff;
}

.theme-rumskrot-remote {
  --color-bg: #060a06;
  --color-surface: rgba(0,200,83,0.06);
  --color-border: rgba(0,200,83,0.12);
  --color-tag-bg: rgba(0,200,83,0.1);
  --app-accent: #00c853;
  --color-accent: #4ae08a;
}

.theme-rumskrot-terminal {
  --color-bg: #0a0818;
  --color-surface: rgba(124,58,237,0.08);
  --color-border: rgba(124,58,237,0.15);
  --color-tag-bg: rgba(124,58,237,0.12);
  --app-accent: #7c3aed;
  --color-accent: #a78bfa;
}

.theme-pairpanic {
  --color-bg: #1a0a05;
  --color-surface: rgba(255,107,53,0.1);
  --color-border: rgba(255,107,53,0.18);
  --color-tag-bg: rgba(255,107,53,0.14);
  --app-accent: #ff6b35;
  --color-accent: #ff8a5b;
}

html {
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ── Navigation ── */

nav {
  padding: 20px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

nav .nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

nav .nav-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav .nav-links a:hover {
  color: var(--color-text);
}

/* ── Main Content ── */

main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ── Hero Section (Home) ── */

.hero {
  padding: 100px 0 70px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero .tagline {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.75;
}

.hero .made-in {
  margin-top: 24px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── App Grid (Home) ── */

.section-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 28px;
  padding-bottom: 80px;
}

.app-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-card .badge-coming-soon {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.85);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 6px;
  z-index: 2;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--app-accent) 35%, var(--color-border));
}

/* Card preview area: holds the device mockups (phone, optionally with
   a watch beside it) on a soft accent gradient. Devices are bottom-
   aligned so the bezel bottoms (phone chrome bottom and watch strap
   bottom) sit on the same baseline. */
.card-preview {
  position: relative;
  height: 372px;
  padding: 24px 16px 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 50px;
  background:
    radial-gradient(120% 90% at 50% 0%,
      color-mix(in srgb, var(--app-accent) 28%, transparent) 0%,
      color-mix(in srgb, var(--app-accent) 8%, transparent) 55%,
      transparent 100%);
}

.app-card:hover .device-frame,
.screenshot-item:hover .device-frame {
  transform: translateZ(0) translateY(-4px) scale(1.02);
}

.app-card .card-body {
  padding: 22px 22px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-card .card-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
}

/* Icon + title row in homepage cards */
.card-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.card-title-row h3 {
  margin-bottom: 0;
}

.app-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.4));
}

/* Card-link pattern: the title link expands invisibly via ::before to
   cover the entire card so the whole surface is clickable. Badges
   inside .card-body sit above the invisible overlay via z-index and
   stay independently tappable. */
.app-card .card-link {
  color: inherit;
  text-decoration: none;
}

.app-card .card-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.app-card .appstore-links {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  gap: 8px;
}

/* Smaller badge size inside cards so two badges fit side by side. */
.app-card .appstore-links img {
  height: 36px;
}

.app-card .card-body p {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.app-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
}

/* ── App Store Buttons ── */

.appstore-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.appstore-link {
  display: inline-block;
}

.appstore-link img {
  height: 44px;
  width: auto;
  display: block;
}

/* ── Coming Soon badge (app detail pages) ── */

.badge-coming-soon-inline {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  margin-top: 20px;
}

/* ── App Page Hero (no banner — sits on the colored page) ── */

.app-hero {
  padding: 60px 0 40px;
}

.app-hero .breadcrumb {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

.app-hero .breadcrumb a {
  color: var(--app-accent);
  text-decoration: none;
}

.app-hero .breadcrumb a:hover {
  text-decoration: underline;
}

.app-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
}

/* Icon + title row in detail page hero */
.app-hero-title {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.app-hero-title h1 {
  margin-bottom: 0;
}

.app-icon-large {
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  filter: drop-shadow(0 14px 28px rgba(0,0,0,0.5))
          drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.app-hero .subtitle {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  line-height: 1.75;
}

.app-hero .platform-tags {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── Screenshot Gallery ── */

.screenshot-gallery {
  padding: 40px 0;
}

.screenshot-gallery h2 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.screenshot-scroll {
  display: flex;
  gap: 36px;
  overflow-x: auto;
  /* Padding gives the drop-shadow filter room to render. With the
     bezel-sized .device-frame containers, the chrome itself is part
     of the layout box and doesn't need vertical breathing room. */
  padding: 12px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.screenshot-scroll::-webkit-scrollbar {
  height: 6px;
}

.screenshot-scroll::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.screenshot-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

.screenshot-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  text-align: center;
}

/* Photographic device frames using a bezel-sized container.
   The container's width and height are computed from a single
   --screen-h CSS variable, scaled by each bezel's bezel:screen ratio.
   The screenshot img is positioned absolutely inside at the screen
   offset, and the bezel webp fills the container via ::after.
   Result: the layout box includes the entire bezel (chrome, dynamic
   island, watch strap), so adjacent items don't overlap and captions
   sit cleanly below the bezel. Per-context selectors set --screen-h. */

.device-frame {
  position: relative;
  display: inline-block;
  /* Force a compositing layer up front so the drop-shadow renders
     consistently — without this, the initial paint had a hard edge
     on the watch bezel shadow that disappeared after the first
     hover-triggered repaint. */
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.4s ease;
  filter: drop-shadow(0 24px 40px rgba(0,0,0,0.55))
          drop-shadow(0 6px 14px rgba(0,0,0,0.4));
}

.device-frame img {
  display: block;
  position: absolute;
}

.device-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* iPhone 17 Pro Max — bezel 1470×3000, screen 1320×2868 at (75,66) */
.device-frame--iphone {
  width:  calc(var(--screen-h) * 1470 / 2868);
  height: calc(var(--screen-h) * 3000 / 2868);
}
.device-frame--iphone img {
  left:    5.102%;  /* 75 / 1470 */
  top:     2.200%;  /* 66 / 3000 */
  width:  89.796%;  /* 1320 / 1470 */
  height: 95.600%;  /* 2868 / 3000 */
  border-radius: 16.69% / 6.76%;
}
.device-frame--iphone::after {
  background-image: url(../images/bezels/iphone.webp);
}

/* iPad Pro 13 — bezel 2300×3000, screen 2064×2752 at (118,124) */
.device-frame--ipad {
  width:  calc(var(--screen-h) * 2300 / 2752);
  height: calc(var(--screen-h) * 3000 / 2752);
}
.device-frame--ipad img {
  left:    5.130%;  /* 118 / 2300 */
  top:     4.133%;  /* 124 / 3000 */
  width:  89.739%;  /* 2064 / 2300 */
  height: 91.733%;  /* 2752 / 3000 */
  border-radius: 2.62% / 2.03%;
}
.device-frame--ipad::after {
  background-image: url(../images/bezels/ipad.webp);
}

/* Apple Watch Ultra 3 — bezel 600×960 (with Milanese Loop strap),
   screen 422×514 at (89,223). The container is taller than the screen
   to include the strap that dangles below. */
.device-frame--watch {
  width:  calc(var(--screen-h) * 600 / 514);
  height: calc(var(--screen-h) * 960 / 514);
}
.device-frame--watch img {
  left:   14.833%;  /* 89 / 600 */
  top:    23.229%;  /* 223 / 960 */
  width:  70.333%;  /* 422 / 600 */
  height: 53.542%;  /* 514 / 960 */
  border-radius: 33.65% / 28.02%;
}
.device-frame--watch::after {
  background-image: url(../images/bezels/watch.webp);
}

/* Per-context screen heights — galleries on detail pages get the
   larger size, homepage card previews get the smaller. */
.screenshot-item .device-frame--iphone { --screen-h: 620px; }
.screenshot-item .device-frame--ipad   { --screen-h: 480px; }
.screenshot-item .device-frame--watch  { --screen-h: 300px; }

.card-preview .device-frame--iphone { --screen-h: 322px; }
.card-preview .device-frame--watch  { --screen-h: 135px; }

/* Mac windows: no photographic bezel — keep the lightweight CSS frame
   so they still look window-like. */
.screenshot-item.mac img,
.screenshot-item img[src*="mac_"] {
  height: 520px;
  width: auto;
  border: 6px solid #1a1a1a;
  border-radius: 14px;
  background: #000;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 24px 50px rgba(0,0,0,0.55),
    0 6px 16px rgba(0,0,0,0.4);
}

.screenshot-caption {
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.screenshot-subcaption {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* ── Features Section ── */

.features {
  padding: 40px 0;
}

.features h2 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--app-accent) 35%, var(--color-border));
}

.feature-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--app-accent);
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ── About / Description Block ── */

.description-block {
  padding: 40px 0;
  max-width: 640px;
}

.description-block h2 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.description-block p {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin-bottom: 16px;
}

/* ── Legal Pages ── */

.legal-content {
  padding: 40px 0 80px;
  max-width: 680px;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.legal-content .effective-date {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 40px;
}

.legal-content h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.legal-content p {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
}

.legal-content ul {
  list-style: disc;
  margin-left: 24px;
  margin-bottom: 14px;
}

.legal-content li {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
  margin-bottom: 4px;
}

.legal-content a {
  color: var(--color-accent);
  text-decoration: none;
}

.legal-content a:hover {
  text-decoration: underline;
}

/* ── Footer ── */

footer {
  padding: 40px 24px;
  text-align: center;
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}

footer .footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

footer .company-info {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
}

footer .company-info a {
  color: var(--color-text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer .company-info a:hover {
  color: var(--color-text);
}

footer .footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

footer .footer-links a {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  text-decoration: none;
}

footer .footer-links a:hover {
  color: var(--color-text);
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .hero {
    padding: 60px 0 50px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .app-hero {
    padding: 40px 0 30px;
  }

  .screenshot-item .device-frame--iphone { --screen-h: 480px; }
  .screenshot-item .device-frame--ipad   { --screen-h: 360px; }
  .screenshot-item .device-frame--watch  { --screen-h: 240px; }

  .screenshot-item.mac img,
  .screenshot-item img[src*="mac_"] {
    height: 360px;
  }

  .card-preview {
    height: 320px;
    padding: 24px 12px 0;
    gap: 30px;
  }

  .card-preview .device-frame--iphone { --screen-h: 270px; }
  .card-preview .device-frame--watch  { --screen-h: 110px; }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  nav .nav-links {
    gap: 16px;
  }
}

/* Very narrow screens (e.g. iPhone SE): drop the watch so the phone
   has room to breathe. */
@media (max-width: 360px) {
  .card-preview .device-frame--watch {
    display: none;
  }
}
