/*
 * The Developer blog.
 *
 * The header, footer, buttons and design tokens are deliberate copies of the
 * SPA's src/index.css and src/App.css so /blog reads as the same site. Those
 * sections are marked below; keep them in step when the SPA changes. Everything
 * after "Blog" is specific to this theme.
 */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/space-grotesk.woff2') format('woff2');
}

/* ---------- Tokens (shared with the SPA) ---------- */

:root {
  --bg: #050a12;
  --surface: #0c111b;
  --surface-2: #101725;
  --text: #e9edf6;
  --muted: #9eadc8;
  --accent: #2ef3c2;
  --accent-strong: #0cf0b2;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-head);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

p {
  margin: 0;
  color: var(--text);
}

a {
  color: var(--text);
  text-decoration: none;
}

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

button {
  font: inherit;
  color: var(--text);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--accent);
  color: #051012;
  font-weight: 700;
  border-radius: 0 0 12px 0;
}

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

.page {
  background: radial-gradient(1000px at 10% 10%, rgba(46, 243, 194, 0.08), transparent),
    radial-gradient(1200px at 80% 20%, rgba(46, 243, 194, 0.08), transparent),
    linear-gradient(180deg, rgba(16, 23, 37, 0.9), rgba(5, 10, 18, 1));
  min-height: 100vh;
  color: var(--text);
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header (shared with the SPA) ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  backdrop-filter: blur(14px);
  background: rgba(5, 10, 18, 0.75);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 0 30px rgba(46, 243, 194, 0.3);
  display: block;
  transition: transform 0.25s ease;
}

