/* ==========================================================================
   Folktales Landing Page — styles.css
   Design: Light + clean SaaS (Stripe / Notion / Linear aesthetic)
   Approach: Mobile-first, vanilla CSS, BEM naming
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens (Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-bg:             #ffffff;
  --color-bg-alt:         #f8fafc;   /* slate-50  */
  --color-text:           #1e293b;   /* slate-800 */
  --color-text-secondary: #64748b;   /* slate-500 */
  --color-text-muted:     #94a3b8;   /* slate-400 */
  --color-text-heading:   #0f172a;   /* slate-900 */
  --color-text-label:     #334155;   /* slate-700 */

  --color-primary:        #4f46e5;   /* indigo-600 */
  --color-primary-hover:  #4338ca;   /* indigo-700 */
  --color-primary-light:  #eef2ff;   /* indigo-50  */

  --color-border:         #e2e8f0;   /* slate-200 */
  --color-border-light:   #f1f5f9;   /* slate-100 */
  --color-border-mid:     #cbd5e1;   /* slate-300 */

  --color-success:        #10b981;   /* emerald-500 */
  --color-success-light:  #d1fae5;   /* emerald-100 */
  --color-success-bg:     #ecfdf5;   /* emerald-50  */
  --color-success-text:   #047857;   /* emerald-700 */
  --color-success-border: #a7f3d0;   /* emerald-200 */

  --color-error:          #ef4444;   /* red-500 */
  --color-error-light:    #fee2e2;   /* red-100   — unused but reserved */
  --color-error-bg:       #fef2f2;   /* red-50  */
  --color-error-text:     #dc2626;   /* red-600 */
  --color-error-border:   #fecaca;   /* red-200 */

  --color-amber-bg:       #fef3c7;   /* amber-100 */
  --color-amber-text:     #b45309;   /* amber-700 */

  /* Typography */
  --font-family:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --max-width:            1120px;
  --nav-height:           64px;

  /* Radii */
  --radius-card:          12px;
  --radius-input:         8px;
  --radius-btn:           8px;
  --radius-pill:          99px;

  /* Shadows */
  --shadow-card:          0 1px 3px rgba(0, 0, 0, 0.1),
                          0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-card-hover:    0 4px 6px rgba(0, 0, 0, 0.1),
                          0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-focus:         0 0 0 3px rgba(79, 70, 229, 0.1);

  /* Transitions */
  --transition-fast:      0.2s ease;
}


/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}


/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container--narrow {
  max-width: 640px;
}


/* --------------------------------------------------------------------------
   Nav (.nav)
   -------------------------------------------------------------------------- */
.nav-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition-fast);
}

/* Scroll effect — class toggled by script.js */
.nav--scrolled {
  box-shadow: var(--shadow-card);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 16px 24px;
}

.nav__logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-primary);
  text-decoration: none;
}

.nav__cta {
  display: inline-block;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              transform var(--transition-fast);
}

.nav__cta:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}


/* --------------------------------------------------------------------------
   Sections — shared
   -------------------------------------------------------------------------- */
.section,
section {
  padding: 80px 0;
}

section:nth-child(even) {
  background-color: var(--color-bg-alt);
}

.section--alt {
  background-color: var(--color-bg-alt);
}

.section__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  text-align: center;
}

.section__subtitle {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
  line-height: 1.6;
}

@media (min-width: 768px) {
  section {
    padding: 96px 0;
  }

  .section__title {
    font-size: 2.5rem;
  }
}


/* --------------------------------------------------------------------------
   Grid System
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
}

.grid--2,
.grid--3 {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (min-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}


/* --------------------------------------------------------------------------
   Cards — shared
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 32px;
  transition: box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

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

.card__icon {
  font-size: 2rem;
  margin-bottom: 16px;
  line-height: 1;
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.card__desc {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}


/* --------------------------------------------------------------------------
   Buttons — shared
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              transform var(--transition-fast),
              border-color var(--transition-fast);
}

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

.btn--primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn--secondary {
  background-color: var(--color-bg);
  color: var(--color-text-label);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  background-color: var(--color-bg-alt);
  border-color: var(--color-border-mid);
}

.btn--lg {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn--block {
  display: block;
  width: 100%;
  text-align: center;
}

.btn--outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn--outline:hover {
  background-color: var(--color-primary-light);
}


/* --------------------------------------------------------------------------
   Hero (.hero)
   -------------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding-top: 120px;
}

.hero__title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text-heading);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.hero__subtitle {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 24px auto 32px;
  line-height: 1.5;
}

.hero__cta {
  display: inline-block;
  padding: 16px 32px;
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: #ffffff;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              transform var(--transition-fast);
}

.hero__cta:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.hero__trust {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .hero__title {
    font-size: 3.5rem;
  }
}


/* --------------------------------------------------------------------------
   Problem (.problem)
   -------------------------------------------------------------------------- */
/* Uses .grid--3 and .card — no extra styles needed beyond section defaults.
   Cards inherit shared .card styling. */


/* --------------------------------------------------------------------------
   Solution (.solution)
   -------------------------------------------------------------------------- */
