/* ==========================================================================
   Super Food — Malir Cantt, Karachi
   Design System: Warm Alabaster + Charcoal Ink + Ember Rust
   ========================================================================== */

:root {
  --bg: #FAF8F5;
  --surface: #F2EFE9;
  --surface-elevated: #FFFFFF;
  --text: #1C1917;
  --muted: #57534E;
  --primary: #9A3412;
  --primary-hover: #7C2D12;
  --accent-herb: #14532D;
  --accent-herb-bg: #ECFDF5;
  --border: #E4DFD7;
  --error: #991B1B;
  --error-bg: #FEF2F2;
  --focus-ring: #9A3412;

  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --container-max: 1180px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 2rem;
  }
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0 0 0.75rem;
  line-height: 1.18;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.2vw, 3.35rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 2.8vw, 2.25rem);
  letter-spacing: -0.015em;
}

h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
  max-width: 68ch;
}

.lead {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.7;
}

.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.edit-marker {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: #FEF3C7;
  color: #78350F;
  border: 1px dashed #D97706;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

/* Header / Top Bar Contract: 3 zones */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 245, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 68px;
}

.brand-wordmark {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.primary-nav {
  display: none;
  align-items: center;
  gap: 1.75rem;
}

.primary-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.5rem 0.125rem;
  white-space: nowrap;
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

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

.primary-nav a[aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
}

@media (min-width: 860px) {
  .primary-nav {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  gap: 1.5rem;
}

.mobile-drawer[hidden] {
  display: none;
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-list a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.75rem 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-list a[aria-current="page"] {
  color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.35rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background-color: var(--surface-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background-color: var(--surface);
  color: var(--text);
}

.btn-herb {
  background-color: var(--accent-herb);
  color: #FFFFFF;
}

.btn-herb:hover {
  background-color: #0F3F22;
  color: #FFFFFF;
}

.btn-sm {
  min-height: 40px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
}

/* Sections */
.section {
  padding-block: 3.5rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .section {
    padding-block: 5rem;
  }
}

.section-surface {
  background-color: var(--surface);
}

.section-dark {
  background-color: var(--text);
  color: #FAF8F5;
  border-bottom: none;
}

.section-dark h2,
.section-dark h3,
.section-dark p {
  color: #FAF8F5;
}

.section-dark .lead,
.section-dark .muted-light {
  color: #D6D3CD;
}

.section-header {
  max-width: 44rem;
  margin-bottom: 2.5rem;
}

/* Grids */
.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
  align-items: center;
}

@media (min-width: 900px) {
  .split-grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 3.5rem;
  }

  .split-grid.align-stretch {
    align-items: stretch;
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

/* Fact Strip (Below Hero Split) */
.fact-strip {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--border);
  margin-top: 2.75rem;
  padding-top: 2rem;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .fact-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .fact-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

.fact-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.fact-value {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* Cards & Editorial Items */
.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-media {
  padding: 0;
  overflow: hidden;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.editorial-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--border);
}

.editorial-row:last-child {
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .editorial-row {
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 2rem;
  }
}

.chapter-num {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* Image Placeholder Slots (Step 6 compliant) */
.photo-slot {
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.75rem 1.25rem;
  color: var(--muted);
}

.photo-slot.ratio-16x9 {
  aspect-ratio: 16 / 9;
}

.photo-slot.ratio-4x3 {
  aspect-ratio: 4 / 3;
}

.photo-slot.ratio-3x2 {
  aspect-ratio: 3 / 2;
}

.photo-slot.has-image {
  padding: 0;
}

.photo-slot.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media .photo-slot {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.photo-slot-icon {
  width: 44px;
  height: 44px;
  color: var(--primary);
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.photo-slot-file {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.photo-slot-dims {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.35rem;
}

.photo-slot-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 28ch;
  margin: 0;
}

/* Filter Bar (Interactive Buttons) */
.filter-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.filter-btn {
  min-height: 40px;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition);
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08);
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.875rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid #C7C0B5;
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(154, 52, 18, 0.2);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--error);
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

.field-error {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--error);
}

.alert-error {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid #FCA5A5;
  background: var(--error-bg);
  color: var(--error);
  margin-bottom: 1.25rem;
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Page Banner */
.page-head {
  padding-block: 3rem 2.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 3.5rem 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  }
}

.footer-heading {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text);
}

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

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

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
