/* ============================================================
   Jam CLI — Marketing Site Stylesheet
   Design: Japanese aesthetics (Ma, Kanso, Shibui)
   Aesthetic: Minimalist, clean, typography-driven
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Variables
   ------------------------------------------------------------ */
:root {
  /* Colors */
  --bg: #fafafa;
  --surface: #fff;
  --text: #111;
  --muted: #555;
  --light: #767676;
  --border: #ddd;
  --accent: #2d7d6f;
  --accent-soft: #e6f2ef;
  --code-bg: #f4f4f4;

  /* Terminal palette */
  --terminal-bg: #0d1117;
  --terminal-text: #e6edf3;
  --terminal-green: #6ab04c;
  --terminal-blue: #7ec8e3;
  --terminal-dim: #666;
  --terminal-yellow: #f0c040;

  /* Layout */
  --max: 720px;
  --max-wide: 960px;

  /* Typography */
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
}

/* ------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  text-decoration: underline;
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  font-weight: 600;
}

code {
  font-family: var(--mono);
}

/* ------------------------------------------------------------
   3. Layout
   ------------------------------------------------------------ */
.wrap {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.wrap--narrow {
  max-width: var(--max);
}

.section {
  padding: 80px 0;
}

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

.section__title {
  text-align: center;
  margin-bottom: 48px;
}

/* ------------------------------------------------------------
   4. Navigation
   ------------------------------------------------------------ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  height: 56px;
  background: transparent;
  transition: background 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.nav--scrolled {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.nav .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.nav__brand {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav__brand:hover {
  text-decoration: none;
}

.nav__links {
  display: flex;
  gap: 24px;
  list-style: none;
  align-items: center;
}

.nav__links a {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.nav__links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav__cta {
  background: var(--accent);
  color: #fff !important;
  padding: 6px 16px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.nav__cta:hover {
  opacity: 0.9;
  text-decoration: none !important;
}

/* ------------------------------------------------------------
   5. Hero
   ------------------------------------------------------------ */
.hero {
  padding: 120px 0 80px;
  text-align: center;
}

.hero__ascii {
  font-family: var(--mono);
  font-size: clamp(0.5rem, 1.5vw, 0.8rem);
  line-height: 1.15;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: 0.02em;
  user-select: none;
  border: none;
  background: none;
  opacity: 0;
  animation: asciiReveal 1s ease-out 0.2s forwards, asciiGlow 2.5s ease-in-out 1.2s forwards;
}

@keyframes asciiReveal {
  0% {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes asciiGlow {
  0% {
    text-shadow: 0 0 0 transparent;
  }
  30% {
    text-shadow: 0 0 20px rgba(45, 125, 111, 0.4), 0 0 40px rgba(45, 125, 111, 0.2);
  }
  100% {
    text-shadow: 0 0 0 transparent;
  }
}

.hero__badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-family: var(--mono);
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.hero h1 {
  margin-bottom: 24px;
}

.hero__sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 12px 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--text);
  color: #fff;
}

.btn--primary:hover {
  background: #333;
}

.btn--secondary {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn--secondary:hover {
  background: var(--accent-soft);
}

.btn--ghost {
  color: var(--muted);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--accent);
}

.hero__privacy {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-top: 32px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ------------------------------------------------------------
   6. Terminal Window
   ------------------------------------------------------------ */
.terminal {
  background: var(--terminal-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: #161b22;
}

.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal__dot--red { background: #ff5f57; }
.terminal__dot--yellow { background: #febc2e; }
.terminal__dot--green { background: #28c840; }

.terminal__title {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--terminal-dim);
  margin-left: 8px;
}

.terminal__body {
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--terminal-text);
  min-height: 180px;
}

/* Terminal color helpers */
.t-green { color: var(--terminal-green); }
.t-blue { color: var(--terminal-blue); }
.t-dim { color: var(--terminal-dim); }
.t-yellow { color: var(--terminal-yellow); }
.t-accent { color: var(--accent); }

/* ------------------------------------------------------------
   7. Terminal Animation — Typewriter
   ------------------------------------------------------------ */
.typewriter .line {
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  width: 0;
}

.terminal.play .typewriter .line {
  opacity: 1;
  animation: typing 0.6s steps(40) forwards;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

/* Staggered line delays */
.terminal.play .typewriter .line-1  { animation-delay: 0s; }
.terminal.play .typewriter .line-2  { animation-delay: 0.6s; }
.terminal.play .typewriter .line-3  { animation-delay: 1.2s; }
.terminal.play .typewriter .line-4  { animation-delay: 1.8s; }
.terminal.play .typewriter .line-5  { animation-delay: 2.4s; }
.terminal.play .typewriter .line-6  { animation-delay: 3.0s; }
.terminal.play .typewriter .line-7  { animation-delay: 3.6s; }
.terminal.play .typewriter .line-8  { animation-delay: 4.2s; }
.terminal.play .typewriter .line-9  { animation-delay: 4.8s; }
.terminal.play .typewriter .line-10 { animation-delay: 5.4s; }

/* Fade-in variant for output lines (no width animation) */
.terminal.play .typewriter .line-fade {
  opacity: 0;
  width: 100%;
  white-space: normal;
  overflow: visible;
  animation: lineFadeIn 0.4s ease forwards;
}

@keyframes lineFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------
   8. Demo Section
   ------------------------------------------------------------ */
.demo-row {
  display: flex;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.demo-row:last-child {
  margin-bottom: 0;
}

.demo-row--reverse {
  flex-direction: row-reverse;
}

.demo__text {
  flex: 1;
}

.demo__text h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.demo__text p {
  color: var(--muted);
  line-height: 1.6;
}

.demo__terminal {
  flex: 1.2;
  min-width: 0;
}

/* ------------------------------------------------------------
   9. Feature Cards
   ------------------------------------------------------------ */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  display: block;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text);
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.feature-card__icon {
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
}

.feature-card__icon svg {
  stroke: var(--text);
  stroke-width: 1.5;
  fill: none;
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ------------------------------------------------------------
   10. Provider Diagram
   ------------------------------------------------------------ */
.providers {
  text-align: center;
  margin: 32px 0;
}

.providers svg {
  max-width: 640px;
  margin: 0 auto;
}

.providers__auto {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 24px;
}

.providers__auto code {
  background: var(--code-bg);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
}

.providers__privacy {
  text-align: center;
  font-size: 0.85rem;
  color: var(--light);
  margin-top: 8px;
}

/* ------------------------------------------------------------
   11. Utility Grid
   ------------------------------------------------------------ */
.utilities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.utility-card {
  display: block;
  text-align: center;
  padding: 20px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  text-decoration: none;
  transition: all 0.15s;
}

.utility-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.utility-card span {
  display: block;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.utility-card small {
  display: block;
  font-size: 0.7rem;
  color: var(--light);
  margin-top: 4px;
}

/* ------------------------------------------------------------
   12. Quick Start
   ------------------------------------------------------------ */
.quickstart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}

.quickstart__step {
  position: relative;
}

.quickstart__num {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.quickstart__step h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.code-block {
  position: relative;
  background: var(--terminal-bg);
  color: var(--terminal-text);
  padding: 12px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-x: auto;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--terminal-dim);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  transition: all 0.15s;
}

.copy-btn:hover {
  border-color: var(--terminal-text);
  color: var(--terminal-text);
}

.copy-btn.copied {
  border-color: var(--terminal-green);
  color: var(--terminal-green);
}

.quickstart__alt {
  font-size: 0.8rem;
  color: var(--light);
  margin-top: 8px;
}

.quickstart__alt code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ------------------------------------------------------------
   13. Footer
   ------------------------------------------------------------ */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer__ascii {
  font-family: var(--mono);
  font-size: 0.4rem;
  line-height: 1.2;
  color: var(--light);
  margin-bottom: 16px;
  user-select: none;
}

.footer__brand {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.footer__links {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer__links a {
  font-size: 0.85rem;
  color: var(--muted);
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--light);
}

/* ------------------------------------------------------------
   14. Fade-in Animations
   ------------------------------------------------------------ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
}

.fade-in.visible {
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered entrance delays */
.fade-in:nth-child(1)  { animation-delay: 0s; }
.fade-in:nth-child(2)  { animation-delay: 0.05s; }
.fade-in:nth-child(3)  { animation-delay: 0.10s; }
.fade-in:nth-child(4)  { animation-delay: 0.15s; }
.fade-in:nth-child(5)  { animation-delay: 0.20s; }
.fade-in:nth-child(6)  { animation-delay: 0.25s; }
.fade-in:nth-child(7)  { animation-delay: 0.30s; }
.fade-in:nth-child(8)  { animation-delay: 0.35s; }
.fade-in:nth-child(9)  { animation-delay: 0.40s; }
.fade-in:nth-child(10) { animation-delay: 0.45s; }
.fade-in:nth-child(11) { animation-delay: 0.50s; }
.fade-in:nth-child(12) { animation-delay: 0.55s; }

/* ------------------------------------------------------------
   15. Features Page — Sidebar Layout
   ------------------------------------------------------------ */
.features-page {
  display: flex;
  min-height: calc(100vh - 56px);
  padding-top: 56px;
}

.sidebar {
  width: 240px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.sidebar__logo {
  font-family: var(--mono);
  font-size: 0.28rem;
  line-height: 1.15;
  color: var(--accent);
  margin-bottom: 16px;
  border: none;
  background: none;
  user-select: none;
}

.sidebar__search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--body);
  font-size: 0.85rem;
  margin-bottom: 16px;
  outline: none;
  background: var(--bg);
}

.sidebar__search:focus {
  border-color: var(--accent);
}

.sidebar__group {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--light);
  margin: 20px 0 8px;
}

.sidebar__link {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 0;
  text-decoration: none;
}

.sidebar__link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Features page main content */
.features-main {
  flex: 1;
  padding: 40px 48px;
  max-width: 760px;
}

.features-main h1 {
  margin-bottom: 32px;
}

.features-main h2 {
  margin: 48px 0 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Command entry */
.cmd {
  margin-bottom: 40px;
}

.cmd h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.cmd > p {
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.cmd pre {
  background: var(--terminal-bg);
  color: var(--terminal-text);
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.8;
  margin-bottom: 12px;
}

.cmd__options {
  font-size: 0.85rem;
  border-collapse: collapse;
  width: 100%;
}

.cmd__options td {
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.cmd__options code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* ------------------------------------------------------------
   16. Responsive — Tablet
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .hero {
    padding: 100px 0 60px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .hero__privacy {
    flex-direction: column;
    gap: 12px;
  }

  .demo-row,
  .demo-row--reverse {
    flex-direction: column;
  }

  .demo__terminal {
    margin-top: 24px;
  }

  .features-page {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .features-main {
    padding: 24px;
  }

  .nav__links {
    gap: 16px;
  }
}

/* ------------------------------------------------------------
   17. Responsive — Mobile
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

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

  .nav__links {
    display: none;
  }
}

/* ------------------------------------------------------------
   18. Reduced Motion
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .typewriter .line {
    width: 100%;
    opacity: 1;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}
