/* ==========================================================================
   MangaJoy Theme — Inspired by Kototap (kototap.com)
   Clean, typographic, tactile Japanese learning & reader design language
   ========================================================================== */

:root {
  /* Light Theme Palette (Default) */
  --ktp-ground: #f1f1ef;
  --ktp-ink: #141517;
  --ktp-body: #3a3b39;
  --ktp-slate: #8a8b87;
  --ktp-card: #ffffff;
  --ktp-tile: #f4f4f2;
  --ktp-divider: #ececea;
  --ktp-on-ink: #ffffff;
  --ktp-blue: #0ea5e9;

  --tier-face: #e0f2fe;
  --tier-ink: #0284c7;
  --tier-fam-face: #dcfce7;
  --tier-fam-ink: #15803d;
  --tier-comf-face: #86efac;
  --tier-comf-ink: #14532d;
  --slate-25: rgba(138, 139, 135, 0.25);

  /* Gradual Spectrum Chip Palette (Light) */
  --chip-c1-bg: #fee2e2;
  --chip-c1-fg: #b91c1c; /* Warm Red/Coral */
  --chip-c2-bg: #ffedd5;
  --chip-c2-fg: #c2410c; /* Amber/Orange */
  --chip-c3-bg: #fef9c3;
  --chip-c3-fg: #a16207; /* Yellow/Gold */
  --chip-c4-bg: #dcfce7;
  --chip-c4-fg: #15803d; /* Emerald Green */
  --chip-c5-bg: #e0f2fe;
  --chip-c5-fg: #0369a1; /* Sky Cyan/Blue */
  --chip-c6-bg: #ede9fe;
  --chip-c6-fg: #6d28d9; /* Violet/Purple */

  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  --device-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
  --focus-ring: var(--ktp-blue);

  --ktp-shell: 68rem;
  --ktp-measure: 42rem;
  --ktp-nav-h: 70px;

  --font-sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-japanese: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ktp-ground: #131312;
    --ktp-ink: #f2f2ef;
    --ktp-body: #cbccc7;
    --ktp-slate: #9a9b96;
    --ktp-card: #20201e;
    --ktp-tile: #181816;
    --ktp-divider: #2a2a28;
    --ktp-on-ink: #141517;
    --ktp-blue: #38bdf8;

    --tier-face: #0c4a6e;
    --tier-ink: #7dd3fc;
    --tier-fam-face: #14532d;
    --tier-fam-ink: #86efac;
    --tier-comf-face: #166534;
    --tier-comf-ink: #bbf7d0;
    --slate-25: rgba(154, 155, 150, 0.25);

    /* Gradual Spectrum Chip Palette (Dark) */
    --chip-c1-bg: #450a0a;
    --chip-c1-fg: #fca5a5;
    --chip-c2-bg: #431407;
    --chip-c2-fg: #fdba74;
    --chip-c3-bg: #422006;
    --chip-c3-fg: #fde047;
    --chip-c4-bg: #052e16;
    --chip-c4-fg: #86efac;
    --chip-c5-bg: #082f49;
    --chip-c5-fg: #7dd3fc;
    --chip-c6-bg: #2e1065;
    --chip-c6-fg: #d8b4fe;

    --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
    --device-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 24px 56px rgba(0, 0, 0, 0.6);
  }
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--ktp-ground);
  color: var(--ktp-ink);
  font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  position: relative;
  line-height: 1.5;
  background-color: var(--ktp-ground);
  color: var(--ktp-body);
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ktp-ground);
  box-shadow: 0 1px 0 var(--ktp-divider);
  padding: 14px 24px;
}

.site-nav-inner {
  max-width: var(--ktp-shell);
  height: 42px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ktp-ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--ktp-ink);
  color: var(--ktp-on-ink);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ktp-ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  color: var(--ktp-slate);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ktp-ink);
}

.button-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  background: var(--ktp-ink);
  color: var(--ktp-on-ink);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.button-pill:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ==========================================================================
   Hero Section (Split Layout: Text Left, Device Mockup Right)
   ========================================================================== */

.hero-section {
  padding: 56px 24px 60px;
  max-width: var(--ktp-shell);
  margin: 0 auto;
  width: 100%;
}

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 650;
  color: var(--ktp-slate);
}

.hero-title {
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ktp-ink);
  text-wrap: balance;
}

.hero-title em {
  font-style: normal;
  color: var(--ktp-blue);
}

