/**
 * OnePercent - Shared Styles
 * Version: 1.0.0
 * 
 * Contents:
 * 1. CSS Variables
 * 2. Reset & Base
 * 3. Typography
 * 4. Layout
 * 5. Navigation (with mobile hamburger)
 * 6. Components (buttons, cards, forms)
 * 7. Utilities & Accessibility
 * 8. Animations
 * 9. Mobile Responsive
 */

/* ==========================================================================
   1. CSS Variables
   ========================================================================== */
:root {
  /* Colors */
  --bg: #f3f1e8;
  --bg-2: #fcfaf7;
  --ink: #191919;
  --muted: #4a4a4a; /* Improved contrast from #5a5a5a */
  --rule: rgba(25, 25, 25, 0.14);
  --accent: #cc5a38;
  --accent-light: color-mix(in srgb, var(--accent) 10%, var(--bg) 90%);
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --error: #c62828;
  --error-light: #ffebee;
  
  /* Layout */
  --maxw: 1120px;
  --radius: 14px;
  --nav-height: 68px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* ==========================================================================
   3. Typography
   ========================================================================== */
.h-eyebrow {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 14px;
}

.h1 {
  font-family: "Crimson Pro", serif;
  font-weight: 600;
  font-size: 52px;
  line-height: 1.06;
  margin: 0 0 16px;
}

.h2 {
  font-family: "Crimson Pro", serif;
  font-weight: 600;
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 12px;
}

.h3 {
  font-family: "Crimson Pro", serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 10px;
}

.lede {
  font-size: 17px;
  line-height: 1.6;
  color: #2b2b2b;
  margin: 0 0 26px;
  max-width: 62ch;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   4. Layout
   ========================================================================== */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

.section {
  padding: 72px 0;
}

.hero {
  padding: 120px 0 80px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.divider {
  height: 1px;
  background: var(--rule);
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, white 8%);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.brand-mark {
  font-family: "Crimson Pro", serif;
  font-weight: 600;
  font-size: 20px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--ink);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   6. Components
   ========================================================================== */

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--bg-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  min-height: 44px; /* Touch-friendly */
}

.button:hover {
  background: #fff;
  border-color: var(--ink);
  color: var(--ink);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-primary {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule) 45%);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-2) 92%);
  color: #a33b1f;
}

.button-primary:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-2) 85%);
  border-color: var(--accent);
  color: #a33b1f;
}

.button-large {
  padding: 16px 32px;
  font-size: 16px;
}

/* Button Loading State */
.button.loading {
  pointer-events: none;
}

.button .button-text {
  transition: opacity 0.2s;
}

.button.loading .button-text {
  opacity: 0;
}

.button .button-spinner {
  display: none;
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.button.loading .button-spinner {
  display: block;
}

/* Cards */
.card {
  background: rgba(252, 250, 247, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card h3 {
  font-family: "Crimson Pro", serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 10px;
  color: var(--ink);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Card Hover Effects (for grids) */
.grid:hover .card {
  filter: blur(3px) grayscale(100%);
  opacity: 0.4;
  transform: scale(0.98);
}

.grid .card:hover {
  filter: none;
  opacity: 1;
  transform: scale(1.02);
  background: var(--bg-2);
  border-color: var(--ink);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Error Messages */
.error-message {
  background: var(--error-light);
  border: 1px solid var(--error);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  color: var(--error);
}

.error-message p {
  margin: 0 0 12px;
  color: var(--error);
}

.error-message .button {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.error-message .button:hover {
  background: #b71c1c;
}

/* Success Messages */
.success-message {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  color: var(--success);
}

/* Info Box */
.info-box {
  background: rgba(204, 90, 56, 0.08);
  border: 1px solid rgba(204, 90, 56, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Footer */
.footer {
  padding: 34px 0 46px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 13px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
}

/* ==========================================================================
   7. Utilities & Accessibility
   ========================================================================== */

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* Visually Hidden (for screen readers) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus States */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* ==========================================================================
   8. Animations
   ========================================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.scale-in {
  animation: scaleIn 0.4s ease-out forwards;
}

/* ==========================================================================
   9. Mobile Responsive
   ========================================================================== */
@media (max-width: 768px) {
  /* Typography */
  .h1 { font-size: 36px; }
  .h2 { font-size: 28px; }
  .lede { font-size: 16px; }
  
  /* Layout */
  .container { padding: 0 20px; }
  .section { padding: 48px 0; }
  .hero { padding: 80px 0 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  
  /* Navigation - Mobile */
  .hamburger {
    display: flex;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid var(--rule);
    gap: 0;
  }
  
  .nav-links.open {
    display: flex;
  }
  
  .nav-links a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }
  
  .nav-links a:last-child {
    border-bottom: none;
  }
  
  .nav-links .button {
    margin-top: 12px;
    width: 100%;
  }
  
  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .footer .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    margin-top: 16px;
  }
  
  .footer .nav-links a {
    padding: 0;
    border: none;
  }
}

@media (max-width: 480px) {
  .h1 { font-size: 28px; }
  .button { width: 100%; }
}
