/* ==========================================================================
   Japanese Widget — Zen & "Ma" (間) Web Design System
   Matches lib/app/theme/app_colors.dart & widget_theme_config.dart
   ========================================================================== */

:root {
  --bg: #F9F8F6;
  --surface: #FFFFFF;
  --surface-muted: #F2EFE9;
  --border: #EBE8E1;
  --text-primary: #1C1C1E;
  --text-secondary: #525256;
  --text-muted: #78787C;

  --matcha: #4A6B53;
  --matcha-soft: #EBF1ED;
  --matcha-ink: #256638;
  --sakura: #D87A80;
  --sakura-soft: #FDF0F1;
  --indigo: #2B4162;
  --indigo-soft: #E8EEF5;

  --shadow-sm: 0 2px 10px rgba(24, 24, 24, 0.04);
  --shadow-md: 0 12px 32px rgba(24, 24, 24, 0.07);
  --shadow-lg: 0 24px 56px rgba(24, 24, 24, 0.11);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-serif: 'Shippori Mincho', 'Noto Serif JP', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1120px;
}

[data-theme="dark"] {
  --bg: #181818;
  --surface: #222224;
  --surface-muted: #2B2B2E;
  --border: #333336;
  --text-primary: #F8F8FA;
  --text-secondary: #C0C0C6;
  --text-muted: #8E8E96;

  --matcha: #7CA887;
  --matcha-soft: rgba(124, 168, 135, 0.14);
  --matcha-ink: #8CD1A4;
  --sakura: #E8949A;
  --sakura-soft: rgba(232, 148, 154, 0.14);
  --indigo: #7E9EC9;
  --indigo-soft: rgba(126, 158, 201, 0.14);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--matcha);
  text-decoration: none;
  transition: opacity 0.2s ease, color 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.pill-btn:hover {
  background: var(--surface-muted);
}

.pill-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.hero-meta svg {
  width: 15px;
  height: 15px;
  color: var(--matcha);
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  padding: 8px 10px;
}

/* ==========================================================================
   Buttons & Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--matcha-soft);
  color: var(--matcha-ink);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 1;
}

.btn-primary {
  background: var(--matcha);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(74, 107, 83, 0.24);
}

[data-theme="dark"] .btn-primary {
  color: #111914;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-muted);
}

/* ==========================================================================
   Hero & Interactive Widget Preview
   ========================================================================== */

.hero {
  padding: 72px 0 64px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 48px;
  align-items: center;
}

.hero-kanji-watermark {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 14px 0 18px;
  font-weight: 700;
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 0 28px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Interactive Homescreen Phone Mockup */
.studio-showcase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.studio-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.studio-hint {
  font-size: 0.78rem;
  color: var(--matcha);
  font-weight: 600;
}

.widget-canvas {
  border-radius: 22px;
  padding: 20px;
  border: 1.5px solid #EBE8E1;
  background-color: #F9F8F6;
  color: #1C1C1E;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.widget-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.widget-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #EDE9E1;
  color: #3B5E44;
  transition: all 0.3s ease;
}

.widget-deck-counter {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.72;
}

.widget-word-area {
  text-align: center;
  padding: 8px 4px 14px;
}

.widget-kana {
  font-size: 0.92rem;
  font-weight: 600;
  color: #3B5E44;
  min-height: 22px;
  transition: opacity 0.2s ease, color 0.3s ease;
}

.widget-kanji {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 4px 0 6px;
}

.widget-meaning {
  font-size: 0.98rem;
  font-weight: 600;
  color: #4C4C50;
  min-height: 24px;
  transition: opacity 0.2s ease, color 0.3s ease;
}

.widget-example {
  margin-top: 8px;
  font-size: 0.78rem;
  opacity: 0.78;
  min-height: 20px;
}

.widget-hidden {
  filter: blur(5px);
  opacity: 0.32;
  user-select: none;
}

.widget-actions-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.widget-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #EDE9E1;
  color: #3B5E44;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.25s ease, color 0.25s ease;
}

.widget-action-btn:hover {
  transform: translateY(-1px);
}

.widget-action-btn:active {
  transform: scale(0.97);
}

.widget-action-btn svg {
  width: 16px;
  height: 16px;
}

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.swatch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.swatch-btn.active {
  border-color: var(--matcha);
  color: var(--text-primary);
  background: var(--matcha-soft);
}

.swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Screenshots Showcase & Lightbox
   ========================================================================== */

.screenshots-rail {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 6px 4px 18px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.screenshots-rail::-webkit-scrollbar {
  height: 8px;
}

.screenshots-rail::-webkit-scrollbar-track {
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
}

.screenshots-rail::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}

.shot-card {
  flex: 0 0 248px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.shot-frame {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  cursor: zoom-in;
  aspect-ratio: 430 / 900;
}

.shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shot-caption h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
  line-height: 1.3;
}

.shot-caption p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(18, 18, 20, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-inner img {
  max-height: 82vh;
  width: auto;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1C1C1E;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
}

.lightbox-caption {
  color: #F8F8FA;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: 68px 0;
}

.section-muted {
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  max-width: 660px;
  margin-bottom: 40px;
}

.section-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--matcha);
  margin-bottom: 8px;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1.25;
  margin: 0 0 12px;
}

.section-header p {
  margin: 0;
  color: var(--text-secondary);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--matcha-soft);
  color: var(--matcha);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card h3 {
  font-size: 1.06rem;
  margin: 0 0 8px;
  line-height: 1.35;
}

.card p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-secondary);
}

/* Deck Progression Grid */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.deck-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.deck-jp {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
}

.deck-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.deck-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.deck-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--matcha-soft);
  color: var(--matcha-ink);
}

.deck-tag.gated {
  background: var(--sakura-soft);
  color: var(--sakura);
}

/* FAQ Static Open Cards */
.faq-list {
  display: grid;
  gap: 14px;
  max-width: 820px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text-primary);
}

.faq-body {
  color: var(--text-secondary);
  font-size: 0.94rem;
  margin: 0;
}

/* ==========================================================================
   Legal Pages (Privacy Policy & Terms of Service)
   ========================================================================== */

.legal-hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
}

.legal-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.2vw, 2.5rem);
  margin: 12px 0 10px;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  padding: 44px 0 72px;
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.legal-toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legal-toc a {
  display: block;
  padding: 6px 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.legal-toc a:hover {
  color: var(--matcha);
}

.legal-content section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 28px;
  margin-bottom: 20px;
  scroll-margin-top: 88px;
}

.legal-content h2 {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  margin: 0 0 12px;
}

.legal-content p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.legal-content p:last-child {
  margin-bottom: 0;
}

.legal-content ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.legal-content li {
  margin-bottom: 8px;
}

.callout {
  background: var(--matcha-soft);
  border-left: 4px solid var(--matcha);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  font-size: 0.92rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ==========================================================================
   CTA Banner & Footer
   ========================================================================== */

.cta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-md);
}

.cta-box h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin: 0 0 8px;
}

.cta-box p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 540px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .deck-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .legal-layout {
    grid-template-columns: 1fr;
  }

  .legal-toc {
    position: static;
  }
}

@media (max-width: 680px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    gap: 14px;
  }

  .nav-links.open {
    display: flex;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .card-grid,
  .deck-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 44px 0 48px;
  }

  .cta-box {
    padding: 28px 22px;
  }

  .legal-content section {
    padding: 20px 18px;
  }
}
