/*
Theme Name: CraftApps
Theme URI: https://craftapps.ai
Description: CraftApps brand theme — purposeful, warm, craft-forward.
Version: 1.9.0
Author: CraftApps Team
Author URI: https://craftapps.ai
Template: twentytwentyfour
Text Domain: craftapps
*/

/* ─── Brand Tokens ─────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,700;1,9..144,400&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --color-slate:        #1E2A38;
  --color-slate-light:  #2E3F52;
  --color-slate-muted:  #6B7A8D;
  --color-amber:        #C8862A;
  --color-amber-light:  #E6A84A;
  --color-amber-pale:   #FBF0DC;
  --color-parchment:    #F5F0E8;
  --color-white:        #FFFFFF;
  --color-ink:          #1E2A38;
  --color-ink-muted:    #4A5568;
  --color-border:       #D9D2C5;
  --color-bg:           var(--color-parchment);
  --color-bg-card:      var(--color-white);
  --color-text:         var(--color-ink);
  --color-text-muted:   var(--color-ink-muted);
  --color-accent:       var(--color-amber);
  --color-accent-hover: var(--color-amber-light);
  --font-heading:       'Fraunces', Georgia, serif;
  --font-body:          'DM Sans', system-ui, -apple-system, sans-serif;
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.875rem;
  --text-4xl:   2.25rem;
  --text-5xl:   3rem;
  --space-1:    0.25rem;
  --space-2:    0.5rem;
  --space-3:    0.75rem;
  --space-4:    1rem;
  --space-6:    1.5rem;
  --space-8:    2rem;
  --space-12:   3rem;
  --space-16:   4rem;
  --space-24:   6rem;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-full: 9999px;
  --border-thin:   1px solid var(--color-border);
  --border-medium: 2px solid var(--color-border);
  --border-accent: 2px solid var(--color-amber);
  --shadow-sm:  0 1px 3px rgba(30, 42, 56, 0.08);
  --shadow-md:  0 4px 12px rgba(30, 42, 56, 0.12);
  --shadow-lg:  0 8px 24px rgba(30, 42, 56, 0.16);
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
}

/* ─── Reset & Base ─────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* prevent horizontal scroll on mobile */
}

body {
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-slate);
  line-height: 1.2;
  font-weight: 700;
}

a {
  color: var(--color-amber);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-amber-light); }

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

/* ─── Layout ───────────────────────────────────────── */

.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }
.container {
  width: 100%;
  padding: 0 var(--space-6);
}
@media (min-width: 1140px) {
  .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-8);
  }
}

/* ─── Navigation ───────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-parchment);
  border-bottom: var(--border-thin);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  min-width: 0;      /* allow logo to shrink if needed */
  flex-shrink: 1;
}

/* Wordmark SVG — constrained to never overflow */
.nav-wordmark-svg {
  height: 40px;
  width: auto;
  max-width: 55vw;   /* never more than 55% of viewport width */
  display: block;
}

.nav-wordmark {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-slate);
  letter-spacing: -0.5px;
}
.nav-wordmark span { color: var(--color-amber); }

.nav-cta {
  background: var(--color-amber);
  color: var(--color-white) !important;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.3px;
  transition: background var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-cta:hover { background: var(--color-amber-light) !important; }

/* Tablet+: roomier nav */
@media (min-width: 640px) {
  .site-nav { padding: var(--space-4) var(--space-8); }
  .nav-wordmark-svg { height: 52px; max-width: none; }
  .nav-wordmark { font-size: var(--text-xl); }
  .nav-cta { padding: var(--space-2) var(--space-6); font-size: var(--text-sm); }
}

/* ─── Hero ─────────────────────────────────────────── */

/* Mobile: single column, compact spacing */
.hero {
  padding: var(--space-12) var(--space-6) var(--space-8);
  max-width: 1100px;
  margin: 0 auto;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-sm);   /* slightly bigger on mobile */
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-amber);
  margin-bottom: var(--space-3);
}

/* Mobile: smaller headline */
.hero-headline {
  font-size: var(--text-3xl);
  line-height: 1.15;
  margin-bottom: var(--space-4);
  color: var(--color-slate);
}
.hero-headline em {
  font-style: italic;
  color: var(--color-amber);
}

.hero-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

/* Tablet: bigger type */
@media (min-width: 640px) {
  .hero { padding: var(--space-16) var(--space-8) var(--space-12); }
  .hero-eyebrow { font-size: var(--text-base); letter-spacing: 4px; }
  .hero-headline { font-size: var(--text-4xl); }
  .hero-body { font-size: var(--text-lg); max-width: 480px; }
}

