/* ============================================
   CONTINENTAL ALMANAC — Stylesheet
   Palette: deep forest, warm parchment, moss, 
   harvest gold, clay
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+3:wght@300;400;500;600&family=Source+Serif+4:ital,wght@0,400;1,400&display=swap');

:root {
  --forest:    #1e3a2f;
  --forest-lt: #2d5443;
  --moss:      #4a7c59;
  --moss-lt:   #7aab8a;
  --parchment: #f5f0e8;
  --cream:     #faf8f3;
  --gold:      #c8973a;
  --gold-lt:   #e8b95a;
  --clay:      #8b4a3a;
  --ink:       #1a1a18;
  --mid:       #5a5a52;
  --light:     #9a9a8a;
  --border:    #ddd8cc;
  --white:     #ffffff;
  --shadow:    rgba(30, 58, 47, 0.08);
  --shadow-md: rgba(30, 58, 47, 0.15);
  --radius:    6px;
  --radius-lg: 12px;
  --text-inverse: #f5f0e8; /* always-light text for use on dark/forest surfaces; must NOT be redefined in dark mode */
}

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

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

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.65;
  font-weight: 400;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4, h5 {
  font-family: 'Playfair Display', serif;
  line-height: 1.25;
  color: var(--forest);
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }
a { color: var(--moss); text-decoration: none; }
a:hover { color: var(--forest); }

.serif-italic { font-family: 'Source Serif 4', serif; font-style: italic; }

/* ---- LAYOUT ---- */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- NAVIGATION ---- */
.nav {
  background: var(--forest);
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px var(--shadow-md);
}
.nav-inner {
  max-width: 1140px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; font-weight: 700;
  color: var(--text-inverse);
  display: flex; align-items: center; gap: 0.5rem;
}
.nav-logo span { color: var(--gold); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  color: rgba(245,240,232,0.8);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-inverse);
  background: rgba(255,255,255,0.1);
}
.nav-cta {
  background: var(--gold) !important;
  color: var(--forest) !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--gold-lt) !important; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s; text-decoration: none;
  font-family: 'Source Sans 3', sans-serif;
}
.btn-primary { background: var(--forest); color: var(--text-inverse); }
.btn-primary:hover { background: var(--forest-lt); color: var(--text-inverse); }
.btn-gold { background: var(--gold); color: var(--forest); }
.btn-gold:hover { background: var(--gold-lt); }
.btn-moss { background: var(--moss); color: var(--white); }
.btn-moss:hover { background: var(--forest-lt); color: var(--white); }
.btn-outline { background: transparent; color: var(--forest); border: 1.5px solid var(--forest); }
.btn-outline:hover { background: var(--forest); color: var(--text-inverse); }
.btn-ghost { background: transparent; color: var(--mid); }
.btn-ghost:hover { background: var(--border); color: var(--ink); }
.btn-danger { background: var(--clay); color: var(--white); }
.btn-danger:hover { background: #6e3a2d; color: var(--white); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 1px 4px var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-header h3, .card-header h4 { margin: 0; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1.2rem; }
label {
  display: block;
  font-size: 0.85rem; font-weight: 600;
  color: var(--mid);
  margin-bottom: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: 'Source Sans 3', sans-serif;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(74,124,89,0.1);
}
textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.8rem; color: var(--light); margin-top: 0.25rem; }

