/* Ridgebase Analytics — Brass Mechanism theme */

:root {
  --gold: #c9a227;
  --gold-light: #dfc56a;
  --gold-dark: #8b6914;
  --tobacco: #5c4033;
  --tobacco-light: #8b7355;
  --oxidized: #5c7a6a;
  --oxidized-dark: #3d5248;
  --charcoal: #1a1814;
  --charcoal-mid: #2a2620;
  --charcoal-light: #3d3830;
  --ivory: #f5f0e6;
  --ivory-muted: #d9d0c0;
  --steel: #8a9099;
  --walnut: #3d2b1f;
  --error: #a04444;
  --success: #4a7356;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --radius: 3px;
  --shadow: 0 2px 12px rgba(26, 24, 20, 0.25);
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ivory);
  background: var(--charcoal);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(201, 162, 39, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(92, 122, 106, 0.05) 0%, transparent 50%);
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  margin-top: 0;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 var(--space-sm); }

ul, ol { padding-left: 1.25rem; }

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-sm);
  background: var(--gold);
  color: var(--charcoal);
  padding: var(--space-xs) var(--space-sm);
  z-index: 9999;
}

.skip-link:focus {
  top: var(--space-sm);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 24, 20, 0.95);
  border-bottom: 1px solid var(--tobacco);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--ivory);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.2rem;
}

.brand-mark:hover { color: var(--gold-light); }

.brand-emblem { color: var(--gold); flex-shrink: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--tobacco-light);
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  transition: var(--transition);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}

.nav-list a {
  color: var(--ivory-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.nav-cta {
  border: 1px solid var(--gold-dark) !important;
  padding: 0.4rem 0.85rem !important;
  background: linear-gradient(180deg, var(--charcoal-light) 0%, var(--charcoal-mid) 100%);
  color: var(--gold-light) !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--charcoal-light) 0%, var(--walnut) 100%);
  color: var(--gold-light);
  transition: var(--transition);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent, var(--gold-dark), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::before { opacity: 0.3; }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-dark) 0%, var(--tobacco) 100%);
  color: var(--ivory);
  border-color: var(--gold);
}

.btn-secondary {
  background: transparent;
  border-color: var(--tobacco-light);
  color: var(--ivory-muted);
}

.btn-accept {
  background: linear-gradient(180deg, var(--oxidized-dark) 0%, var(--oxidized) 100%);
  border-color: var(--oxidized);
  color: var(--ivory);
}

.btn-reject {
  background: transparent;
  border-color: var(--tobacco-light);
  color: var(--ivory-muted);
}

.btn:active {
  transform: scale(0.98);
}

/* Main layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}

.section {
  margin-bottom: var(--space-xl);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--oxidized);
  margin-bottom: var(--space-xs);
}

.section-label::before {
  content: "§ ";
  color: var(--gold-dark);
}

/* Hero variants */
.hero-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: center;
  padding: var(--space-lg);
  background: var(--charcoal-mid);
  border: 1px solid var(--tobacco);
  border-radius: var(--radius);
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gold-dark);
  border-radius: 50%;
  opacity: 0.4;
  pointer-events: none;
}

.hero-stat-row {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ivory-muted);
}

.hero-stat-row span {
  border-left: 2px solid var(--gold-dark);
  padding-left: var(--space-xs);
}

.hero-image {
  border: 1px solid var(--tobacco-light);
  border-radius: var(--radius);
  aspect-ratio: 4/3;
  object-fit: cover;
}

.hero-compact {
  text-align: left;
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--tobacco);
  margin-bottom: var(--space-xl);
}

.hero-compact h1 {
  max-width: 18ch;
}

/* Cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.card {
  background: var(--charcoal-mid);
  border: 1px solid var(--tobacco);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--gold-dark);
}

.card-image {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.card-body {
  padding: var(--space-md);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--oxidized);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.card-title a {
  color: var(--ivory);
  text-decoration: none;
}

.card-title a:hover { color: var(--gold-light); }

/* Chart accent blocks */
.chart-block {
  background: var(--charcoal-mid);
  border: 1px solid var(--tobacco);
  padding: var(--space-md);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  margin: var(--space-sm) 0;
}

.chart-bar span {
  flex: 1;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: 2px 2px 0 0;
  min-height: 8px;
}

