/* ============================================================
   KimaraCode - Product/app landing page (hero, screenshots, lightbox)
   Layers on tokens.css + layout.css.
   .kc-product-top and .kc-lang here are reused as-is by the apps index,
   release notes, and legal pages (bilingual "back + language switch" bar).
   ============================================================ */

.kc-detail-section { margin: 0 0 40px; }
.kc-detail-section h3 { margin: 0 0 14px; }
.kc-detail-section p { font-size: 15px; color: var(--fg1); line-height: var(--leading-body); margin: 0 0 14px; max-width: 580px; }

/* ============================================================
   Product detail (app landing pattern)
   ============================================================ */
.kc-product { padding: 40px 0 80px; }
.kc-product-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.kc-product-hero { max-width: 560px; margin: 24px auto 8px; }
.kc-product-hero .eyebrow { display: block; margin-bottom: 16px; }
.kc-product-hero h1 { font-size: var(--t-3xl); margin: 0 0 18px; letter-spacing: var(--tracking-tight); }
.kc-app-id { display: flex; align-items: center; gap: 18px; margin: 0 0 18px; }
.kc-app-id h1 { margin: 0; min-width: 0; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.kc-app-icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  display: block;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.08);
}
.kc-app-icon-dark { display: none; }
[data-theme="dark"] .kc-app-icon-light { display: none; }
[data-theme="dark"] .kc-app-icon-dark { display: block; }
[data-theme="dark"] .kc-app-icon {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.25),
    0 6px 18px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kc-app-icon-light { display: none; }
  :root:not([data-theme="light"]) .kc-app-icon-dark { display: block; }
  :root:not([data-theme="light"]) .kc-app-icon {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.07),
      0 1px 2px rgba(0, 0, 0, 0.25),
      0 6px 18px rgba(0, 0, 0, 0.35);
  }
}
@media (max-width: 600px) {
  .kc-app-icon { width: 56px; height: 56px; border-radius: 12px; }
  .kc-product-hero .kc-app-id { gap: 14px; }
}
.kc-product-headline { font-size: var(--t-xl); font-weight: 600; letter-spacing: var(--tracking-tight); color: var(--fg1); margin: 0 0 14px; line-height: var(--leading-snug); }
.kc-product-hero .lead { font-size: var(--t-md); color: var(--fg2); margin: 0 0 28px; max-width: 520px; }

.kc-cta-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-top: 26px; }
.kc-cta-stack { min-width: 0; }
.kc-cta-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.kc-btn-soon { background: transparent; color: var(--fg3); border: 1px solid var(--rule); cursor: default; }
.kc-btn-soon:hover { opacity: 1; transform: none; }
.kc-cta-note { font-family: var(--font-mono); font-size: 12px; color: var(--fg3); margin: 14px 0 0; }

/* Language toggle */
.kc-lang { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-1); overflow: hidden; }
.kc-lang a {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  background: transparent;
  color: var(--fg3);
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease-quiet), color var(--dur-2) var(--ease-quiet);
}
.kc-lang a + a { border-left: 1px solid var(--rule); }
.kc-lang a.active { background: var(--fg1); color: var(--bg); }
.kc-lang a:hover { text-decoration: none; }

/* QR - only useful on non-touch / desktop where a visitor scans with
   their phone. On mobile they are already on the device that has the
   App Store, so the QR is clutter. Hide ≤ 760px. */
.kc-qr-wrap { display: flex; align-items: center; gap: 12px; }
/* The QR modules are pure black on a transparent background. That reads fine
   on the cream light theme, so we keep it transparent there. In dark mode the
   near-black page background would swallow it, so --qr-plate becomes white to
   restore the dark-on-light contrast scanners need. */
.kc-qr-img { width: 92px; height: 92px; display: block; border: 1px solid var(--rule); border-radius: var(--r-1); padding: 7px; background: var(--qr-plate, transparent); flex: none; }
.kc-qr-cap { font-family: var(--font-mono); font-size: 11px; color: var(--fg3); line-height: 1.4; max-width: 90px; }
@media (max-width: 760px) { .kc-qr-wrap { display: none; } }

/* Three phone screenshots row */
.kc-shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 20px 0 8px;
  margin: 8px 0 56px;
  justify-items: center;
  align-items: start;
}
.kc-shots a {
  display: block;
  width: 100%;
  max-width: 232px;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}
.kc-shots figure { margin: 0; width: 100%; max-width: 232px; }
.kc-shot-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 26px;
  filter: drop-shadow(0 2px 4px rgba(17,17,17,0.10)) drop-shadow(0 16px 28px rgba(17,17,17,0.18));
}
.kc-shot-cap { text-align: center; font-size: 12px; color: var(--fg3); margin-top: 12px; font-family: var(--font-mono); }
@media (max-width: 760px) {
  .kc-shots { grid-template-columns: 1fr; gap: 36px; max-width: 280px; margin-left: auto; margin-right: auto; }
}

/* Product body */
.kc-product-body { max-width: 600px; margin: 8px auto 0; }
.kc-body-lead { font-size: var(--t-md); color: var(--fg1); line-height: var(--leading-body); margin: 0; }

.kc-caps { list-style: none; margin: 0; padding: 0; }
.kc-caps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 14.5px;
  color: var(--fg2);
  line-height: 1.5;
}
.kc-caps li:last-child { border-bottom: 0; }
.kc-caps .kc-chk { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--intent-positive); }
.kc-caps strong { color: var(--fg1); font-weight: 600; }

