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

:root {
  --bg: #ffffff;
  --bg-subtle: #f4f6fa;
  --text: #0d1b2a;
  --text-muted: #5a6a7a;
  --accent: #003087;
  --accent-hover: #002070;
  --border: #dde3ec;
  --max-w: 1080px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-subtle: #181c26;
  --text: #e8edf3;
  --text-muted: #7a8699;
  --accent: #5b8dee;
  --accent-hover: #4a7add;
  --border: #252d3d;
}

[data-theme="dark"] .nav-cta { background: #1e2a45 !important; color: #5b8dee !important; }
[data-theme="dark"] .nav-cta:hover { background: #253354 !important; }
[data-theme="dark"] .btn-dark { background: #1e2a45; color: #e8edf3; }
[data-theme="dark"] .btn-dark:hover { background: var(--accent); color: #fff; }
[data-theme="dark"] .btn-white { background: #e8edf3; color: #0f1117; }
[data-theme="dark"] .btn-white:hover { background: #c8d0dc; }
[data-theme="dark"] .cta-band { background: #080b11; }
[data-theme="dark"] .cta-band h2 { color: #e8edf3; }
[data-theme="dark"] .post-content p,
[data-theme="dark"] .post-content li,
[data-theme="dark"] .page-content p,
[data-theme="dark"] .page-content li { color: #c8d0dc; }
[data-theme="dark"] .post-content pre { background: #080b11; }
[data-theme="dark"] .post-content code { background: #181c26; border-color: #252d3d; color: #c8d0dc; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

a { color: inherit; }

/* ── Nav ── */
header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
  line-height: 0;
}

.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.nav-cta {
  color: var(--bg) !important;
  background: var(--text);
  padding: 0.45rem 1rem;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  border-radius: 5px;
}

.nav-cta:hover { background: var(--accent) !important; }

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Hero ── */
.hero {
  padding: 6rem 0 5rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin-bottom: 1.75rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 2.25rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.btn-dark {
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  display: inline-block;
  border-radius: 5px;
}

.btn-dark:hover { background: var(--accent); }

.btn-text {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.btn-text:hover { color: var(--text); border-color: var(--text); }

/* ── Sections ── */
.section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--border);
}

.section-header {
  margin-bottom: 3rem;
}

.section-header h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 440px;
  line-height: 1.65;
}

/* ── Services grid (homepage) ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}

.service-card {
  padding: 2rem 2rem 2rem 0;
  border-right: 1px solid var(--border);
}

.service-card:last-child { border-right: none; padding-right: 0; }
.service-card:nth-child(2) { padding-left: 2rem; }
.service-card:nth-child(3) { padding-left: 2rem; }

.service-card h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.service-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Services page (Datamade-style) ── */
.svc-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.75;
  margin-bottom: 0.5rem;
}

.svc-work-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.svc-work-link:hover { text-decoration: underline; }

.svc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 2rem;
  padding-bottom: 4rem;
}

.svc-item {
  padding: 2.5rem 3rem 2.5rem 0;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  margin-top: -1px;
}

.svc-item:nth-child(odd) { padding-right: 3rem; border-right: 1px solid var(--border); }
.svc-item:nth-child(even) { padding-left: 3rem; padding-right: 0; }

.svc-item h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.svc-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Blog list page ── */
.page-header {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.page-header h1 {
  font-family: var(--serif);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.blog-list { display: flex; flex-direction: column; }

.blog-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.blog-list-item:hover .blog-list-title { color: var(--accent); }

.blog-list-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  transition: color 0.15s;
}

.blog-list-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.blog-list-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Blog post ── */
.post-header {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 720px;
  margin-bottom: 1rem;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.post-content { max-width: 660px; padding-bottom: 5rem; }
.post-content h2 { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; margin: 2.5rem 0 0.75rem; }
.post-content h3 { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; margin: 1.75rem 0 0.5rem; }
.post-content p { margin-bottom: 1.25rem; line-height: 1.8; color: #2a2a2a; }
.post-content ul, .post-content ol { margin: 0 0 1.25rem 1.25rem; }
.post-content li { margin-bottom: 0.4rem; line-height: 1.75; color: #2a2a2a; }
.post-content code { background: var(--bg-subtle); border: 1px solid var(--border); padding: 0.15em 0.4em; font-size: 0.85em; font-family: 'SF Mono', Consolas, monospace; }
.post-content pre { background: #111; color: #e8e8e8; padding: 1.25rem 1.5rem; overflow-x: auto; margin-bottom: 1.5rem; }
.post-content pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }
.post-content a { color: var(--accent); text-underline-offset: 2px; }
.post-content blockquote { border-left: 2px solid var(--border); padding: 0.25rem 0 0.25rem 1.25rem; color: var(--text-muted); margin: 1.5rem 0; }
.post-content strong { color: var(--text); }

/* ── Page content ── */
.page-content { max-width: 680px; padding: 3rem 0 5rem; }
.page-content h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; margin: 2.5rem 0 0.6rem; }
.page-content p { margin-bottom: 1.1rem; line-height: 1.8; color: #2a2a2a; }
.page-content ul, .page-content ol { margin: 0 0 1.1rem 1.25rem; }
.page-content li { margin-bottom: 0.4rem; line-height: 1.75; color: #2a2a2a; }
.page-content strong { color: var(--text); }
.page-content a { color: var(--accent); text-underline-offset: 2px; }
.page-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Blog preview ── */
.blog-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
}

.blog-preview-card {
  padding: 2rem 2rem 2rem 0;
  border-right: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: block;
}

.blog-preview-card:last-child { border-right: none; }

.blog-preview-card:hover .blog-preview-title { color: var(--accent); }

.blog-preview-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.blog-preview-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.35;
  transition: color 0.15s;
}

.blog-preview-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── CTA band ── */
.cta-band {
  background: var(--text);
  padding: 5rem 0;
}

.cta-band h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.cta-band p {
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.btn-white {
  background: #fff;
  color: var(--text);
  padding: 0.65rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
  border-radius: 5px;
}

.btn-white:hover { background: #e8e8e8; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo { font-family: var(--serif); font-weight: 700; text-decoration: none; color: var(--text); font-size: 0.95rem; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 0.78rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .services-grid { grid-template-columns: 1fr; border-top: none; }
  .service-card { padding: 1.5rem 0; border-right: none; border-top: 1px solid var(--border); }
  .service-card:nth-child(2), .service-card:nth-child(3) { padding-left: 0; }
  .svc-grid { grid-template-columns: 1fr; }
  .svc-item:nth-child(odd) { border-right: none; padding-right: 0; }
  .svc-item:nth-child(even) { padding-left: 0; }
  .blog-preview-grid { grid-template-columns: 1fr; }
  .blog-preview-card { border-right: none; padding-right: 0; border-bottom: 1px solid var(--border); }
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
  line-height: 0;
}

.ham-close { display: none; }
.hamburger.open .ham-open { display: none; }
.hamburger.open .ham-close { display: block; }

@media (max-width: 640px) {
  .hamburger { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 2rem 1.5rem;
    gap: 0;
    z-index: 99;
    list-style: none;
  }

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

  .nav-links li { border-bottom: 1px solid var(--border); }
  .nav-links li:last-child { border-bottom: none; }

  .nav-links a {
    display: block;
    padding: 1rem 0;
    font-size: 1rem;
    color: var(--text) !important;
    background: none !important;
    border-radius: 0 !important;
  }

  .nav-cta { padding: 1rem 0 !important; font-size: 1rem !important; }

  .hero { padding: 4rem 0 3rem; }
  .blog-list-item { flex-direction: column; gap: 0.2rem; }
  .footer-links { display: none; }
}
