/*
 * Application styles for Kyo No Tegami
 * Palette provided in HEX and HSL; we expose CSS variables for use throughout.
 */

:root {
  /* CSS HEX */
  --dark-purple: #36151eff;
  --english-violet: #593f62ff;
  --chinese-violet: #7b6d8dff;
  --cadet-gray: #8499b1ff;
  --columbia-blue: #a5c4d4ff;

  /* CSS HSL (for optional use) */
  --dark-purple-hsl: 344 44% 15%;
  --english-violet-hsl: 285 22% 32%;
  --chinese-violet-hsl: 266 13% 49%;
  --cadet-gray-hsl: 212 22% 61%;
  --columbia-blue-hsl: 200 35% 74%;
}

:root {
  /* semantic colors for the main CTA */
  --cta-bg:         var(--english-violet);
  --cta-bg-hover:   var(--chinese-violet);
  --cta-bg-active:  var(--dark-purple);
  --cta-text:       #ffffff;                 /* could be var(--columbia-blue) if you prefer */
  --cta-focus-ring: var(--columbia-blue);
}

.hero-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 3rem 0;
}


/* Base button style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 999px;                   /* pill */
  padding: 0.7rem 1.6rem;

  font: inherit;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  cursor: pointer;
  text-decoration: none;

  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background 0.2s ease-out,
    filter 0.2s ease-out;

  outline: none;
}

/* Size modifier (optional) */
.btn--large {
  padding: 0.95rem 2.4rem;
  font-size: 1.05rem;
}

/* Primary variant using your palette */
.btn--primary {
  background: linear-gradient(135deg, var(--cta-bg), var(--cta-bg-hover));
  color: var(--cta-text);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.25),
    0 6px 6px rgba(0, 0, 0, 0.18);
}

/* Hover / focus */
.btn--primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.32),
    0 10px 12px rgba(0, 0, 0, 0.25);
  filter: brightness(1.03);
}

.btn--primary:focus-visible {
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 5px var(--cta-focus-ring),
    0 14px 24px rgba(0, 0, 0, 0.25);
}

/* Active/pressed */
.btn--primary:active {
  transform: translateY(1px) scale(0.98);
  background: linear-gradient(135deg, var(--cta-bg-active), var(--cta-bg));
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Optional: subtle hero pulse for extra temptation */
.hero-cta .btn--primary {
  animation: cta-pulse 2.4s ease-in-out infinite;
}

@keyframes cta-pulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 10px 20px rgba(0, 0, 0, 0.25),
      0 6px 6px rgba(0, 0, 0, 0.18);
  }
  50% {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.33),
      0 12px 14px rgba(0, 0, 0, 0.26);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 10px 20px rgba(0, 0, 0, 0.25),
      0 6px 6px rgba(0, 0, 0, 0.18);
  }
}


/* Base reset-ish */
* { box-sizing: border-box; }
html { font-size: 16px; }
body.theme-default {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #1f2937; /* slate-800 */
  background-color: #fff;
}

a { color: var(--english-violet); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* Header */
.site-header {
  background: var(--dark-purple);
  color: white;
}
.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}
.logo { font-size: 1.25rem; margin: 0; }
.logo a { color: white; text-decoration: none; }

/* Header Notify Form */
.header-notify-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.header-notify-input {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 999px;
  outline: none;
  width: 280px;
}

.header-notify-input:focus {
  box-shadow: 0 0 0 2px var(--columbia-blue);
}

.header-notify-btn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .header-notify-form {
    display: none;
  }
}

.main-nav ul { list-style: none; display: flex; gap: 1rem; padding: 0; margin: 0; }
.main-nav a { color: #e5e7eb; padding: 0.25rem 0.5rem; border-radius: 0.375rem; }
.main-nav a:hover { background-color: rgba(255,255,255,0.12); text-decoration: none; }
.main-nav a.active { background-color: var(--english-violet); color: white; }

/* Layout: two columns */
.two-col {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  padding-block: 2rem;
}
.content { min-width: 0; }
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-self: start;
}

.sidebar-image {
  background: color-mix(in hsl, var(--columbia-blue), white 70%);
  border: 1px solid color-mix(in hsl, var(--cadet-gray), white 60%);
  border-radius: 0.5rem;
  overflow: hidden;
}

.sidebar-image img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(100%);
}

.sidebar {
  background: color-mix(in hsl, var(--columbia-blue), white 70%);
  border: 1px solid color-mix(in hsl, var(--cadet-gray), white 60%);
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-align: center;
}

.sidebar-section {
  padding-bottom: 7.5rem;
  margin-bottom: 7.5rem;
  border-bottom: 1px solid color-mix(in hsl, var(--cadet-gray), white 50%);
}

.sidebar-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.sidebar h2 {
  font-size: 1.1rem;
  color: var(--dark-purple);
  margin: 0 0 0.5rem;
}