/* ---- ALERTS ---- */
.alert {
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error   { background: #fdf0ee; border: 1px solid #e8b4aa; color: #7a2e22; }
.alert-success { background: #edf7f0; border: 1px solid #a8d5b4; color: #1e5c30; }
.alert-info    { background: #eef4fb; border: 1px solid #aac8e8; color: #1e3d6e; }
.alert ul { margin: 0.5rem 0 0 1.2rem; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-moss    { background: #e8f4ec; color: var(--moss); }
.badge-gold    { background: #fdf4e3; color: #9a6f1a; }
.badge-clay    { background: #faeae7; color: var(--clay); }
.badge-forest  { background: #e3ede8; color: var(--forest); }
.badge-free    { background: var(--border); color: var(--mid); }
.badge-premium { background: #fdf4e3; color: #9a6f1a; }

/* ---- HERO (landing) ---- */
.hero {
  background: var(--forest);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234a7c59' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.4;
}
.hero-content { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }
.hero-eyebrow {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 1rem;
}
.hero h1 { color: var(--text-inverse); margin-bottom: 1.25rem; }
.hero p { color: rgba(245,240,232,0.75); font-size: 1.1rem; margin-bottom: 2rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---- FEATURES SECTION ---- */
.features { padding: 4rem 1.5rem; }
.features h2 { text-align: center; margin-bottom: 0.5rem; }
.features .subtitle {
  text-align: center; color: var(--mid); margin-bottom: 3rem;
}
.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow-md);
}
.feature-icon {
  width: 48px; height: 48px;
  background: var(--forest);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}
.feature-card h4 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--mid); font-size: 0.9rem; margin: 0; }

/* ---- PRICING ---- */
.pricing { padding: 4rem 1.5rem; background: var(--parchment); }
.pricing h2 { text-align: center; margin-bottom: 0.5rem; }
.pricing .subtitle { text-align: center; color: var(--mid); margin-bottom: 3rem; }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 780px; margin: 0 auto; }
.pricing-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.pricing-card.featured {
  border-color: var(--gold);
  position: relative;
}
.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: var(--forest);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.25rem 1rem; border-radius: 20px;
}
.price-amount { font-family: 'Playfair Display', serif; font-size: 2.8rem; color: var(--forest); }
.price-amount span { font-size: 1rem; font-weight: 400; color: var(--mid); }
.pricing-features { list-style: none; margin: 1.5rem 0; }
.pricing-features li {
  padding: 0.4rem 0;
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.pricing-features li::before { content: '✓'; color: var(--moss); font-weight: 700; }
.pricing-features li.no::before { content: '✗'; color: var(--light); }
.pricing-features li.no { color: var(--light); }

/* ---- DASHBOARD LAYOUT ---- */
.app-layout { display: flex; min-height: calc(100vh - 62px); }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--forest);
  padding: 1.5rem 0;
  position: sticky; top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
}
.sidebar-section { padding: 0.5rem 0; }
.sidebar-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(245,240,232,0.4);
  padding: 0.4rem 1.5rem 0.2rem;
}
.sidebar a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 1.5rem;
  color: rgba(245,240,232,0.7);
  font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.1);
  color: var(--text-inverse);
}
.sidebar a.active { border-left: 3px solid var(--gold); }
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; }

.app-main { flex: 1; padding: 2rem; overflow-x: hidden; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header h2 { margin: 0; }

/* ---- STAT WIDGETS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--light); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--forest); line-height: 1.1; margin: 0.3rem 0 0.1rem; }
.stat-sub { font-size: 0.8rem; color: var(--mid); }

/* ---- JOURNAL ENTRIES ---- */
.entry-list { display: flex; flex-direction: column; gap: 1rem; }
.entry-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1.25rem; align-items: start;
  transition: box-shadow 0.2s;
}
.entry-item:hover { box-shadow: 0 3px 12px var(--shadow); }
.entry-date-block {
  text-align: center;
  background: var(--forest);
  border-radius: var(--radius);
  padding: 0.6rem 0.4rem;
  color: var(--text-inverse);
}
.entry-date-day { font-family: 'Playfair Display', serif; font-size: 1.8rem; line-height: 1; }
.entry-date-month { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.75; }
.entry-body h4 { margin-bottom: 0.3rem; }
.entry-body p { color: var(--mid); font-size: 0.88rem; margin: 0; }
.entry-tags { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag {
  background: var(--parchment); color: var(--mid);
  font-size: 0.72rem; padding: 0.15rem 0.5rem;
  border-radius: 20px; font-weight: 600;
}
.mood-icon { font-size: 1.3rem; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left; padding: 0.75rem 1rem;
  background: var(--parchment);
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--mid);
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--cream); }

