/* ==========================================================
   Tuck & Train — Design System & Global Styles
   A muted, warm, editorial aesthetic for small-space fitness.
   ========================================================== */

/* --- Custom Properties (Design Tokens) --- */
:root {
  /* Palette — warm neutrals + sage accent */
  --color-bg:          #F6F3EF;
  --color-bg-alt:      #EDE9E3;
  --color-surface:     #FFFFFF;
  --color-border:      #D6D0C8;
  --color-border-light:#E8E4DD;

  --color-text:        #2E2C29;
  --color-text-muted:  #6B665E;
  --color-text-light:  #908A80;

  --color-accent:      #6B8F71;   /* sage green */
  --color-accent-hover:#567358;
  --color-accent-light:#E3EDE4;

  --color-warm:        #C27B4A;   /* terracotta — secondary */
  --color-warm-light:  #F5EAE0;

  --color-danger:      #B85450;
  --color-info:        #5B7FA5;

  /* Typography */
  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Type Scale (major-third ≈ 1.25) */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-md:   1.125rem;   /* 18px */
  --text-lg:   1.25rem;    /* 20px */
  --text-xl:   1.5rem;     /* 24px */
  --text-2xl:  1.875rem;   /* 30px */
  --text-3xl:  2.25rem;    /* 36px */
  --text-4xl:  3rem;       /* 48px */

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --max-width:  72rem;  /* 1152px */
  --max-narrow: 44rem;  /* 704px */
  --radius:     6px;
  --radius-lg:  10px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(46,44,41,0.06);
  --shadow-md:  0 4px 12px rgba(46,44,41,0.08);
  --shadow-lg:  0 8px 24px rgba(46,44,41,0.10);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;
}

/* --- Reset & Base --- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

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

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--color-accent-hover); }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 2px; }

/* --- Skip Link --- */
.skip-link {
  position: absolute; top: -100%; left: var(--space-4);
  background: var(--color-accent); color: #fff;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius);
  font-weight: 600; z-index: 1000;
}
.skip-link:focus { top: var(--space-4); }

/* --- Typography --- */
h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-heading);
  font-weight: 700; line-height: 1.2;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl);  }
h5 { font-size: var(--text-lg);  }
h6 { font-size: var(--text-md);  }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

.lead { font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.6; }
.caption { font-size: var(--text-sm); color: var(--color-text-light); }
.overline {
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.12em; font-weight: 600;
  color: var(--color-text-light);
}

/* Section Numbers (01 / 02 / 03 editorial style) */
.section-number {
  display: block; font-size: var(--text-sm); font-weight: 700;
  color: var(--color-accent); letter-spacing: 0.1em;
  margin-bottom: var(--space-2); font-family: var(--font-mono);
}

/* --- Layout --- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-6); }
.narrow { max-width: var(--max-narrow); }
.section { padding: var(--space-16) 0; }
.section + .section { padding-top: 0; }

.grid {
  display: grid; gap: var(--space-8);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }

/* --- Header & Navigation --- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246,243,239,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max-width); margin: 0 auto;
  padding: var(--space-4) var(--space-6); gap: var(--space-8);
}
.site-logo {
  font-size: var(--text-lg); font-weight: 700;
  color: var(--color-text); letter-spacing: -0.02em;
  display: flex; align-items: center; gap: var(--space-2);
}
.site-logo:hover { color: var(--color-accent); }
.site-logo svg { width: 28px; height: 28px; }

.nav-menu { display: flex; align-items: center; gap: var(--space-6); list-style: none; }
.nav-menu a {
  font-size: var(--text-sm); font-weight: 500;
  color: var(--color-text-muted); transition: color var(--duration) var(--ease);
}
.nav-menu a:hover,
.nav-menu a[aria-current="page"] { color: var(--color-accent); }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--color-text); padding: var(--space-2);
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 48rem) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-6); gap: var(--space-4);
    box-shadow: var(--shadow-md);
  }
  .nav-menu.open { display: flex; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-6); border-radius: var(--radius);
  font-size: var(--text-sm); font-weight: 600; line-height: 1;
  cursor: pointer; border: none; transition: all var(--duration) var(--ease);
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

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

.btn-secondary {
  background: transparent; color: var(--color-accent);
  border: 1px solid var(--color-accent);
}
.btn-secondary:hover { background: var(--color-accent-light); }

.btn-warm {
  background: var(--color-warm); color: #fff;
}
.btn-warm:hover { background: #A86A3F; color: #fff; }

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: box-shadow var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.card-subtitle { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-4); }
.card-body { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.6; }

/* Product Card */
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration) var(--ease);
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-card-img {
  background: var(--color-bg-alt);
  aspect-ratio: 4/3; display: flex;
  align-items: center; justify-content: center;
  color: var(--color-text-light); font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-light);
}
.product-card-body { padding: var(--space-6); }
.product-card-title { font-size: var(--text-md); margin-bottom: var(--space-1); }
.product-card-meta { font-size: var(--text-xs); color: var(--color-text-light); margin-bottom: var(--space-4); }
.product-card-specs { list-style: none; margin-bottom: var(--space-4); }
.product-card-specs li {
  font-size: var(--text-sm); color: var(--color-text-muted);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-border-light);
  display: flex; gap: var(--space-2); align-items: baseline;
}
.product-card-specs li:last-child { border-bottom: none; }
.product-card-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* Inline affiliate disclosure */
.affiliate-note {
  font-size: var(--text-xs); color: var(--color-text-light);
  font-style: italic; margin-top: var(--space-2);
}