.sidebar h3 {
  font-size: 0.95rem;
  color: var(--english-violet);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.sidebar p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #4b5563;
  margin: 0;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* Hero and features */
.hero {
  background: linear-gradient(135deg, var(--columbia-blue), var(--cadet-gray));
  border: 1px solid color-mix(in hsl, var(--cadet-gray), white 50%);
  border-radius: 0.75rem;
  padding: 1.25rem;
}
.hero h2 { margin-top: 0; color: var(--dark-purple); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.feature { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1rem; }
.feature h3 { margin-top: 0; color: var(--english-violet); }

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  padding: 1rem 0 2rem;
  margin-top: 2rem;
}
.site-footer small { opacity: 0.9; }

/* Flash messages */
.flash-stack {
  margin: 1rem 0 0.5rem;
  display: grid;
  gap: 0.75rem;
}

.flash {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Brand variants */
.flash--notice {
  background: color-mix(in hsl, var(--columbia-blue), white 80%);
  border-color: color-mix(in hsl, var(--cadet-gray), white 55%);
  color: color-mix(in hsl, var(--dark-purple), black 20%);
}

.flash--alert,
.flash--error {
  background: color-mix(in hsl, var(--english-violet), white 85%);
  border-color: color-mix(in hsl, var(--dark-purple), white 40%);
  color: color-mix(in hsl, var(--dark-purple), black 5%);
}

.flash--success {
  background: color-mix(in hsl, var(--cadet-gray), white 80%);
  border-color: color-mix(in hsl, var(--cadet-gray), white 40%);
  color: color-mix(in hsl, var(--english-violet), black 20%);
}

/* Ensure any accidental flash inside the grid spans full width */
.two-col > .flash,
.two-col > .flash-stack { grid-column: 1 / -1; }


/* Animated logo: Romaji → Hiragana → Kanji over 60s, one word at a time */
.logo-anim {
  display: inline-flex;
  gap: 0.4ch;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.logo-anim .word {
  display: grid;
  align-items: center;
  position: relative;
}
.logo-anim .layer {
  grid-area: 1 / 1;
  opacity: 0;
}

/* Per-word delays to sequence words across a total of 60s */
.logo-anim .w1 { --delay: 0s; }
.logo-anim .w2 { --delay: 2s; }
.logo-anim .w3 { --delay: 4s; }

/* Keyframe phases within a single word's 20s window */
@keyframes knt-romaji {
  0%, 39% { opacity: 1; }
  40%, 100% { opacity: 0; }
}
@keyframes knt-hira {
  0%, 49% { opacity: 0; }
  50%, 84% { opacity: 1; }
  85%, 100% { opacity: 0; }
}
@keyframes knt-kanji {
  0%, 94% { opacity: 0; }
  95%, 100% { opacity: 1; }
}

/* Apply animations to each layer for 20s, delayed per word; do not repeat */
.logo-anim .romaji {
  animation: knt-romaji 20s linear forwards;
  animation-delay: var(--delay, 0s);
}
.logo-anim .hira {
  animation: knt-hira 20s linear forwards;
  animation-delay: var(--delay, 0s);
}
.logo-anim .kanji {
  animation: knt-kanji 20s linear forwards;
  animation-delay: var(--delay, 0s);
}

/* Respect reduced motion preferences: show the final Kanji state immediately */
@media (prefers-reduced-motion: reduce) {
  .logo-anim .layer { animation: none !important; }
  .logo-anim .romaji, .logo-anim .hira { opacity: 0 !important; }
  .logo-anim .kanji { opacity: 1 !important; }
}

/* ============================================
   HOME PAGE - Kyo no Tegami
   ============================================ */

/* Hero Main Section */
.hero-main {
  background: linear-gradient(145deg, var(--dark-purple) 0%, var(--english-violet) 60%, var(--chinese-violet) 100%);
  color: #fff;
  padding: 3rem 1.5rem 2.5rem;
  border-radius: 1rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 
    0 20px 40px rgba(54, 21, 30, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.hero-title {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.hero-subtitle {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  opacity: 0.85;
  margin: 0 0 2rem;
  letter-spacing: 0.15em;
}

/* Philosophy Chain */
.philosophy-chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}

.chain-link {
  background: rgba(255,255,255,0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.chain-link:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.chain-link.highlight {
  background: var(--columbia-blue);
  color: var(--dark-purple);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(165, 196, 212, 0.4);
}

.chain-arrow {
  color: var(--columbia-blue);
  font-weight: 300;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .philosophy-chain {
    flex-direction: column;
    align-items: center;
  }

  .chain-arrow::before {
    content: '↓';
  }
  .chain-arrow {
    visibility: hidden;
    position: relative;
  }
  .chain-arrow::before {
    visibility: visible;
    position: absolute;
    left: 0;
  }
}

/* Rhythm Section */
.rhythm-section {
  padding: 2.5rem 1rem;
  background: linear-gradient(180deg, transparent 0%, rgba(165, 196, 212, 0.15) 100%);
}

.rhythm-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem 3rem;
}

.rhythm-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.rhythm-label {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 600;
  color: var(--english-violet);
  transition: color 0.3s ease;
}

.rhythm-item:hover .rhythm-label {
  color: var(--dark-purple);
}

.rhythm-connector {
  font-size: 1rem;
  color: var(--cadet-gray);
  font-style: italic;
}

/* Journey Section */
.journey-section {
  text-align: center;
  padding: 3rem 1rem;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(123, 109, 141, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(132, 153, 177, 0.1) 0%, transparent 50%);
}

.journey-words {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.journey-word {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 700;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.journey-word:hover {
  transform: scale(1.1) translateY(-4px);
}

.journey-word.learn {
  color: var(--chinese-violet);
}

.journey-word.grow {
  color: var(--english-violet);
}

.journey-word.master {
  color: var(--dark-purple);
}

.journey-tagline {
  font-size: 1.25rem;
  color: var(--cadet-gray);
  margin: 0;
  letter-spacing: 0.05em;
}

/* Level Up Section */
.level-up-section {
  background: linear-gradient(135deg, var(--columbia-blue) 0%, var(--cadet-gray) 100%);
  border-radius: 1rem;
  padding: 2.5rem 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 10px 30px rgba(132, 153, 177, 0.3);
}

.level-up-title {
  text-align: center;
  color: var(--dark-purple);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  margin: 0 0 2rem;
  font-weight: 600;
}

.skill-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  max-width: 700px;
  margin: 0 auto;
}

.skill-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.skill-name {
  font-weight: 600;
  color: var(--dark-purple);
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.bar-chart {
  width: 100%;
  max-width: 200px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(54, 21, 30, 0.2));
}

/* Bar animation */
.bar {
  transform-origin: bottom center;
  animation: bar-grow 1.5s ease-out forwards;
  opacity: 0;
}

.bar-1 { animation-delay: 0.1s; }
.bar-2 { animation-delay: 0.25s; }
.bar-3 { animation-delay: 0.4s; }
.bar-4 { animation-delay: 0.55s; }
.bar-5 { animation-delay: 0.7s; }

@keyframes bar-grow {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* How it Works Section */
.how-it-works {
  background: #fff;
  border: 1px solid color-mix(in hsl, var(--cadet-gray), white 60%);
  border-radius: 1rem;
  padding: 2rem 2.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 20px rgba(54, 21, 30, 0.08);
}

.how-it-works h2 {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  font-size: 1.75rem;
  color: var(--dark-purple);
  margin: 0 0 1.5rem;
  text-align: center;
}

.how-it-works .step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.how-it-works .step:last-child {
  margin-bottom: 0;
}

.step-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--english-violet);
  margin-top: 0.1rem;
}

.how-it-works p {
  margin: 0;
  line-height: 1.75;
  color: #374151;
}

.how-it-works strong {
  color: var(--english-violet);
}

/* CTA Section */
.cta-section {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

/* Pillars Row */
.pillars-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 2.5rem 0;
  flex-wrap: wrap;
}

.pillar-box {
  background: linear-gradient(145deg, var(--english-violet), var(--dark-purple));
  border-radius: 0.75rem;
  padding: 1.75rem 1.5rem;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 
    0 8px 20px rgba(54, 21, 30, 0.25),
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pillar-box:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 12px 28px rgba(54, 21, 30, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.pillar-title {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.pillar-subtitle {
  font-size: 0.85rem;
  color: var(--columbia-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.release-note {
  font-size: 0.9rem;
  color: var(--cadet-gray);
  font-style: italic;
  margin: 1.5rem 0 0;
}

/* Notify Section */
.notify-section {
  padding: 2.5rem 1rem;
  text-align: center;
}

.notify-form {
  max-width: 450px;
  margin: 0 auto;
}

.notify-input-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.notify-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid color-mix(in hsl, var(--cadet-gray), white 40%);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.notify-input:focus {
  border-color: var(--english-violet);
  box-shadow: 0 0 0 3px color-mix(in hsl, var(--english-violet), white 70%);
}

.notify-input::placeholder {
  color: var(--cadet-gray);
}

.notify-btn {
  white-space: nowrap;
}

.cta-section .hero-cta {
  margin: 0 0 1rem;
}

.cta-section .preferences-link {
  margin-top: 1rem;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bar {
    animation: none !important;
    opacity: 1 !important;
    transform: scaleY(1) !important;
  }
  .chain-link,
  .rhythm-label,
  .journey-word {
    transition: none !important;
  }
}