/* ---- SEED LISTING CARDS ---- */
.seed-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.seed-card-type { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--moss); }
.seed-card h4 { margin: 0; font-size: 1rem; }
.seed-card-meta { font-size: 0.82rem; color: var(--mid); }
.seed-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* ---- ANIMAL CARDS ---- */
.animal-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}
.animal-avatar {
  width: 64px; height: 64px;
  background: var(--parchment);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin: 0 auto 0.75rem;
}
.animal-card h4 { margin-bottom: 0.2rem; }
.animal-card .species { font-size: 0.82rem; color: var(--mid); }
.animal-card .breed   { font-size: 0.78rem; color: var(--light); }

/* ---- EMPTY STATES ---- */
.empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--mid);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty h4 { margin-bottom: 0.4rem; color: var(--mid); font-family: 'Source Sans 3', sans-serif; }
.empty p { font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--mid); }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.w-full { width: 100%; }

/* ---- FOOTER ---- */
footer {
  background: var(--forest);
  color: rgba(245,240,232,0.6);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.85rem;
  margin-top: auto;
}
footer a { color: var(--gold); }
footer .footer-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; color: var(--text-inverse);
  margin-bottom: 0.5rem;
}

/* ---- RESPONSIVE NAV ---- */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; color: var(--text-inverse); font-size: 1.4rem; }
  .sidebar { display: none; }
  .app-main { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
}

/* ============================================
   DARK MODE
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --forest:    #2d5443;
    --forest-lt: #3d6a56;
    --moss:      #5a9a6e;
    --parchment: #1e1e1a;
    --cream:     #18181550;
    --gold:      #d4a544;
    --ink:       #e8e4dc;
    --mid:       #9a9a8a;
    --light:     #6a6a5a;
    --border:    #2e2e28;
    --white:     #1e1e1a;
    --shadow:    rgba(0,0,0,.3);
    --shadow-md: rgba(0,0,0,.4);
  }
  body { background: #141412; }
  .card { background: #1c1c18; }
  input, select, textarea { background: #1c1c18; color: var(--ink); border-color: var(--border); }
  .sidebar { background: #111110; }
  .nav { background: #111110; }
  table thead th { background: #1c1c18; }
  .feature-card, .pricing-card, .seed-card, .animal-card { background: #1c1c18; }
  .stat-card { background: #1c1c18; }
  .hero { background: #111110; }
}

/* Manual dark mode toggle */
body.dark-mode {
  --forest:    #2d5443;
  --parchment: #1e1e1a;
  --cream:     #141412;
  --ink:       #e8e4dc;
  --mid:       #9a9a8a;
  --border:    #2e2e28;
  --white:     #1c1c18;
  background:  #141412;
}
body.dark-mode .card,
body.dark-mode .stat-card,
body.dark-mode .seed-card,
body.dark-mode .feature-card { background: #1c1c18; border-color: #2e2e28; }
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea { background: #1c1c18; color: var(--ink); border-color: #2e2e28; }
body.dark-mode .sidebar { background: #111110; }
body.dark-mode .nav  { background: #111110; }

/* Dark mode toggle button */
.dark-toggle {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 44px; height: 44px;
  background: var(--forest); color: var(--text-inverse);
  border: none; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 2px 12px var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; transition: transform .2s;
}
.dark-toggle:hover { transform: scale(1.1); }

/* ============================================
   PWA INSTALL PROMPT
   ============================================ */
.pwa-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--forest); color: var(--text-inverse);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; z-index: 300;
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
  transform: translateY(100%);
  transition: transform .3s ease;
}
.pwa-banner.show { transform: translateY(0); }
.pwa-banner p { margin: 0; font-size: .9rem; }
.pwa-banner .pwa-close { background: none; border: none; color: rgba(245,240,232,.6); font-size: 1.2rem; cursor: pointer; }