/* --- Disclaimer Banner --- */
.disclaimer-banner {
  background: var(--color-warm-light);
  border-left: 3px solid var(--color-warm);
  padding: var(--space-4) var(--space-6);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: var(--space-8) 0;
}
.disclaimer-banner p {
  font-size: var(--text-sm); color: var(--color-text-muted);
  line-height: 1.6; margin: 0;
}
.disclaimer-banner strong { color: var(--color-text); }

/* --- Hero --- */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
}
.hero h1 { margin-bottom: var(--space-4); }
.hero .lead { max-width: 36rem; margin: 0 auto var(--space-8); }
.hero-actions { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }

/* --- Feature Grid --- */
.feature-item {
  text-align: center; padding: var(--space-8);
}
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--color-accent-light); color: var(--color-accent);
  margin-bottom: var(--space-4);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature-title { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.feature-desc { font-size: var(--text-sm); color: var(--color-text-muted); }

/* --- Footer --- */
.site-footer {
  background: var(--color-text);
  color: rgba(255,255,255,0.7);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: var(--space-16);
}
.footer-grid {
  display: grid; gap: var(--space-8);
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin-bottom: var(--space-12);
}
@media (max-width: 48rem) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 30rem) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-brand { font-size: var(--text-lg); font-weight: 700; color: #fff; margin-bottom: var(--space-3); }
.footer-desc { font-size: var(--text-sm); line-height: 1.6; }
.footer-heading {
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.4);
  margin-bottom: var(--space-4); font-weight: 600;
}
.footer-links { list-style: none; }
.footer-links li { margin-bottom: var(--space-2); }
.footer-links a { color: rgba(255,255,255,0.7); font-size: var(--text-sm); }
.footer-links a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-8);
}
.footer-legal { font-size: var(--text-xs); color: rgba(255,255,255,0.4); line-height: 1.8; }
.footer-legal p { margin-bottom: var(--space-2); }
.footer-legal a { color: rgba(255,255,255,0.5); }
.footer-legal a:hover { color: #fff; }

/* --- Breadcrumb --- */
.breadcrumb {
  padding: var(--space-4) 0; font-size: var(--text-sm);
  color: var(--color-text-light);
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb span { margin: 0 var(--space-2); }

/* --- Page Header --- */
.page-header {
  padding: var(--space-12) 0 var(--space-8);
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: var(--space-12);
}
.page-header h1 { font-size: var(--text-3xl); margin-bottom: var(--space-3); }
.page-header .lead { max-width: 40rem; }

/* --- Prose --- */
.prose { max-width: var(--max-narrow); }
.prose h2 { font-size: var(--text-2xl); margin: var(--space-12) 0 var(--space-4); }
.prose h3 { font-size: var(--text-xl); margin: var(--space-8) 0 var(--space-3); }
.prose p { margin-bottom: var(--space-4); color: var(--color-text-muted); }
.prose ul, .prose ol { margin-bottom: var(--space-4); padding-left: var(--space-6); color: var(--color-text-muted); }
.prose li { margin-bottom: var(--space-2); }
.prose a { text-decoration: underline; text-decoration-color: var(--color-accent-light); text-underline-offset: 2px; }
.prose a:hover { text-decoration-color: var(--color-accent); }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0; }

/* --- Fade-in animation --- */
.fade-in { opacity: 0; transform: translateY(12px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* --- Tool placeholder --- */
.tool-placeholder {
  background: var(--color-bg-alt);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  text-align: center;
  color: var(--color-text-light);
}
.tool-placeholder svg { margin: 0 auto var(--space-4); opacity: 0.4; }
.tool-placeholder h3 { color: var(--color-text-muted); margin-bottom: var(--space-2); }
.tool-placeholder p { font-size: var(--text-sm); max-width: 28rem; margin: 0 auto; }

/* --- Empty State (guides/compare listing pages) --- */
.empty-state {
  text-align: center; padding: var(--space-20) var(--space-8);
}
.empty-state svg { margin: 0 auto var(--space-6); opacity: 0.3; }
.empty-state h3 { margin-bottom: var(--space-3); }
.empty-state p { color: var(--color-text-muted); max-width: 28rem; margin: 0 auto; }

/* --- Tags --- */
.tag {
  display: inline-block; font-size: var(--text-xs); font-weight: 600;
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent-light); color: var(--color-accent);
  border-radius: 100px;
}
.tag-warm {
  background: var(--color-warm-light); color: var(--color-warm);
}

/* --- Tables (comparison spec tables) --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  table-layout: fixed;
}
.spec-table th,
.spec-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border-light);
}
.spec-table thead th {
  background: var(--color-bg-alt);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
}
.spec-table thead th:first-child {
  width: 30%;
}
.spec-table thead th:not(:first-child) {
  width: 35%;
}
.spec-table tbody tr:last-child td {
  border-bottom: none;
}
.spec-table tbody tr:hover {
  background: var(--color-bg-alt);
}
.spec-table td:first-child {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}
.spec-table td:first-child strong {
  color: var(--color-text);
  font-size: var(--text-sm);
}
/* Responsive: stack on small screens */
@media (max-width: 580px) {
  .spec-table {
    table-layout: auto;
  }
  .spec-table thead th:first-child,
  .spec-table thead th:not(:first-child) {
    width: auto;
  }
  .spec-table th,
  .spec-table td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}
