/* Postcard Revival Desk — styles.css */
:root {
  --cream: #FFF8F0;
  --ink: #2C3E50;
  --ink-light: #5A6B7A;
  --paper: #FDF6EC;
  --accent: #C0392B;
  --accent-hover: #A93226;
  --blue: #2980B9;
  --blue-light: #D6EAF8;
  --green: #27AE60;
  --green-light: #D5F5E3;
  --border: #E8D5B7;
  --shadow: 0 2px 12px rgba(44, 62, 80, 0.08);
  --radius: 8px;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; top: -100%; left: 1rem; background: var(--ink); color: #fff; padding: 0.5rem 1rem; border-radius: 0 0 var(--radius) var(--radius); z-index: 1000; font-family: var(--font-ui); font-size: 0.875rem; }
.skip-link:focus { top: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header { background: var(--paper); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; gap: 1rem; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.logo-text { font-family: var(--font); }
.main-nav ul { display: flex; list-style: none; gap: 1.25rem; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--ink-light); font-family: var(--font-ui); font-size: 0.875rem; font-weight: 500; padding: 0.25rem 0; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s; }
.main-nav a:hover, .main-nav a:focus { color: var(--accent); border-bottom-color: var(--accent); }
.main-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Hero */
.hero-section { padding: 4rem 0 3rem; background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%); }
.hero-content { max-width: 640px; }
.hero-content h1 { font-size: 2.5rem; line-height: 1.2; margin-bottom: 1rem; }
.hero-sub { font-size: 1.125rem; color: var(--ink-light); margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.625rem 1.25rem; border-radius: var(--radius); font-family: var(--font-ui); font-size: 0.875rem; font-weight: 600; cursor: pointer; border: 2px solid transparent; transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; text-decoration: none; line-height: 1.4; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-secondary:hover { background: #1a252f; border-color: #1a252f; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--paper); border-color: var(--ink-light); }
.btn-small { padding: 0.375rem 0.75rem; font-size: 0.8rem; }

/* Composer */
.composer-section { padding: 3rem 0; }
.composer-layout { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
.composer-form h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-light); margin-bottom: 0.375rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.625rem 0.75rem; border: 2px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); font-size: 1rem; color: var(--ink); background: #fff; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.form-group textarea { resize: vertical; min-height: 120px; }
.char-count { font-family: var(--font-ui); font-size: 0.75rem; color: var(--ink-light); text-align: right; margin-top: 0.25rem; }

/* Theme buttons */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.theme-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 0.625rem; border: 2px solid var(--border); border-radius: var(--radius);
  background: #fff; cursor: pointer; font-family: var(--font-ui); font-size: 0.8rem;
  color: var(--ink); transition: border-color 0.2s, background 0.2s;
}
.theme-btn:hover { border-color: var(--ink-light); }
.theme-btn.active { border-color: var(--accent); background: #FDEDEC; }
.theme-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.theme-icon { font-size: 1.25rem; }

/* Prompt box */
.prompt-box {
  background: var(--paper); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; font-style: italic; color: var(--ink-light); font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.composer-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* Preview panel */
.preview-panel { position: sticky; top: 5rem; }
.preview-panel h3 { font-size: 1rem; margin-bottom: 0.75rem; font-family: var(--font-ui); color: var(--ink-light); }
.postcard-preview {
  background: #fff; border: 2px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.preview-front {
  background: linear-gradient(135deg, #FDF6EC 0%, #F5E6CC 100%);
  padding: 1rem; min-height: 100px; display: flex; justify-content: space-between;
}
.preview-stamp-area { display: flex; align-items: flex-start; }
.stamp-placeholder {
  width: 48px; height: 56px; border: 2px dashed var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 0.6rem; color: var(--ink-light); text-align: center;
}
.preview-address-lines { flex: 1; display: flex; flex-direction: column; gap: 0.375rem; align-items: flex-end; }
.addr-line { width: 70%; height: 2px; background: var(--border); border-radius: 1px; }
.preview-back { padding: 1rem; min-height: 140px; border-top: 1px dashed var(--border); }
.preview-message-area p { font-size: 0.9rem; color: var(--ink-light); line-height: 1.5; }
.preview-signature { margin-top: 0.75rem; font-style: italic; color: var(--ink); text-align: right; font-size: 0.9rem; }
.preview-note { font-family: var(--font-ui); font-size: 0.75rem; color: var(--ink-light); margin-top: 0.5rem; }

/* Streak */
.streak-section { padding: 3rem 0; background: var(--paper); }
.streak-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.streak-summary h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.streak-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card {
  background: #fff; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; text-align: center; min-width: 120px; flex: 1;
}
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-family: var(--font-ui); font-size: 0.75rem; color: var(--ink-light); }

/* Calendar */
.streak-calendar { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.cal-nav { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--ink-light); padding: 0.25rem 0.5rem; border-radius: 4px; }
.cal-nav:hover { background: var(--paper); color: var(--ink); }
.cal-nav:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.cal-month { font-family: var(--font-ui); font-weight: 600; font-size: 0.9rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dayname { font-family: var(--font-ui); font-size: 0.65rem; text-transform: uppercase; color: var(--ink-light); text-align: center; padding-bottom: 0.25rem; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-size: 0.75rem; border-radius: 4px; color: var(--ink); }
.cal-day.empty { background: none; }
.cal-day.filled { background: var(--green-light); color: var(--green); font-weight: 600; }
.cal-day.today { border: 2px solid var(--blue); }

/* Sent log */
.sent-log-section { padding: 3rem 0; }
.sent-log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem; }
.sent-log-header h2 { font-size: 1.5rem; }
.sent-log-empty { background: var(--paper); border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--ink-light); font-family: var(--font-ui); font-size: 0.9rem; }
.sent-log-table { width: 100%; border-collapse: collapse; }
.sent-log-table th { font-family: var(--font-ui); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-light); text-align: left; padding: 0.625rem; border-bottom: 2px solid var(--border); }
.sent-log-table td { padding: 0.625rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.sent-log-table tr:hover td { background: var(--paper); }
.log-delete-btn { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 0.25rem 0.5rem; cursor: pointer; font-family: var(--font-ui); font-size: 0.75rem; color: var(--ink-light); }
.log-delete-btn:hover { border-color: var(--accent); color: var(--accent); }
.log-delete-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Guide */
.guide-section { padding: 3rem 0; background: var(--paper); }
.guide-section h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
.guide-card { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.guide-card h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--ink); }
.guide-card p { font-size: 0.9rem; color: var(--ink-light); line-height: 1.55; }

.guide-faq { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.guide-faq h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.guide-faq details { border-bottom: 1px solid var(--border); padding: 0.75rem 0; }
.guide-faq details:last-child { border-bottom: none; }
.guide-faq summary { font-weight: 600; cursor: pointer; font-size: 0.95rem; color: var(--ink); }
.guide-faq summary:hover { color: var(--accent); }
.guide-faq details p { margin-top: 0.5rem; font-size: 0.9rem; color: var(--ink-light); line-height: 1.55; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(44,62,80,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: var(--radius); padding: 1.5rem; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(44,62,80,0.15); }
.modal h3 { font-size: 1.125rem; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* Footer */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.7); padding: 2rem 0; margin-top: 2rem; }
.footer-inner { display: flex; flex-direction: column; gap: 1rem; align-items: center; text-align: center; }
.footer-brand { display: flex; flex-direction: column; gap: 0.25rem; }
.footer-logo { font-weight: 700; color: #fff; font-size: 1rem; }
.footer-tagline { font-family: var(--font-ui); font-size: 0.8rem; }
.footer-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: rgba(255,255,255,0.7); text-decoration: none; font-family: var(--font-ui); font-size: 0.8rem; }
.footer-nav a:hover { color: #fff; }
.footer-note { font-family: var(--font-ui); font-size: 0.75rem; opacity: 0.6; }

/* Print styles */
@media print {
  body * { visibility: hidden; }
  .print-template, .print-template * { visibility: visible; }
  .print-template { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #fff; }
  .print-card { width: 6in; height: 4in; border: 1px solid #ccc; display: flex; flex-direction: column; position: relative; }
  .print-front { flex: 1; padding: 0.3in; display: flex; justify-content: space-between; position: relative; }
  .print-stamp-box { width: 0.9in; height: 0.9in; border: 1px dashed #999; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: #999; }
  .print-address-area { flex: 1; display: flex; flex-direction: column; gap: 0.15in; align-items: flex-end; padding-right: 0.2in; }
  .print-addr-line { border-bottom: 1px solid #333; width: 2.5in; height: 0.25in; font-size: 0.85rem; padding-left: 0.1in; display: flex; align-items: flex-end; }
  .print-back { flex: 1; padding: 0.3in; border-top: 1px dashed #999; display: flex; flex-direction: column; justify-content: space-between; }
  .print-message { font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
  .print-signature { text-align: right; font-style: italic; font-size: 0.85rem; }
  .print-crop-marks .crop { position: absolute; width: 0.2in; height: 0.2in; }
  .crop.tl { top: 0.1in; left: 0.1in; border-top: 1px solid #999; border-left: 1px solid #999; }
  .crop.tr { top: 0.1in; right: 0.1in; border-top: 1px solid #999; border-right: 1px solid #999; }
  .crop.bl { bottom: 0.1in; left: 0.1in; border-bottom: 1px solid #999; border-left: 1px solid #999; }
  .crop.br { bottom: 0.1in; right: 0.1in; border-bottom: 1px solid #999; border-right: 1px solid #999; }
}

/* Responsive */
@media (max-width: 900px) {
  .composer-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .streak-layout { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .hero-content h1 { font-size: 1.75rem; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .main-nav ul { gap: 0.75rem; }
  .guide-grid { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .streak-stats { flex-direction: column; }
  .composer-actions { flex-direction: column; }
  .sent-log-header { flex-direction: column; align-items: flex-start; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
