/* =====================================================
   WEST PIKE — Vineyard Comparable Sales
   Brand-aligned responsive stylesheet
   ===================================================== */

/* --- Custom Properties --- */
:root {
  --forest: #254516;
  --forest-rgb: 37, 69, 22;
  --hops: #81983c;
  --hops-rgb: 129, 152, 60;
  --chardonnay: #cba003;
  --chardonnay-rgb: 203, 160, 3;
  --alabaster: #f3f1e0;
  --alabaster-rgb: 243, 241, 224;
  --slate: #282829;
  --slate-rgb: 40, 40, 41;

  --font-headline: 'Playfair Display', Georgia, serif;
  --font-body: 'Karla', system-ui, -apple-system, sans-serif;

  --max-width: 1320px;
  --section-pad: clamp(60px, 8vw, 120px);
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.25s ease;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--slate);
  background: var(--alabaster);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--forest); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--hops); }

/* --- Accessibility --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--forest);
  color: var(--alabaster);
  padding: 8px 16px;
  border-radius: var(--radius);
  z-index: 9999;
  font-weight: 600;
}
.skip-link:focus { top: 16px; }

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

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

/* --- Navigation --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(37, 69, 22, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(129, 152, 60, 0.3);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  color: var(--alabaster);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand .divider {
  width: 2px;
  height: 20px;
  background: var(--hops);
  display: inline-block;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
}

.nav-links a {
  color: rgba(243, 241, 224, 0.8);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--alabaster);
  background: rgba(129, 152, 60, 0.25);
}

.nav-linkedin {
  display: flex;
  align-items: center;
  padding: 8px 10px !important;
}

.nav-linkedin svg { opacity: 0.7; transition: opacity var(--transition); }
.nav-linkedin:hover svg { opacity: 1; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--alabaster);
  margin: 5px 0;
  transition: all var(--transition);
}

/* --- Hero --- */
.hero {
  background: var(--forest);
  padding: calc(64px + var(--section-pad)) 24px var(--section-pad);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(129, 152, 60, 0.15) 0%, transparent 70%),
              radial-gradient(ellipse at 70% 80%, rgba(203, 160, 3, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }

.hero h1 {
  font-family: var(--font-headline);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  color: var(--alabaster);
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero .subtitle {
  font-family: var(--font-body);
  font-size: clamp(15px, 2vw, 18px);
  color: rgba(243, 241, 224, 0.75);
  font-weight: 400;
  margin-bottom: 40px;
}

/* --- Stats Row --- */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  font-family: var(--font-headline);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--chardonnay);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(243, 241, 224, 0.6);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

/* --- Search & Filter Bar --- */
.controls-section {
  position: sticky;
  top: 64px;
  z-index: 900;
  background: rgba(243, 241, 224, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(37, 69, 22, 0.1);
  padding: 16px 24px;
}

.controls-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 2px solid rgba(37, 69, 22, 0.15);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  background: white;
  color: var(--slate);
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--hops);
  outline: none;
}

.search-box input::placeholder { color: rgba(40, 40, 41, 0.4); }

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: rgba(40, 40, 41, 0.35);
  pointer-events: none;
}

.filter-select {
  padding: 10px 36px 10px 14px;
  border: 2px solid rgba(37, 69, 22, 0.15);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23282829' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  -webkit-appearance: none;
  color: var(--slate);
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 160px;
}

.filter-select:focus {
  border-color: var(--hops);
  outline: none;
}

.results-count {
  font-size: 13px;
  color: rgba(40, 40, 41, 0.55);
  font-weight: 500;
  white-space: nowrap;
  margin-left: auto;
}

.results-count strong { color: var(--forest); font-weight: 700; }

/* --- Tab Navigation --- */
.tab-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 24px 0;
}

.tab-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(40, 40, 41, 0.5);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tab-btn:hover { color: var(--slate); }

.tab-btn.active {
  color: var(--forest);
  border-bottom-color: var(--hops);
}