/* Desktop: two-column layout with mockup */
@media (min-width: 900px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    align-items: center;
    padding: var(--space-24) var(--space-8) var(--space-16);
  }
  .hero-headline { font-size: var(--text-5xl); }
}

/* ─── Email Capture ────────────────────────────────── */

/* Mobile: stacked */
.email-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 440px;
}

.email-form input[type="email"] {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-white);
  outline: none;
  /* Prevent iOS zoom on focus (font-size must be >= 16px) */
  font-size: 1rem;
  transition: border-color var(--transition-fast);
}
.email-form input[type="email"]:focus { border-color: var(--color-amber); }
.email-form input[type="email"]::placeholder { color: var(--color-slate-muted); }

.email-form button {
  width: 100%;
  background: var(--color-slate);
  color: var(--color-white);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  /* Large touch target */
  min-height: 48px;
  transition: background var(--transition-fast);
}
.email-form button:hover { background: var(--color-slate-light); }

.email-note {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Tablet+: side-by-side form */
@media (min-width: 540px) {
  .email-form { flex-direction: row; }
  .email-form button { width: auto; white-space: nowrap; }
}

/* ─── App Mockup ───────────────────────────────────── */

/* Hidden on mobile — content first */
.hero-visual { display: none; }

/* Desktop: show the mockup */
@media (min-width: 900px) {
  .hero-visual {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
    border: var(--border-thin);
  }
}

.mock-post {
  background: var(--color-parchment);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border-left: 3px solid var(--color-amber);
}
.mock-post-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.mock-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-slate);
  flex-shrink: 0;
}
.mock-avatar.amber { background: var(--color-amber); }
.mock-avatar.muted { background: var(--color-slate-muted); }
.mock-name { font-weight: 600; font-size: var(--text-sm); color: var(--color-slate); }
.mock-time { font-size: var(--text-xs); color: var(--color-text-muted); }
.mock-text { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.mock-reactions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ─── Features Strip ───────────────────────────────── */

.features {
  background: var(--color-slate);
  color: var(--color-white);
  padding: var(--space-12) var(--space-6);
}

/* Mobile: single column */
.features-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

.feature-item h3 {
  color: var(--color-amber);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}
.feature-item p {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
}

/* Tablet+: three columns */
@media (min-width: 768px) {
  .features { padding: var(--space-16) var(--space-8); }
  .features-inner { grid-template-columns: repeat(3, 1fr); gap: var(--space-8); }
}

/* ─── Products Section ─────────────────────────────── */

.products {
  padding: var(--space-16) var(--space-6);
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

@media (min-width: 768px) {
  .products { padding: var(--space-24) var(--space-8); }
}

.section-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-amber);
  margin-bottom: var(--space-4);
}
.section-headline {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}
.section-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0 auto var(--space-8);
}

@media (min-width: 640px) {
  .section-headline { font-size: var(--text-4xl); }
  .section-body { font-size: var(--text-lg); max-width: 600px; margin-bottom: var(--space-12); }
}

.product-card {
  background: var(--color-white);
  border: var(--border-thin);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
  max-width: 480px;
  margin: 0 auto;
}
.product-card:hover { box-shadow: var(--shadow-md); }

@media (min-width: 640px) {
  .product-card { padding: var(--space-8); }
}

.product-card-tag {
  display: inline-block;
  background: var(--color-amber-pale);
  color: var(--color-amber);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}
.product-card h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}
.product-card p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.7;
}
.btn-primary {
  display: inline-block;
  background: var(--color-amber);
  color: var(--color-white) !important;
  padding: var(--space-3) var(--space-8);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  /* Minimum touch target */
  min-height: 44px;
  line-height: 1.8;
  transition: background var(--transition-fast);
}
.btn-primary:hover { background: var(--color-amber-light) !important; }


/* ─── Signup Form ──────────────────────────────────── */

.signup-form-wrap {
  max-width: 480px;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-slate);
}

.field-optional {
  font-weight: 400;
  color: var(--color-slate-muted);
  font-size: var(--text-xs);
}

.required-mark {
  color: var(--color-amber);
  margin-left: 2px;
}

.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="text"],
.form-field textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem; /* >=16px prevents iOS zoom */
  color: var(--color-text);
  background: var(--color-white);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--color-amber);
  box-shadow: 0 0 0 3px var(--color-amber-pale);
}

