/* ============================================
   Derbyshire Intelligence Accelerator — Derbyshire
   ============================================ */

:root {
  --sand: #f5f0e8;
  --warm-white: #faf8f5;
  --cream: #f9f6f1;
  --terra: #c4703f;
  --terra-light: #d4884f;
  --deep: #1a1612;
  --text: #2c2418;
  --text-secondary: #6b5d4f;
  --text-tertiary: #a09484;
  --border: #ddd5c8;
  --glass: rgba(250, 248, 245, 0.82);
  --glass-strong: rgba(250, 248, 245, 0.92);
  --terra-muted: rgba(196, 112, 63, 0.12);

  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;

  --content-max: 760px;
  --container-max: 960px;
}

/* ---- Reset ---- */

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

/* ---- Base ---- */

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  background: var(--warm-white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ---- Skip Link ---- */

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  padding: 8px 16px;
  background: var(--deep);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: 8px;
  z-index: 200;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.75rem;
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

/* ---- Navigation Bar ---- */

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.nav-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* ---- Nav Toggle (mobile) ---- */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Home Page Nav (overlays hero) ---- */

.page-home .nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom: none;
}

.page-home .brand {
  color: rgba(255,255,255,0.9);
}

.page-home .nav-links a {
  color: rgba(255,255,255,0.55);
}

.page-home .nav-links a:hover,
.page-home .nav-links a[aria-current="page"] {
  color: rgba(255,255,255,0.9);
}

.page-home .nav-toggle span {
  background: #fff;
}

/* ---- Hero ---- */

.hero-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.7) saturate(0.85);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(26, 22, 18, 0.2) 0%,
    rgba(26, 22, 18, 0.82) 100%
  );
}

.hero {
  position: relative;
  z-index: 2;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 28px 80px;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 6px 12px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--terra-light);
  border-radius: 50%;
  animation: pulse 3s ease-in-out infinite;
}

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

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 3.8rem;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 700px;
  margin-bottom: 18px;
}

.hero h1::after {
  display: none;
}

.hero-subtitle {
  font-family: var(--font-sans);
  font-size: 1.08rem;
  font-weight: 300;
  line-height: 1.65;
  color: rgba(255,255,255,0.6);
  max-width: 500px;
}

/* ---- Main Content ---- */

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 28px 80px;
}

.page-home main {
  padding-top: 80px;
}

/* ---- Page Title (inner pages) ---- */

main > h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 2.6rem;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}

main > h1::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--terra);
  border-radius: 2px;
  margin-top: 16px;
  margin-bottom: 40px;
}

/* ---- Section Headings ---- */

h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.55rem;
  color: var(--text);
  line-height: 1.3;
  margin-top: 56px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.4;
  margin-top: 32px;
  margin-bottom: 10px;
}

h2 + h3 {
  margin-top: 16px;
}

/* ---- Body Text ---- */

p {
  margin-bottom: 1rem;
  max-width: 65ch;
}

strong {
  font-weight: 600;
  color: var(--text);
}

/* ---- Links ---- */

main a {
  color: var(--terra);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  text-decoration-color: rgba(196, 112, 63, 0.3);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

main a:hover {
  color: var(--terra-light);
  text-decoration-color: var(--terra-light);
}

/* ---- Lists ---- */

ul, ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.3rem;
}

li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
  max-width: 65ch;
}

li::marker {
  color: var(--terra);
  font-weight: 600;
}

ol li::marker {
  font-family: var(--font-serif);
  font-weight: 600;
}

/* ---- Tables ---- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0 32px;
}

.table-wrap > table {
  margin: 0;
  min-width: 100%;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0 32px;
  font-size: 0.92rem;
  line-height: 1.5;
  background: var(--cream);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

thead th {
  font-family: var(--font-sans);
  font-weight: 600;
  text-align: left;
  background: var(--deep);
  color: rgba(255,255,255,0.88);
  padding: 14px 20px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:first-child td {
  border-top: none;
}

tbody tr:nth-child(even) td {
  background: var(--sand);
}

td > strong {
  color: var(--text);
}

/* ---- Footer ---- */