.kc-pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 24px;
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  padding: 28px;
  background: var(--bg-elev);
}
.kc-pillar strong { display: block; margin-bottom: 4px; color: var(--fg1); font-size: 14.5px; }
.kc-pillar span { font-size: 13.5px; color: var(--fg2); line-height: 1.5; }
@media (max-width: 520px) { .kc-pillars { grid-template-columns: 1fr; } }

.kc-final-cta { text-align: center; padding-top: 8px; }
.kc-final-cta p { font-size: var(--t-md); color: var(--fg1); margin: 0 0 16px; }
.kc-final-cta .kc-btn { display: inline-flex; }

/* Sticky App Store CTA - only appears on the product page below 760px,
   centered + auto-width, and only when neither the top hero CTA nor the
   final CTA is in view (so it never sits on top of either visible
   button). JS adds .is-hidden via IntersectionObserver. */
.kc-sticky-cta { display: none; }
@media (max-width: 760px) {
  .kc-sticky-cta {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 60;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 50px;
    min-width: 280px;
    padding: 0 36px;
    background: rgba(107, 107, 107, 0.92);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    color: #fff;
    font: 500 14.5px/1 var(--font-sans);
    text-decoration: none;
    border-radius: var(--r-1);
    box-shadow: 0 18px 36px -16px rgba(17, 17, 17, 0.28), 0 4px 12px -6px rgba(17, 17, 17, 0.16);
    transition: opacity 220ms var(--ease-quiet), transform 220ms var(--ease-quiet);
    will-change: opacity, transform;
  }
  [data-theme="dark"] .kc-sticky-cta { background: rgba(0, 0, 0, 0.55); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .kc-sticky-cta { background: rgba(0, 0, 0, 0.55); }
  }
  .kc-sticky-cta:hover { text-decoration: none; }
  .kc-sticky-cta .kc-sticky-icon { width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
  .kc-sticky-cta.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(80px);
    pointer-events: none;
  }
  .kc-product { padding-bottom: 96px; }
}

/* ============================================================
   Lightbox (preserved from existing site)
   ============================================================ */
.lightbox {
  /* Explicit (rather than relying on the UA default) so the fixed-style
     controls below can anchor to this box as position: absolute instead of
     position: fixed - fixed-inside-a-modal-<dialog> is inconsistent enough
     across mobile browsers (notably iOS Safari) that a tap can silently
     land on nothing. Absolute-relative-to-an-explicit-ancestor doesn't have
     that ambiguity. */
  position: fixed;
  inset: 0;
  border: none;
  /* Horizontal padding reserves room for .lightbox-nav so it never overlaps
     the image itself - computed from the same --lightbox-nav-* custom
     properties that size and place the buttons below, so the two can't
     drift out of sync. 6vw already clears it on wide viewports; the max()
     only kicks in once a narrow phone viewport would otherwise let the
     nav buttons sit on top of the image edge. */
  --lightbox-nav-size: 44px;
  --lightbox-nav-gap: 16px;
  padding: 6vh max(6vw, calc(var(--lightbox-nav-size) + var(--lightbox-nav-gap) + 16px));
  background: transparent;
  /* 100% of the viewport, not 100vw: vw includes the scrollbar gutter and
     overflows horizontally on desktop. dvh tracks the iOS toolbar. */
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: contain;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop {
  background: rgba(20, 18, 14, 0.5);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
/* Clipping (border-radius/overflow) and the shadow live on this wrapper,
   not the <img> - filter: drop-shadow computed from a border-radius-clipped
   image's alpha channel visibly darkens the rounded corners at this blur
   size (64px) and offset (24px). box-shadow on a separately-clipped wrapper
   doesn't have that failure mode: it's computed from the box geometry, not
   the image content. */
.lightbox-frame {
  display: flex;
  max-width: min(100%, 420px);
  max-height: 100%;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  /* Reserve horizontal gestures here for the drag-to-peek JS; vertical pan
     (e.g. an accidental scroll attempt) still works natively. */
  touch-action: pan-y;
}
.lightbox-frame[hidden] { display: none; }
/* Positioned and sized to match .lightbox-frame's own measured rect at
   drag-start, via JS - see lightbox.js. Only ever visible mid-gesture. */
.lightbox-peek {
  position: fixed;
  z-index: 1;
}
.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.lightbox-peek img {
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
}
.lightbox-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: #111;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox-close:hover, .lightbox-close:focus-visible { background: #fff; }
.lightbox-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: var(--lightbox-nav-size);
  height: var(--lightbox-nav-size);
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  color: #111;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox-nav:hover, .lightbox-nav:focus-visible { background: #fff; }
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: var(--lightbox-nav-gap); }
.lightbox-next { right: var(--lightbox-nav-gap); }
.lightbox-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-hint:empty { display: none; }
@media (max-width: 600px) {
  .lightbox { --lightbox-nav-size: 38px; --lightbox-nav-gap: 8px; }
  .lightbox-nav { font-size: 22px; }
}
@media (prefers-reduced-motion: no-preference) {
  /* :not(.lightbox-peek) - the peek clone shares this class for its box
     styling, but must never replay this pop-in itself each time a drag
     reveals it. */
  .lightbox[open] .lightbox-frame:not(.lightbox-peek) { animation: lightbox-zoom 0.25s ease-out; }
}
@keyframes lightbox-zoom {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