.form-field input[aria-invalid="true"] {
  border-color: #c0392b;
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--color-slate-muted);
}

.field-error {
  font-size: var(--text-xs);
  color: #c0392b;
  min-height: 1.2em;
}

.signup-submit {
  width: 100%;
  background: var(--color-slate);
  color: var(--color-white);
  border: none;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  transition: background var(--transition-fast);
  margin-top: var(--space-2);
}

.signup-submit:hover:not(:disabled) {
  background: var(--color-slate-light);
}

.signup-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.signup-success,
.signup-error {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.signup-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.signup-error {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #f5c6cb;
}



/* ─── Blog Teaser (homepage) ──────────────────────── */

.blog-teaser {
  background: var(--color-amber-pale);
  padding: var(--space-12) var(--space-6);
}

.blog-teaser-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.blog-card {
  background: var(--color-white);
  border: var(--border-thin);
  border-left: 4px solid var(--color-amber);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  max-width: 640px;
}

@media (min-width: 640px) {
  .blog-teaser { padding: var(--space-16) var(--space-8); }
  .blog-card { padding: var(--space-8); }
}

.blog-card-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.blog-card-title a {
  color: var(--color-slate);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.blog-card-title a:hover { color: var(--color-amber); }

.blog-card-excerpt {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.blog-card-link {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-amber);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.blog-card-link:hover { color: var(--color-amber-light); }

/* ─── Single Post ──────────────────────────────────── */

.post-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
}

@media (min-width: 640px) {
  .post-wrap { padding: var(--space-16) var(--space-8); }
}

.post-header { margin-bottom: var(--space-8); }

.post-title {
  font-size: var(--text-4xl);
  line-height: 1.15;
  margin-bottom: var(--space-3);
}

@media (min-width: 640px) {
  .post-title { font-size: var(--text-5xl); }
}

.post-meta {
  font-size: var(--text-sm);
  color: var(--color-slate-muted);
}

.post-content {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--color-text);
}

.post-content p { margin-bottom: var(--space-6); }

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

.post-cta {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: var(--border-thin);
  text-align: center;
}

.post-cta p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* ─── Modal ────────────────────────────────────────── */

/* Prevent body scroll when modal open */
body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 56, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  /* Hidden by default via pointer-events + opacity — NOT display:none */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Success state hidden by default */
#modal-state-success { display: none; }
#modal-state-success.is-visible { display: block; }

.modal-box {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: var(--space-8) var(--space-6);
  position: relative;
  transform: translateY(12px);
  transition: transform var(--transition-base);
}

.modal-overlay.is-open .modal-box {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-slate-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.modal-close:hover {
  color: var(--color-slate);
  background: var(--color-parchment);
}

.modal-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
  padding-right: var(--space-8); /* clear close button */
}

.modal-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

/* Form actions row */
.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.signup-submit {
  flex: 1;
  background: var(--color-slate);
  color: var(--color-white);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  transition: background var(--transition-fast);
}
.signup-submit:hover:not(:disabled) { background: var(--color-slate-light); }
/* Inactive state — no valid email yet */
.signup-submit.is-inactive,
.signup-submit:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: var(--color-slate);
  transform: none;
}

/* Ready state — valid email entered */
.signup-submit.is-ready {
  opacity: 1;
  cursor: pointer;
  background: var(--color-amber);
  transition: background var(--transition-fast), opacity var(--transition-base);
}
.signup-submit.is-ready:hover {
  background: var(--color-amber-light);
}

.btn-cancel {
  background: transparent;
  color: var(--color-slate-muted);
  border: var(--border-medium);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.btn-cancel:hover {
  color: var(--color-slate);
  border-color: var(--color-slate);
}

/* Success state */
.modal-success-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  line-height: 1;
}

#modal-state-success .signup-submit {
  margin-top: var(--space-4);
  width: 100%;
  background: var(--color-amber);
}
#modal-state-success .signup-submit:hover {
  background: var(--color-amber-light);
}

/* Error box */
.signup-error {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #f5c6cb;
  margin-top: var(--space-2);
}

/* Tablet+: roomier modal padding */
@media (min-width: 640px) {
  .modal-box { padding: var(--space-8); }
}

/* ─── Site Footer ──────────────────────────────────── */

.site-footer {
  background: var(--color-slate);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: var(--space-8) var(--space-6);
  font-size: var(--text-sm);
}
.site-footer a { color: var(--color-amber); }
.site-footer a:hover { color: var(--color-amber-light); }