footer {
  border-top: 1px solid var(--border);
  padding: 40px 28px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-tertiary);
}

footer p {
  max-width: none;
  margin: 0;
}

/* ---- Focus ---- */

:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

/* ============================================
   Responsive — Tablet
   ============================================ */

@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--warm-white);
    border-bottom: 1px solid var(--border);
    padding: 8px 28px 16px;
    flex-direction: column;
    gap: 2px;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    display: block;
    padding: 8px 0;
    color: var(--text-secondary) !important;
    font-size: 0.95rem;
  }

  .nav-links a:hover,
  .nav-links a[aria-current="page"] {
    color: var(--text) !important;
  }

  .hero h1 {
    font-size: 2.8rem;
  }
}

/* ============================================
   Responsive — Mobile
   ============================================ */

@media (max-width: 640px) {
  .site-nav {
    padding: 14px 20px;
  }

  main {
    padding: 36px 20px 60px;
  }

  .page-home main {
    padding-top: 56px;
  }

  main > h1 {
    font-size: 2rem;
  }

  main > h1::after {
    width: 36px;
    margin-top: 12px;
    margin-bottom: 28px;
  }

  h2 {
    font-size: 1.35rem;
    margin-top: 40px;
  }

  h3 {
    font-size: 0.95rem;
    margin-top: 24px;
  }

  .hero {
    padding-bottom: 56px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-wrap {
    min-height: 80vh;
  }

  table {
    font-size: 0.84rem;
    border-radius: 8px;
  }

  thead th {
    padding: 10px 14px;
    font-size: 0.75rem;
  }

  td {
    padding: 10px 14px;
  }

  .nav-links {
    padding: 8px 20px 16px;
  }

  footer {
    padding: 32px 20px;
  }
}

/* ============================================
   Print
   ============================================ */

@media print {
  body {
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  .nav-bar,
  .skip-link {
    display: none !important;
  }

  .hero-wrap {
    min-height: auto;
    padding: 1.5rem 0;
  }

  .hero-bg,
  .hero-overlay {
    display: none;
  }

  .hero {
    padding: 0;
  }

  .hero-badge {
    display: none;
  }

  .hero h1 {
    color: #000;
    font-size: 22pt;
    font-weight: 400;
  }

  .hero-subtitle {
    color: #333;
    font-size: 12pt;
  }

  main {
    max-width: none;
    padding: 1rem 0;
  }

  .page-home main {
    padding-top: 1rem;
  }

  main > h1 {
    font-size: 22pt;
    color: #000;
  }

  main > h1::after {
    display: none;
  }

  h2 {
    font-size: 15pt;
    color: #000;
    margin-top: 1.25rem;
    page-break-after: avoid;
  }

  h3 {
    font-size: 11pt;
    color: #000;
    page-break-after: avoid;
  }

  p, li {
    max-width: none;
    orphans: 3;
    widows: 3;
  }

  table {
    page-break-inside: avoid;
    border: 1pt solid #ccc;
    border-radius: 0;
  }

  thead th {
    background: #ddd !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    text-transform: none;
    border-bottom: 1pt solid #999;
  }

  tbody tr:nth-child(even) td {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  main a {
    color: #000;
    text-decoration: none;
  }

  footer {
    border-top: 1pt solid #ccc;
    padding: 0.75rem 0;
    font-size: 9pt;
  }

  a[href]::after {
    content: none !important;
  }
}

/* Home icon + breadcrumb (universal across /cic) */
.site-nav { gap: 14px; align-items: center; }
.home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  padding: 4px;
  margin-right: 4px;
  border-radius: 4px;
}
.home-icon:hover { color: var(--terra); background: var(--cream); }
.home-icon svg { display: block; }
.breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--terra); }
.breadcrumb .sep {
  color: var(--text-tertiary);
  margin: 0 6px;
}
.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}