.hero-subtitle {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ktp-slate);
  max-width: 44ch;
  margin-top: 4px;
}

/* TestFlight Store Badge */
.store-badges {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.store-badge-testflight {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ktp-ink);
  color: var(--ktp-on-ink);
  border: 1px solid var(--ktp-divider);
  border-radius: 12px;
  padding: 10px 20px;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.store-badge-testflight:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.store-badge-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

.store-badge-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.store-badge-eyebrow {
  font-size: 10.5px;
  color: var(--ktp-slate);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.store-badge-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ktp-on-ink);
}

/* Kototap Interactive Chips Showcase */
.interactive-chips-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Gradual rainbow/spectrum color sequencing for tag chips */
.chip:nth-child(6n + 1), .chip-c1 {
  background: var(--chip-c1-bg);
  color: var(--chip-c1-fg);
}

.chip:nth-child(6n + 2), .chip-c2 {
  background: var(--chip-c2-bg);
  color: var(--chip-c2-fg);
}

.chip:nth-child(6n + 3), .chip-c3 {
  background: var(--chip-c3-bg);
  color: var(--chip-c3-fg);
}

.chip:nth-child(6n + 4), .chip-c4 {
  background: var(--chip-c4-bg);
  color: var(--chip-c4-fg);
}

.chip:nth-child(6n + 5), .chip-c5 {
  background: var(--chip-c5-bg);
  color: var(--chip-c5-fg);
}

.chip:nth-child(6n + 6), .chip-c6 {
  background: var(--chip-c6-bg);
  color: var(--chip-c6-fg);
}

.japanese {
  font-family: var(--font-japanese);
}

/* Device Mockup Frame (Right Column) */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.hero-img {
  width: 100%;
  max-width: 490px;
  height: auto;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.hero-img:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   Feature Showcase (Frameless Alternating Split Rows)
   ========================================================================== */

.features-waterfall {
  padding: 40px 24px 100px;
  max-width: var(--ktp-shell);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.feature-item {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.feature-item-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
}

.feature-item-reverse {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.feature-item-reverse .feature-text-col {
  order: 2;
}

.feature-item-reverse .feature-media-col {
  order: 1;
}

.feature-media-col {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.feature-text-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-heading {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 720;
  color: var(--ktp-ink);
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.feature-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ktp-slate);
}

/* Image container & grid */
.feature-image-wrap {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--ktp-divider);
  background: var(--ktp-tile);
  box-shadow: var(--device-shadow);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

/* For squarish/portrait screenshots (e.g. Yomitan popup) */
.feature-image-wrap-compact {
  max-width: 290px;
}

.feature-image-wrap:hover {
  transform: translateY(-2px);
  border-color: var(--ktp-blue);
}

.feature-image-wrap.highlighted {
  border-color: var(--ktp-blue);
  box-shadow: 0 0 0 3px var(--ktp-blue), var(--device-shadow);
}

.feature-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.feature-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* ==========================================================================
   Image Modal Lightbox
   ========================================================================== */

.image-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(19, 19, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 32px;
}

.image-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.image-modal-content {
  max-width: min(94vw, 1100px);
  max-height: 90vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ktp-divider);
  background: var(--ktp-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  object-fit: contain;
  transform: scale(0.97);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-modal-overlay.active .image-modal-content {
  transform: scale(1);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--ktp-ground);
  border-top: 1px solid var(--ktp-divider);
  padding: 30px 24px 44px;
  margin-top: auto;
}

.site-footer-inner {
  max-width: var(--ktp-shell);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-link {
  color: var(--ktp-slate);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--ktp-ink);
  text-decoration: underline;
}

.footer-copyright {
  color: var(--ktp-slate);
  font-size: 12px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 860px) {
  .hero-split {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero-content {
    align-items: center;
    text-align: center;
  }

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .store-badges,
  .interactive-chips-bar {
    justify-content: center;
  }

  .feature-item-split,
  .feature-item-reverse {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .feature-item-reverse .feature-text-col {
    order: 1;
  }

  .feature-item-reverse .feature-media-col {
    order: 2;
  }
}

@media (max-width: 768px) {
  .site-nav-inner {
    height: auto;
    padding: 6px 0;
  }

  .nav-links {
    display: none;
  }

  .features-waterfall {
    gap: 48px;
    padding: 24px 16px 60px;
  }

  .feature-image-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .site-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
