/* ============================================================
   838 ADVISORY — Design System
   Superhuman-informed dark theme with five-gray surface model
   ============================================================ */

/* --- Design Tokens (v1.1 — brightness revision) --- */
:root {
  /* Surface layers (five-tier model, darkest → lightest, lifted from v1.0 near-black) */
  --bg-app: #181C28;
  --bg-content: #1F2433;
  --bg-card: #283040;
  --bg-hover: #333C50;
  --bg-elevated: #404A60;

  /* Borders (lifted to remain visible on the brighter surface stack) */
  --border: #3D465B;
  --border-subtle: #2C3447;

  /* Primary Accent — Hunter Green (unchanged from v1.0; tints slightly more opaque) */
  --accent: #1B8A5A;
  --accent-light: #2BB673;
  --accent-dark: #126340;
  --accent-bg: rgba(27, 138, 90, 0.20);
  --accent-border: rgba(27, 138, 90, 0.40);
  --accent-glow: rgba(27, 138, 90, 0.14);

  /* Secondary Accent — Burnt Ochre (unchanged from v1.0; tints slightly more opaque) */
  --accent-secondary: #B8651A;
  --accent-secondary-light: #D98142;
  --accent-secondary-dark: #8C4A12;
  --accent-secondary-bg: rgba(184, 101, 26, 0.20);
  --accent-secondary-border: rgba(184, 101, 26, 0.40);

  /* Text (opacity scale bumped, slightly bluer-white base) */
  --text-primary: rgba(248, 250, 253, 0.96);
  --text-secondary: rgba(248, 250, 253, 0.75);
  --text-tertiary: rgba(248, 250, 253, 0.55);
  --text-on-accent: #ffffff;

  /* Typography */
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Animation (Superhuman timing) */
  --transition-fast: 150ms ease-out;
  --transition-med: 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow: 300ms ease-out;

  /* Layout */
  --max-width: 1120px;
  --nav-height: 72px;
  --section-padding: clamp(64px, 10vw, 120px);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 24px); }
body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.040) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.040) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition-fast); }
a:hover { opacity: 0.85; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
h4 { font-size: 0.95rem; font-weight: 500; }

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(24, 28, 40, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-logo:hover { opacity: 1; }
.nav-logo .logo-accent { color: var(--accent); }
.nav-logo img {
  height: 36px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  opacity: 1;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--accent);
  color: var(--text-on-accent) !important;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.nav-cta:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: var(--accent-secondary);
  box-shadow: 0 4px 16px var(--accent-secondary-bg);
}

/* Mobile menu */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-primary:hover {
  opacity: 1;
  transform: translateY(-2px);
  background: var(--accent-secondary);
  box-shadow: 0 6px 24px var(--accent-secondary-bg);
}
.btn-primary .arrow { transition: transform var(--transition-fast); }
.btn-primary:hover .arrow { transform: translateX(3px); }

/* Secondary button (orange accent for feature callouts) */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent-secondary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-secondary:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-secondary-bg);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn-outline:hover {
  opacity: 1;
  background: var(--accent-bg);
  transform: translateY(-2px);
}

/* --- Working together strip (services.html, sub-hero) --- */
.working-together-strip {
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-content);
  padding: 28px 24px;
}
.working-together-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.wt-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wt-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.wt-value {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}
@media (max-width: 800px) {
  .working-together-inner { grid-template-columns: 1fr; gap: 16px; }
}

/* --- Credibility strip (sub-hero) --- */
.credibility-strip {
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-content);
  padding: 18px 24px;
}
.credibility-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary, #808590);
}
.credibility-label {
  color: var(--accent);
  font-weight: 600;
}
.credibility-list {
  font-weight: 500;
  letter-spacing: 0.06em;
}
@media (max-width: 600px) {
  .credibility-inner { flex-direction: column; gap: 4px; }
}

/* --- Section Layout --- */
.section {
  padding: var(--section-padding) 24px;
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.section-tag {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.section-title {
  margin-bottom: 16px;
}
.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: 48px;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.card:hover {
  border-color: var(--accent-secondary-border);
  transform: translateY(-3px);
}
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 1.2rem;
}
.card h3 { margin-bottom: 10px; }
.card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Hero --- */
.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
/* Massive watermark "838" behind the home hero — editorial anchor, scoped via .hero-home */
.hero-home::after {
  content: '838';
  position: absolute;
  bottom: -3rem;
  right: -1rem;
  font-family: var(--font-heading);
  font-size: clamp(14rem, 30vw, 26rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.82;
  color: rgba(255, 255, 255, 0.050);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .hero-home::after { font-size: 10rem; bottom: -1rem; right: -1rem; }
}
.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}
.hero h1 {
  margin-bottom: 20px;
  max-width: 720px;
}
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 36px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Services Grid --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* --- About --- */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  align-items: start;
}
.about-text {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}
.about-text p + p { margin-top: 20px; }