.brand:hover .brand-icon {
  transform: rotate(15deg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.nav-links > a {
  padding: 8px 10px;
  color: var(--text);
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-links > a:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.nav-links > a[aria-current='page'] {
  opacity: 1;
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-cta {
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051012;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(46, 243, 194, 0.25);
}

/* The £39/month package. Outlined rather than solid so it does not compete with
   the primary CTA beside it. Mirrors .nav-offer in the SPA's App.css. */
.nav-offer {
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-offer:hover {
  border-color: rgba(46, 243, 194, 0.5);
  background: rgba(46, 243, 194, 0.08);
  transform: translateY(-1px);
}

@media (max-width: 1180px) {
  .nav-offer {
    display: none;
  }
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.nav-dropdown-trigger:hover {
  opacity: 1;
}

.nav-dropdown-arrow {
  transition: transform 0.2s ease;
}

[aria-expanded='true'] .nav-dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 300px;
  padding: 8px;
  background: rgba(12, 17, 27, 0.98);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.nav-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.nav-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-dropdown-icon,
.nav-dropdown-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(46, 243, 194, 0.1);
  border: 1px solid rgba(46, 243, 194, 0.2);
  color: var(--accent);
}

.nav-dropdown-glyph {
  font-size: 18px;
  line-height: 1;
}

.nav-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-name {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.nav-dropdown-desc {
  font-size: 13px;
  color: var(--muted);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 1.8px;
  background: var(--text);
  border-radius: 2px;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 998;
}

.mobile-menu-overlay.open {
  opacity: 1;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(12, 17, 27, 0.98), rgba(5, 10, 18, 0.99));
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu[hidden],
.mobile-menu-overlay[hidden] {
  display: none;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mobile-menu-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-nav {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu-link {
  display: block;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.mobile-menu-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-link-offer {
  border: 1px solid rgba(46, 243, 194, 0.35);
  background: rgba(46, 243, 194, 0.06);
  color: var(--accent);
}

.mobile-menu-link-offer:hover {
  background: rgba(46, 243, 194, 0.12);
}

.mobile-menu-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.mobile-menu-accordion-trigger:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-accordion-content {
  display: flex;
  flex-direction: column;
  padding: 4px 0 8px;
}

.mobile-menu-accordion-content[hidden] {
  display: none;
}

.mobile-menu-sub-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 14px 36px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.mobile-menu-sub-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-sub-icon,
.mobile-menu-sub-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(46, 243, 194, 0.1);
  border: 1px solid rgba(46, 243, 194, 0.2);
  color: var(--accent);
}

.mobile-menu-sub-glyph {
  font-size: 17px;
  line-height: 1;
}

.mobile-menu-sub-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-menu-sub-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.mobile-menu-sub-desc {
  font-size: 13px;
  color: var(--muted);
}

.mobile-menu-cta {
  margin-top: 12px;
  padding: 14px 20px;
  text-align: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051012;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 480px) {
  .nav-cta {
    display: none;
  }
}

/* ---------- Buttons (shared with the SPA) ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051012;
  box-shadow: 0 10px 30px rgba(46, 243, 194, 0.25);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.button:hover {
  transform: translateY(-2px);
}

/* ---------- Footer (shared with the SPA) ---------- */

.footer {
  padding: 48px 28px 60px;
  border-top: 1px solid var(--border);
  background: rgba(5, 10, 18, 0.95);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-tagline {
  color: var(--muted);
  font-size: 15px;
  max-width: 480px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 14px;
}

.footer-links a {
  color: var(--text);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
}

.footer-copy {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

/* ---------- Blog ---------- */

.blog-hero {
  padding: 80px 0 40px;
}

.blog-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 20ch;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 60ch;
}

.section {
  padding: 40px 0 70px;
}

.section--surface {
  background: rgba(12, 17, 27, 0.5);
  border-top: 1px solid var(--border);
  padding: 60px 0;
}

.sec-head {
  margin-bottom: 28px;
}

.sec-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(46, 243, 194, 0.28);
  box-shadow: var(--shadow);
}

.post-card-img img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.post-card-title {
  font-size: 1.22rem;
}

.post-card-excerpt {
  color: var(--muted);
  font-size: 15px;
}

.post-card-more {
  margin-top: auto;
  padding-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.pagination {
  margin-top: 40px;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.pagination a,
.pagination .current {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
}

.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #051012;
  font-weight: 700;
}

.crumbs {
  padding-top: 28px;
  font-size: 13px;
  color: var(--muted);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crumbs li + li::before {
  content: '/';
  margin-right: 8px;
  opacity: 0.5;
}

.crumbs a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

/* The article is a single reading column, centred in the same 1200px shell the
   rest of the site uses so it does not sit off to one side. */
.post-header,
.post-figure,
.prose {
  max-width: 72ch;
  margin-inline: auto;
}

.post-header {
  padding: 32px 0 28px;
}

.post-header h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
}

.post-header .post-meta {
  margin-bottom: 14px;
}

.post-figure {
  margin-bottom: 40px;
}

.post-figure img {
  border-radius: 18px;
  width: 100%;
}

/* ---------- Post body ---------- */

.prose {
  padding-bottom: 40px;
  font-size: 1.07rem;
}

.prose > * + * {
  margin-top: 1.15rem;
}

.prose h2 {
  font-size: 1.6rem;
  margin-top: 2.6rem;
}

.prose h3 {
  font-size: 1.22rem;
  margin-top: 1.9rem;
}

.prose p,
.prose li {
  color: #cdd6e6;
  line-height: 1.78;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.45rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose strong {
  color: var(--text);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
}

.prose th {
  background: var(--surface);
  font-family: var(--font-head);
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.6rem 0;
  padding: 0.4rem 0 0.4rem 1.25rem;
  color: var(--text);
}

.prose code {
  background: var(--surface-2);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-size: 0.9em;
}

.prose pre {
  background: var(--surface-2);
  padding: 1.1rem;
  border-radius: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose img {
  border-radius: 14px;
}

/* ---------- Closing CTA ---------- */

.blog-cta {
  padding: 20px 0 80px;
}

.blog-cta-card {
  padding: 44px 36px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(46, 243, 194, 0.08), rgba(255, 255, 255, 0.02));
  text-align: center;
}

.blog-cta-card h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
}

.blog-cta-card p {
  margin: 14px auto 0;
  max-width: 52ch;
  color: var(--muted);
}

.blog-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
}

.blog-hero .blog-cta-row {
  justify-content: flex-start;
}

/* ---------- Enquiry prompt ---------- */

/* Bottom-left: the chatbot widget owns the bottom-right corner. */
.project-popup {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 900;
  width: min(330px, calc(100vw - 40px));
  padding: 20px 22px 22px;
  background: rgba(12, 17, 27, 0.97);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.project-popup[hidden] {
  display: none;
}

.project-popup.open {
  opacity: 1;
  transform: none;
}

.project-popup-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  padding-right: 20px;
}

.project-popup-text {
  margin: 8px 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.project-popup-cta {
  display: block;
  padding: 11px 18px;
  text-align: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051012;
  font-weight: 700;
  font-size: 14px;
}

.project-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.project-popup-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

/* Narrow screens are not wide enough for the popup and the chatbot bubble to
   sit side by side, so stack the popup above it. */
@media (max-width: 560px) {
  .project-popup {
    right: 20px;
    bottom: 96px;
    width: auto;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