.chart-bar span:nth-child(2) { height: 65%; opacity: 0.85; }
.chart-bar span:nth-child(3) { height: 45%; opacity: 0.7; }
.chart-bar span:nth-child(4) { height: 78%; opacity: 0.9; }
.chart-bar span:nth-child(5) { height: 55%; opacity: 0.75; }
.chart-bar span:nth-child(6) { height: 90%; }

/* Testimonials */
.testimonial {
  border-left: 3px solid var(--gold-dark);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: rgba(42, 38, 32, 0.5);
}

.testimonial cite {
  display: block;
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-style: normal;
  color: var(--ivory-muted);
}

.testimonial-long {
  padding: var(--space-lg);
  border: 1px solid var(--tobacco);
  border-radius: var(--radius);
  margin-bottom: var(--space-lg);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  color: var(--ivory-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--charcoal);
  border: 1px solid var(--tobacco-light);
  border-radius: var(--radius);
  color: var(--ivory);
  font-family: var(--font-display);
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

.form-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-success {
  background: rgba(74, 115, 86, 0.2);
  border: 1px solid var(--success);
  padding: var(--space-md);
  border-radius: var(--radius);
  color: var(--ivory);
}

.form-failure {
  background: rgba(160, 68, 68, 0.2);
  border: 1px solid var(--error);
  padding: var(--space-md);
  border-radius: var(--radius);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-xl);
}

.contact-block address {
  font-style: normal;
  line-height: 1.8;
}

/* Legal pages */
.legal-content h2 {
  margin-top: var(--space-lg);
  font-size: 1.35rem;
}

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.95rem;
}

.legal-content th,
.legal-content td {
  border: 1px solid var(--tobacco);
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
}

.legal-content th {
  background: var(--charcoal-mid);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Footer */
.site-footer {
  background: var(--charcoal-mid);
  border-top: 1px solid var(--tobacco);
  margin-top: var(--space-xl);
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.footer-brand {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.footer-tagline {
  font-size: 0.95rem;
  color: var(--ivory-muted);
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: var(--space-sm);
}

.footer-address,
.footer-links {
  font-size: 0.95rem;
  color: var(--ivory-muted);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li { margin-bottom: 0.35rem; }

.footer-links a {
  color: var(--ivory-muted);
  text-decoration: none;
}

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

.footer-bottom {
  border-top: 1px solid var(--tobacco);
  padding: var(--space-md);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ivory-muted);
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--charcoal-mid);
  border-top: 2px solid var(--gold-dark);
  padding: var(--space-md);
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.cookie-inner {
  max-width: 900px;
  margin: 0 auto;
}

.cookie-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.cookie-desc {
  font-size: 0.95rem;
  color: var(--ivory-muted);
  margin-bottom: var(--space-sm);
}

.cookie-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cookie-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: var(--space-xs);
}

/* Pricing table */
.rate-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
}

.rate-table th,
.rate-table td {
  border: 1px solid var(--tobacco);
  padding: var(--space-sm);
  text-align: left;
}

.rate-table th {
  background: var(--walnut);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.rate-note {
  font-size: 0.9rem;
  color: var(--ivory-muted);
  font-style: italic;
}

/* 404 */
.error-page {
  text-align: center;
  padding: var(--space-xl) 0;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 4rem;
  color: var(--gold-dark);
  line-height: 1;
}

/* Article */
.article-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--tobacco);
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--oxidized);
}

.article-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--tobacco);
}

.prose h2 { margin-top: var(--space-lg); }

/* Field briefings page */
.briefing-timeline {
  position: relative;
  padding-left: var(--space-lg);
  border-left: 2px solid var(--gold-dark);
}

.briefing-item {
  margin-bottom: var(--space-lg);
  position: relative;
}

.briefing-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-lg) - 5px);
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
}

/* Service detail */
.service-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.service-detail-list {
  list-style: none;
  padding: 0;
}

.service-detail-list li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--tobacco);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.service-detail-list strong {
  color: var(--gold-light);
  display: inline-block;
  min-width: 140px;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--charcoal-mid);
    border-bottom: 1px solid var(--tobacco);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
  }

  .site-nav.is-open {
    max-height: 400px;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-md);
  }

  .hero-panel,
  .service-hero,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    position: relative;
    flex-wrap: wrap;
  }
}

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