/* =========================================================
   8am Coffee – Landing styles
   Goal: keep visuals identical, improve order, clarify with comments
   ========================================================= */

/* ======================
   1) Root + resets
   ====================== */
   :root{
    --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    --bg: #ffffff;
    --text: #111;
    --muted: #555;
    --primary: #7a5ac4;
    --radius: 12px;
    --gray: #f4f4f5;
    --border: #eaeaea;
    --demo-min-h: 250px;     /* Controls DEMO block min-height */
    --header-h: 64px;        /* Header height used for spacing/anchors (updated via JS) */
  }
  
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body{
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  /* Prevent accidental horizontal scroll on mobile */
  html, body { max-width: 100%; overflow-x: hidden; }
  
  /* ======================
     2) Accessibility helpers
     ====================== */
  .skip-link{
    position: absolute;
    top: -40px; left: 0;
    background: #000; color: #fff;
    padding: 8px 12px; z-index: 100;
    border-radius: 6px; text-decoration: none;
  }
  .skip-link:focus{ top: 8px; }
  
  :focus-visible{
    outline: 2px solid color-mix(in srgb, var(--primary), #000 10%);
    outline-offset: 2px;
  }
  
  /* ======================
     3) Layout primitives
     ====================== */
  .container{
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.25rem;
  }
  
  /* ======================
     4) Typography + generic UI
     ====================== */
  .section{
    padding: 64px 0;
    /* Ensure anchor targets are not hidden beneath the fixed header */
    scroll-margin-top: calc(var(--header-h) + 8px);
  }
  .section-head { text-align: center; margin-bottom: 24px; }
  .section-head h2 { font-size: 2rem; margin: 0 0 .5rem 0; }
  .lead { font-size: 1.05rem; color: #444; margin: 0 auto 1rem; }
  .lead-main { font-size: 1.2rem; }
  .highlight { color: var(--primary); }
  .fineprint { font-size: .9rem; color: var(--muted); }
  .fineprint.center { text-align: center; }
  
  /* ======================
     5) Components
     ====================== */
  
  /* Header: fixed + translucent + blur */
  .site-header{
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000;
  
    /* Real blur (Safari needs prefix) */
    backdrop-filter: saturate(120%) blur(8px);
    -webkit-backdrop-filter: saturate(120%) blur(8px);
  
    /* Translucent background so blur mixes with content underneath */
    background: rgba(255,255,255,0.65);
    border-bottom: 1px solid var(--border);
  
    /* Smooth transition when scrolled */
    transition:
      background .2s ease,
      box-shadow .2s ease,
      backdrop-filter .2s ease,
      -webkit-backdrop-filter .2s ease;
  }
  /* Stronger blur + subtle shadow after a tiny scroll */
  .site-header.scrolled{
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
  }
  .header-inner{
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
  }
  .brand{ display: flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; }
  .logo{ height: 32px; width: auto; }
  
  /* Compensate fixed header so content doesn't slide underneath */
  main{ padding-top: var(--header-h); }
  
  /* Nav */
  .nav{ display: flex; align-items: center; gap: 1rem; }
  .nav-link{
    color: #222; text-decoration: none;
    font-size: 0.95rem; padding: .25rem .5rem; border-radius: 8px;
  }
  .nav-link:hover{ background: var(--gray); }
  
  /* Buttons */
  .button{
    display: inline-flex; align-items: center; justify-content: center;
    padding: .75rem 1.1rem;
    background: var(--primary); color: #fff; text-decoration: none;
    border: 0; border-radius: 999px; cursor: pointer; font-weight: 600;
    transition: transform .1s ease, background .2s ease;
  }
  .button:hover{ transform: translateY(-1px); background: #6d4ec0; }
  .button.ghost{ background: transparent; border: 1px solid var(--border); color: #111; }
  .button.ghost:hover{ background: var(--gray); }
  .button.small{ padding: .5rem .85rem; font-size: .9rem; }
  .button.large{ padding: .9rem 1.25rem; font-size: 1rem; }
  .button.block{ width: 100%; }
  
  /* Hero */
  .hero{ padding-top: 72px; }
  .hero-grid{
    display: grid; grid-template-columns: 1.15fr .85fr;
    gap: 2rem; align-items: center;
  }
  .hero-copy h1{
    font-size: clamp(2rem, 4.5vw, 3rem);
    line-height: 1.2; margin: 0 0 .75rem 0;
  }
  .cta-row{ display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
  
  /* Social proof */
  .social-proof{ padding-top: 24px; }
  .proof-title{ text-align: center; color: var(--muted); margin-bottom: 16px; }
  
  /* Trusted-by: centered, consistent sizing, no overflow on mobile */
  .section.social-proof .logo-row{
    display: grid; gap: 24px; align-items: center; justify-items: center;
    grid-auto-flow: column; grid-auto-columns: 160px;
    width: fit-content; margin-left: auto; margin-right: auto;
  }
  .section.social-proof .logo-badge{
    display: block; width: 160px; height: 44px;
    opacity: .6; filter: grayscale(1) contrast(.9);
    transition: opacity .2s, filter .2s, transform .15s;
  }
  .section.social-proof .logo-link:hover .logo-badge{
    opacity: 1; filter: grayscale(.15) contrast(1);
    transform: translateY(-1px);
  }
  
  /* How it works */
  .steps{
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 18px; margin-top: 16px;
  }
  .step{
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
  }
  .step h3{ margin: 0 0 6px 0; font-size: 1.1rem; }
  
  /* Features */
  .feature-grid{
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 18px; margin-top: 16px;
  }
  .card{
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
  }
  .card h3{ margin: 0 0 6px 0; font-size: 1.05rem; }
  
  /* Pricing */
  .pricing{ background: #fcfcff; }
  .plans{
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 18px; margin-top: 16px;
  }
  /* If only one .plan, center and use a single column */
  .plans:has(> .plan:only-child){
    grid-template-columns: 1fr;
    max-width: 460px; margin-inline: auto;
  }
  .plan{
    background: #fff; border: 1px solid var(--border);
    border-radius: 16px; padding: 20px; position: relative; text-align: left;
  }
  .plan h3{ margin: 0 0 6px 0; text-align: left; }
  .price{ margin: 4px 0 12px 0; text-align: left; }
  .price .amount{ font-size: 2rem; font-weight: 800; }
  .price .per{ color: var(--muted); margin-left: 4px; }
  .features-list{ list-style: none; padding: 0; margin: 0 0 14px 0; }
  .features-list li{ padding-left: 20px; position: relative; margin: 8px 0; text-align: left; }
  .features-list li:before{ content: "•"; position: absolute; left: 6px; color: var(--primary); }
  .plan-popular{ border: 2px solid var(--primary); box-shadow: 0 10px 24px rgba(122,90,196,0.07); }
  .plan-popular .badge{
    position: absolute; top: -12px; left: 16px;
    background: var(--primary); color: #fff; font-size: .75rem;
    padding: 4px 8px; border-radius: 999px;
  }
  
  /* FAQ */
  .faq-grid{
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; margin-top: 16px; align-items: start;
  }
  details{
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
  }
  details > summary{ cursor: pointer; font-weight: 600; list-style: none; }
  details[open]{ border-color: #d8cef2; }
  
  /* Signup (final CTA) */
  .signup{ background: #f9f9ff; text-align: center; }
  .signup-inner{
    display: grid; grid-template-columns: 1.1fr .9fr;
    gap: 18px; align-items: center; justify-items: center;
  }
  .signup-copy{ max-width: 620px; }
  .signup-copy h2, .signup-copy .lead{ margin-left: auto; margin-right: auto; }
  .bullets{
    margin: 8px auto 0; padding-left: 0;
    list-style: disc; list-style-position: inside;
    text-align: left; max-width: 460px;
  }
  .signup-cta{ display: flex; justify-content: center; }
  
  /* DEMO section (right-aligned overlay, vertically centered) */
  .demo{
    background: var(--gray) url('/assets/background.png') center/cover no-repeat;
    text-align: right; padding: 2rem 2rem 2rem 1rem;
    border-radius: var(--radius); color: white; border: 1px solid var(--border);
    min-height: var(--demo-min-h); display: flex; align-items: center; justify-content: flex-end;
  }
  .demo .demo-overlay{ max-width: 560px; }
  .demo-link{ color: white; text-decoration: none; }
  .demo-link:hover{ text-decoration: underline; }
  .demo-overlay-link{ display: block; text-decoration: none; color: inherit; transition: transform .3s ease; }
  .demo-overlay-link:hover{ transform: scale(1.015); }
  
  /* Footer */
  footer{
    margin-top: 3rem; padding: 2rem 1rem;
    text-align: center; font-size: .85rem; color: #777;
  }
  .footer-links{
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 1rem; margin-bottom: 1rem; line-height: 1;
  }
  .footer-links a{ text-decoration: none; color: inherit; }
  .footer-links a:hover{ text-decoration: underline; }
  
  /* ======================
     6) Media (images/placeholders)
     ====================== */
  .media-ph{
    display: block; width: 100%;
    background: linear-gradient(135deg, #ecebff, #ffffff);
    border: 1px solid var(--border); border-radius: var(--radius);
  }
  /* Keep intrinsic ratio; avoid cropping; cap growth on large screens */
  .media-img, .step-img, .card-img{
    display: block; width: 100%; height: auto; object-fit: contain;
    border-radius: var(--radius); border: 1px solid var(--border);
    /* ↑↑ (4) más aire entre imagen y título en tarjetas */
    margin-bottom: 10px;
  }
  @media (min-width: 981px){
    .media-img{ max-height: 420px; }
    .step-img{  max-height: 260px; }
    .card-img{  max-height: 220px; }
  }
  /* Lazy images: improve rendering cost */
  img[loading="lazy"]{ content-visibility: auto; }
  
  /* ======================
     7) Utilities
     ====================== */
  .pricing-notes{
    margin-top: 8px; display: flex; flex-direction: column;
    gap: 4px; align-items: center;
  }
  .strike{
    text-decoration: line-through; text-decoration-thickness: 2px;
    text-decoration-color: color-mix(in srgb, var(--primary), transparent 55%);
    color: #666;
  }
  .waived{
    margin-left: .5rem; font-weight: 600; font-size: .85rem; color: var(--primary);
    background: color-mix(in srgb, var(--primary), #fff 90%);
    border: 1px solid color-mix(in srgb, var(--primary), #fff 75%);
    padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  }
  
  /* ======================
     8) Responsive rules
     ====================== */
  @media (max-width: 980px){
    .hero-grid{ grid-template-columns: 1fr; }
    .signup-inner{ grid-template-columns: 1fr; }
    .feature-grid{ grid-template-columns: repeat(2, 1fr); }
    .steps{ grid-template-columns: 1fr 1fr; }
    .plans{ grid-template-columns: 1fr; }
    .faq-grid{ grid-template-columns: 1fr; }
    .section.social-proof .logo-row{ row-gap: 16px; } /* tablet tweak */
  }
  
  @media (max-width: 600px){
    .nav{ display: none; }  /* ultra simple on mobile */
    .section{ padding: 48px 0; }
    .logo{ height: 36px; }
    .hero .lead{ font-size: 1rem; }
  
    /* Trusted-by: two columns and full width container */
    .section.social-proof .logo-row{
      width: 100%;
      grid-auto-flow: row; grid-auto-columns: initial;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      justify-items: center;
    }
    .section.social-proof .logo-badge{ width: 140px; }
  
    /* Center brand/logo in the fixed header when the nav is hidden on mobile */
    .site-header .header-inner{ justify-content: center; }
  
    /* Force single-column layout for 'How it works' and 'Why brands...' on mobile */
    .steps{ grid-template-columns: 1fr; }
    .feature-grid{ grid-template-columns: 1fr; }
  }
  
  /* ======================
     9) One-off overrides & enhancements
     ====================== */
  
  /* Signup: align text left while keeping grid positions */
  .signup{ background: #f9f9ff; text-align: left; }
  .signup-inner{
    display: grid; grid-template-columns: 1.1fr .9fr;
    gap: 18px; align-items: center; justify-items: center;
  }
  .signup-copy{ max-width: 620px; text-align: left; justify-self: center; }
  .signup-copy h2{ margin: 0 0 .25rem 0; }
  .signup-copy .lead{ margin: 0 0 .5rem 0; }
  .bullets{
    margin: 8px 0 0 0; padding-left: 1.1rem;
    list-style: disc; list-style-position: outside; max-width: 560px;
  }
  .signup-cta{ display: flex; justify-content: center; }
  
  /* Demo: subtle purple glow for contrast on white text */
  .demo h2, .demo .demo-link{
    color: #fff; -webkit-text-stroke: 0 transparent;
    text-shadow:
      0 3px 16px rgba(122, 90, 196, 0.88),
      0 2px 8px  rgba(122, 90, 196, 0.80),
      0 1px 3px  rgba(122, 90, 196, 0.90);
  }
  
  /* Orphan centering in 2-col layouts (tablet) */
  @media (min-width: 601px) and (max-width: 980px){
    .steps > *:last-child:nth-child(odd),
    .feature-grid > *:last-child:nth-child(odd){
      grid-column: 1 / -1; justify-self: center; max-width: 520px;
    }
  }
  
  /* Pricing: on narrow desktop (2 cols), center last plan if odd count */
  @media (min-width: 981px) and (max-width: 1120px){
    .plans{ grid-template-columns: repeat(2, 1fr); }
    .plans > .plan:last-child:nth-child(odd){
      grid-column: 1 / -1; justify-self: center; max-width: 560px;
    }
  }

  /* ======================
   MEDIUM: mobile header earlier (≤1024px)
   ====================== */
  @media (max-width: 1024px){
    /* Hide the nav links and center the brand sooner */
    .nav{ display: none; }
    .site-header .header-inner{ justify-content: center; }
  }

  /* ===== MOBILE FIXES (estrictamente lo pedido) ===== */
  @media (max-width: 600px){
    /* (1) Hero centrado (texto y botones) */
    .hero-copy{ text-align: center; }
    .hero-copy h1{ margin-left: auto; margin-right: auto; }
    .hero .lead, .hero .fineprint{ margin-left: auto; margin-right: auto; }
    .cta-row{ justify-content: center; }

    /* (2) Quinta marca centrada cuando el total es impar */
    .section.social-proof .logo-row > *:last-child:nth-child(odd){
      grid-column: 1 / -1; justify-self: center;
    }

    /* (3) Signup en una columna; botón abajo y centrado */
    .signup-inner{ grid-template-columns: 1fr; }
    .signup-cta{ width: 100%; justify-content: center; margin-top: 12px; }
  }