.loop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 48px 0;
}

.loop__step {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 24px;
  text-align: center;
  min-width: 180px;
  flex-shrink: 0;
  transition: box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.loop__step:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.loop__icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 8px;
}

.loop__title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.loop__desc {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.loop__arrow {
  color: var(--color-border-mid);
  font-size: 1.5rem;
  line-height: 1;
  /* On mobile arrows point down */
  transform: rotate(90deg);
}

.solution__explanation {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .loop {
    flex-direction: row;
  }

  .loop__arrow {
    transform: rotate(0deg);
  }
}


/* --------------------------------------------------------------------------
   Features (.features)
   -------------------------------------------------------------------------- */
/* Uses .grid--2 and .card — shared styling applies. */
.features .grid--2 {
  gap: 24px;
}


/* --------------------------------------------------------------------------
   Tiers / Free vs Paid (.tiers)
   -------------------------------------------------------------------------- */
.tiers .grid--2 {
  gap: 24px;
}

.card--tier {
  padding: 40px 32px;
}

.tier__list {
  list-style: none;
  padding: 0;
}

.tier__list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.9375rem;
  color: var(--color-text);
}

.tier__list li:last-child {
  border-bottom: none;
}

.tier__list li::before {
  content: "\2713\00a0";
  color: var(--color-success);
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}

.badge--free {
  background-color: var(--color-success-light);
  color: var(--color-success-text);
}

.badge--soon {
  background-color: var(--color-amber-bg);
  color: var(--color-amber-text);
}


/* --------------------------------------------------------------------------
   Use Cases (.use-cases)
   -------------------------------------------------------------------------- */
/* Uses .grid--3 and .card — shared styling applies. */


/* --------------------------------------------------------------------------
   Pricing (.pricing)
   -------------------------------------------------------------------------- */
.pricing .grid--3 {
  gap: 24px;
}

.card--pricing {
  text-align: center;
}

.card--pricing-featured {
  border: 2px solid var(--color-primary);
  box-shadow: var(--shadow-card-hover);
}

.card__tier-name {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--color-text);
  margin-bottom: 8px;
}

.card__price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-text);
  margin: 16px 0;
  line-height: 1.2;
}

.card__price-period {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.card--pricing .tier__list {
  text-align: left;
  margin-bottom: 24px;
}


/* --------------------------------------------------------------------------
   Signup (.signup)
   -------------------------------------------------------------------------- */
.signup {
  background-color: var(--color-bg-alt);
}

.form {
  max-width: 480px;
  margin: 0 auto;
  background-color: var(--color-bg);
  padding: 40px;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

.form__group {
  margin-bottom: 24px;
}

.form__group:last-of-type {
  margin-bottom: 32px;
}

.form__label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 8px;
  color: var(--color-text-label);
}

.form__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

/* Select dropdown arrow */
.form__select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Fieldset reset */
.form__fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

/* Radio group */
.form__radios {
  display: flex;
  flex-direction: row;
  gap: 16px;
  flex-wrap: wrap;
}

.form__radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font-size: 0.875rem;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  transition: border-color var(--transition-fast),
              background-color var(--transition-fast);
}

.form__radio-label:has(input:checked) {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.form__radio {
  accent-color: var(--color-primary);
  margin: 0;
  flex-shrink: 0;
}

/* Success / Error messages */
.form__message {
  text-align: center;
  border-radius: var(--radius-input);
  font-weight: 500;
  margin-top: 16px;
}

.form__message--success {
  padding: 24px;
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.form__message--error {
  padding: 16px;
  background-color: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
  font-size: 0.875rem;
}

/* Success message — ID fallback for CSS-only state */
#signup-success {
  display: none;
  text-align: center;
  padding: 24px;
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-input);
  color: var(--color-success-text);
  font-weight: 500;
}

/* Error message — ID fallback for CSS-only state */
#signup-error {
  display: none;
  text-align: center;
  padding: 16px;
  background-color: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  border-radius: var(--radius-input);
  color: var(--color-error-text);
  margin-top: 16px;
  font-size: 0.875rem;
}

/*
 * script.js toggles the `hidden` HTML attribute on #signup-success and
 * #signup-error.  The [hidden] attribute already sets display:none in
 * every modern browser, so no extra CSS is needed for show/hide.
 * The `display: none` above is the initial state for the CSS-only fallback.
 */


/* --------------------------------------------------------------------------
   Footer (.footer)
   -------------------------------------------------------------------------- */
.footer {
  padding: 32px 24px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

.footer__link {
  color: inherit;
  text-decoration: none;
  display: block;
  margin-top: 8px;
}

.footer__link:hover {
  text-decoration: underline;
}


/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* --------------------------------------------------------------------------
   Responsive — 768px (Tablet)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  /* Grids handled above in Grid System section */

  .form__radios {
    flex-wrap: nowrap;
  }
}


/* --------------------------------------------------------------------------
   Responsive — 1024px (Desktop)
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* Grids handled above in Grid System section */

  section {
    padding: 96px 0;
  }
}
