/* Thrifty Living Hub — design system */
:root {
  --brand: #58a467;
  --brand-dark: #458554;
  --brand-soft: #e8f4ea;
  --ink: #1a2e1f;
  --text: #243529;
  --muted: #5c6b62;
  --border: #d8e5da;
  --surface: #ffffff;
  --page-bg: #f6faf7;
  --shadow-sm: 0 1px 3px rgba(26, 46, 31, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 46, 31, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 4.25rem;
  --nav-break: 768px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--page-bg);
}

body.nav-open {
  overflow: hidden;
}

a {
  color: var(--brand-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--brand);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -100px;
  padding: 0.5rem 1rem;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 1000;
}

.skip-link:focus {
  top: 0.75rem;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.65rem 0;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand:hover {
  opacity: 0.92;
}

.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(220px, 52vw);
  object-fit: contain;
}

.brand-logo--footer {
  height: 36px;
  max-width: 180px;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-toggle:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.nav-toggle-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 1.25rem;
}

.nav-toggle-bars span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.is-menu-open .nav-toggle-bars span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header.is-menu-open .nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}

.site-header.is-menu-open .nav-toggle-bars span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Desktop nav + mobile panel */
.nav-backdrop {
  position: fixed;
  inset: 0;
  top: var(--header-h);
  background: rgba(26, 46, 31, 0.35);
  z-index: 90;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  appearance: none;
}

.nav-panel {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.primary-nav .nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

.primary-nav a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0;
}

.primary-nav a:hover {
  color: var(--brand-dark);
}

.nav-cta {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(88, 164, 103, 0.35);
}

.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--brand-dark);
  border-color: var(--brand);
}

.btn-outline:hover {
  background: var(--brand-soft);
  color: var(--ink);
}

button.btn {
  font: inherit;
}

/* —— Main & typography —— */
main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.page-hero {
  margin-bottom: 2rem;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, var(--brand-soft) 0%, #fff 55%, var(--brand-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.page-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.page-hero p {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
}

h1 {
  font-size: clamp(1.65rem, 3.5vw, 2rem);
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2 {
  font-size: 1.35rem;
  color: var(--ink);
  margin-top: 1.5rem;
}

h3 {
  font-size: 1.1rem;
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.card,
.callout,
.ad-slot,
.disclosure {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card h2:first-child,
.card h1:first-child {
  margin-top: 0;
}

.disclosure {
  background: #fff9f0;
  border-color: #e8dcc4;
  font-size: 0.95rem;
  color: #5c4d38;
}

.callout {
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
}

.callout a:not(.btn) {
  font-weight: 600;
}

.ad-slot {
  background: linear-gradient(180deg, #f0f4f1 0%, #fafcfa);
  color: var(--muted);
  font-size: 0.95rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

/* Forms */
form.card label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

input[type="search"],
input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  margin-bottom: 0.75rem;
  background: var(--surface);
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(88, 164, 103, 0.2);
  outline: none;
}

button[type="submit"],
.card .btn {
  margin-top: 0.25rem;
}

/* Newsletter CTA card link */
a.card[data-newsletter-cta] {
  display: block;
  text-align: center;
  font-weight: 600;
  color: var(--brand-dark);
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

a.card[data-newsletter-cta]:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

/* —— Footer —— */
.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 1.5rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 700px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.footer-tagline {
  margin: 0.75rem 0 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.footer-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand-dark);
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.footer-copy {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Mobile navigation */
@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  .nav-panel {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: min(300px, 88vw);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1.25rem 1.25rem 2rem;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 95;
    overflow-y: auto;
  }

  .site-header.is-menu-open .nav-panel {
    transform: translateX(0);
  }

  .primary-nav {
    width: 100%;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
  }

  .primary-nav .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .primary-nav .nav-list li {
    border-bottom: 1px solid var(--border);
  }

  .primary-nav .nav-list li:last-child {
    border-bottom: 0;
  }

  .primary-nav a {
    display: block;
    padding: 0.85rem 0;
    font-size: 1rem;
  }

  .nav-cta {
    width: 100%;
    justify-content: center;
  }

  .nav-backdrop {
    top: var(--header-h);
  }
}

@media (min-width: 768px) {
  .nav-backdrop {
    display: none !important;
  }
}