.tab-badge {
  display: inline-block;
  background: var(--hops);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

/* --- Data Tables --- */
.table-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

.comp-table thead th {
  background: var(--forest);
  color: var(--alabaster);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.comp-table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.comp-table thead th:last-child { border-radius: 0 var(--radius) 0 0; }

.comp-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.comp-table thead th.sortable:hover {
  background: rgba(37, 69, 22, 0.85);
}

.comp-table thead th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
  vertical-align: middle;
}

.comp-table thead th.sort-asc .sort-icon,
.comp-table thead th.sort-desc .sort-icon { opacity: 1; }

.comp-table tbody tr {
  border-bottom: 1px solid rgba(37, 69, 22, 0.06);
  transition: background var(--transition);
}

.comp-table tbody tr:nth-child(even) { background: rgba(243, 241, 224, 0.4); }
.comp-table tbody tr:hover { background: rgba(129, 152, 60, 0.08); }

.comp-table tbody td {
  padding: 10px 16px;
  vertical-align: top;
  color: var(--slate);
}

.comp-table tbody td.ppa-cell {
  font-weight: 700;
  color: var(--forest);
  white-space: nowrap;
}

.comp-table tbody td.price-cell {
  font-weight: 600;
  white-space: nowrap;
}

.comp-table tbody td.notes-cell {
  font-size: 12px;
  color: rgba(40, 40, 41, 0.65);
  max-width: 280px;
  line-height: 1.4;
}

.comp-table tbody td.buyer-cell {
  font-weight: 500;
}

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-closed { background: rgba(37, 69, 22, 0.1); color: var(--forest); }
.status-active { background: rgba(203, 160, 3, 0.15); color: #8a6d00; }
.status-expired { background: rgba(40, 40, 41, 0.08); color: rgba(40, 40, 41, 0.5); }

/* --- Summary Cards --- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.summary-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--hops);
}

.summary-card .card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(40, 40, 41, 0.45);
  margin-bottom: 4px;
}

.summary-card .card-value {
  font-family: var(--font-headline);
  font-size: 24px;
  font-weight: 700;
  color: var(--forest);
}

.summary-card .card-sub {
  font-size: 12px;
  color: rgba(40, 40, 41, 0.5);
  margin-top: 2px;
}

/* --- No Results --- */
.no-results {
  text-align: center;
  padding: 60px 24px;
  color: rgba(40, 40, 41, 0.45);
}

.no-results svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.no-results p { font-size: 15px; }

/* --- AVA Pricing Chart Section --- */
.ava-chart-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.ava-chart-container {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-top: 16px;
}

.ava-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.ava-bar-label {
  width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  text-align: right;
}

.ava-bar-track {
  flex: 1;
  height: 28px;
  background: rgba(243, 241, 224, 0.6);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.ava-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--forest), var(--hops));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  min-width: 60px;
  transition: width 0.6s ease;
}

.ava-bar-value {
  font-size: 11px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

.ava-bar-comps {
  font-size: 11px;
  color: rgba(40, 40, 41, 0.4);
  width: 80px;
  flex-shrink: 0;
}

/* --- Footer --- */
.site-footer {
  background: var(--forest);
  padding: 48px 24px 32px;
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 32px;
}

.footer-brand {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
  color: var(--alabaster);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.footer-text {
  font-size: 13px;
  color: rgba(243, 241, 224, 0.55);
  line-height: 1.6;
  max-width: 400px;
}

.footer-links {
  list-style: none;
}

.footer-links li { margin-bottom: 8px; }

.footer-links a {
  font-size: 13px;
  color: rgba(243, 241, 224, 0.6);
  transition: color var(--transition);
}

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

.footer-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-linkedin svg { vertical-align: middle; }

.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(129, 152, 60, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-bottom p {
  font-size: 12px;
  color: rgba(243, 241, 224, 0.4);
}

.disclaimer {
  max-width: var(--max-width);
  margin: 24px auto 0;
  padding: 16px 0;
  border-top: 1px solid rgba(129, 152, 60, 0.15);
  font-size: 11px;
  color: rgba(243, 241, 224, 0.35);
  line-height: 1.6;
}

/* --- Hidden Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1024px) {
  .stats-row { gap: 32px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .ava-bar-label { width: 120px; font-size: 12px; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(37, 69, 22, 0.98);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    transform: translateY(-120%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }

  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 16px; font-size: 14px; }

  .controls-inner { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
  .filter-select { width: 100%; }
  .results-count { margin-left: 0; text-align: center; }

  .tab-nav { gap: 0; }
  .tab-btn { padding: 8px 14px; font-size: 11px; }

  .summary-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-card { padding: 14px 16px; }
  .summary-card .card-value { font-size: 20px; }

  .hero h1 { font-size: clamp(26px, 6vw, 40px); }

  .footer-inner { flex-direction: column; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .ava-bar-row { flex-wrap: wrap; }
  .ava-bar-label { width: 100%; text-align: left; font-size: 12px; }
  .ava-bar-comps { width: auto; }
}

@media (max-width: 480px) {
  .stats-row { gap: 20px; }
  .stat-number { font-size: 24px; }
  .hero { padding-top: calc(64px + 40px); padding-bottom: 40px; }
  .summary-cards { grid-template-columns: 1fr; }
  .controls-section { padding: 12px 16px; }
  .tab-section { padding: 16px 16px 0; }
  .table-section { padding: 0 16px 32px; }
  .ava-chart-container { padding: 20px 16px; }
}