/* Experience timeline */
.timeline { margin-top: 40px; }
.timeline-item {
  padding-left: 24px;
  border-left: 2px solid var(--border);
  padding-bottom: 28px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-dates {
  font-family: var(--font-mono, ui-monospace, 'SF Mono', monospace);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.timeline-role {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
}
.timeline-company {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.timeline-desc {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Sidebar */
.about-sidebar {}
.sidebar-block {
  margin-bottom: 32px;
}
.sidebar-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 100px;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.tag:hover {
  border-color: var(--accent-border);
  color: var(--text-primary);
}

/* Speaking card */
.speaking-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.speaking-event {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.speaking-detail {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}
.speaking-detail + .speaking-detail { margin-top: 6px; }

/* --- Sectors --- */
.sectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.sector-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.sector-item:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}
.sector-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.sector-desc {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* --- Problem Matrix --- */
.problem-matrix-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}
.problem-matrix {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.55;
}
.problem-matrix thead th {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
  vertical-align: bottom;
}
.problem-matrix thead th:first-child {
  background: var(--bg-card);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  width: 180px;
}
.problem-matrix tbody th {
  text-align: left;
  vertical-align: top;
  padding: 18px 16px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--accent);
  background: var(--bg-content);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border-subtle);
}
.problem-matrix tbody td {
  vertical-align: top;
  padding: 18px 16px;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.problem-matrix tbody td:last-child { border-right: none; }
.problem-matrix tbody tr:last-child th,
.problem-matrix tbody tr:last-child td { border-bottom: none; }
.problem-matrix tbody tr:hover td { background: rgba(255,255,255,0.015); }

.problem-matrix-frame {
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 820px;
}
@media (max-width: 768px) {
  .problem-matrix { font-size: 0.78rem; }
}

/* --- Contact --- */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.contact-info { }
.contact-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.contact-method:last-child { border-bottom: none; }
.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.contact-label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.contact-value {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Form */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input,
.form-select,
.form-textarea {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); }
.form-submit {
  align-self: flex-start;
  margin-top: 4px;
}

/* Form messages */
.form-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  display: none;
}
.form-message.success {
  display: block;
  background: rgba(27, 138, 90, 0.15);
  border: 1px solid rgba(27, 138, 90, 0.3);
  color: var(--accent-light);
}
.form-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 24px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-copy {
  color: var(--text-tertiary);
  font-size: 0.82rem;
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  transition: color var(--transition-fast);
}
.footer-links a:hover { color: var(--text-primary); }

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .about-layout { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(24, 28, 40, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn-primary,
  .hero-actions .btn-outline { width: 100%; justify-content: center; }
  .services-grid { grid-template-columns: 1fr; }
  .sectors-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}
@media (max-width: 480px) {
  .sectors-grid { grid-template-columns: 1fr; }
}

/* --- Focus-visible — keyboard focus indicators (WCAG 2.1 AA) --- */
/* Hunter-green outline only when focus comes from keyboard navigation.
   Mouse clicks do NOT trigger the ring (browser's :focus-visible heuristic). */
a:focus-visible,
button:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* Suppress any default focus outline when NOT a keyboard focus, so mouse users
   don't see rings around buttons they just clicked. */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Reduced motion — respect OS-level accessibility setting --- */
/* Triggered by macOS: Accessibility > Display > Reduce motion.
   Windows, iOS, Android have equivalents. Users with vestibular disorders,
   migraine sensitivity, or simple preference get a static experience. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Force fade-in elements to their visible end state immediately. */
  .fade-in {
    opacity: 1;
    transform: none;
  }
  /* Suppress hover transforms — color changes still happen (instantly),
     but vertical-lift and spring-bounce motion is gone. */
  .btn-primary:hover,
  .btn-secondary:hover,
  .btn-outline:hover,
  .nav-cta:hover,
  .card:hover,
  .sector-item:hover,
  .tag:hover {
    transform: none;
  }
}
