/* ============================================
   Cloud Identity AB — Site Styles
   ============================================ */

:root {
  --color-bg: #fafaf9;
  --color-surface: #ffffff;
  --color-text: #1c1917;
  --color-text-muted: #57534e;
  --color-border: #e7e5e4;
  --color-primary: #0c4a6e;
  --color-primary-light: #0369a1;
  --color-accent: #2563eb;
  --color-accent-soft: #dbeafe;
  --color-tag-bg: #f0f9ff;
  --color-tag-text: #0c4a6e;
  --color-hero-bg: #0c1222;
  --color-hero-text: #f1f5f9;
  --color-code-bg: #f1f5f9;
  --color-code-text: inherit;
  --color-pre-bg: #0f172a;
  --color-pre-text: #e2e8f0;
  --header-bg: rgba(250, 250, 249, 0.92);
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1140px;
  --max-width-narrow: 760px;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-primary: #38bdf8;
  --color-primary-light: #7dd3fc;
  --color-accent: #60a5fa;
  --color-accent-soft: rgba(96, 165, 250, 0.15);
  --color-tag-bg: rgba(56, 189, 248, 0.1);
  --color-tag-text: #7dd3fc;
  --color-hero-bg: #020617;
  --color-hero-text: #f1f5f9;
  --color-code-bg: #1e293b;
  --color-code-text: #e2e8f0;
  --color-pre-bg: #020617;
  --color-pre-text: #e2e8f0;
  --header-bg: rgba(15, 23, 42, 0.92);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--max-width-narrow); margin: 0 auto; padding: 0 24px; }

/* ============================================
   Header
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
}

.logo-icon {
  color: var(--color-primary);
  font-size: 1.4rem;
}

.logo-icon-img {
  width: 32px;
  height: 32px;
}

.logo-header-img {
  height: 36px;
  width: auto;
}

.footer-logo-img {
  height: 30px;
  width: auto;
  margin-bottom: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

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

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--color-border);
  border-radius: 6px;
}

.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 4px;
  transition: all var(--transition);
}

.lang-link.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.lang-link:hover:not(.active) {
  color: var(--color-text);
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================
   Hero
   ============================================ */

.hero {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  padding: 100px 0 110px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 680px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #93c5fd;
  margin-bottom: 28px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.hero-description {
  font-size: 1.15rem;
  line-height: 1.75;
  color: #94a3b8;
  margin-bottom: 40px;
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-outline {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(203, 213, 225, 0.3);
}

.btn-outline:hover {
  border-color: rgba(203, 213, 225, 0.6);
  color: #f1f5f9;
}

/* ============================================
   Sections
   ============================================ */

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 40px;
}

.section-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-accent);
}

/* Expertise Grid */
.expertise-section {
  padding: 100px 0;
}

.expertise-section .section-title {
  margin-bottom: 48px;
}

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.expertise-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  transition: all var(--transition);
}

.expertise-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.expertise-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.expertise-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-primary);
}

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

/* ============================================
   Blog Grid
   ============================================ */

.blog-preview {
  padding: 80px 0 100px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.blog-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.blog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.blog-card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--color-border);
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.03);
}

.blog-card-content {
  padding: 24px;
}

.blog-card-content time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.blog-card-content h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 8px 0 10px;
  line-height: 1.35;
}

.blog-card-content h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.blog-card-content h3 a:hover {
  color: var(--color-primary);
}

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

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

/* ============================================
   Single Post / Page
   ============================================ */

.single-post {
  padding: 60px 0 100px;
}

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

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.post-meta time {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.post-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin-top: 12px;
}

.post-hero-image {
  margin-bottom: 40px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Prose Content */
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 48px 0 16px;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 36px 0 12px;
}

.prose p { margin-bottom: 20px; }

.prose ul, .prose ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.prose li { margin-bottom: 8px; }

.prose blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 16px 24px;
  margin: 28px 0;
  background: var(--color-tag-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 2px 6px;
  border-radius: 4px;
}

.prose pre {
  background: var(--color-pre-bg);
  color: var(--color-pre-text);
  padding: 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 28px 0;
  line-height: 1.55;
}

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

.prose img {
  border-radius: var(--radius);
  margin: 28px 0;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.9rem;
}

.prose th, .prose td {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  text-align: left;
}

.prose th {
  background: var(--color-tag-bg);
  font-weight: 600;
}

/* Post Navigation */
.post-footer {
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.post-nav-link {
  text-decoration: none;
  max-width: 48%;
}

.post-nav-link.next { margin-left: auto; text-align: right; }

.post-nav-label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.post-nav-title {
  display: block;
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================
   List Page
   ============================================ */

.list-page {
  padding: 60px 0 100px;
}

.list-header {
  margin-bottom: 48px;
}

.list-header h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.list-header p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-top: 8px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  list-style: none;
  padding: 0;
}

.pagination li a,
.pagination li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}

.pagination li a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination li.active span {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  background: var(--color-hero-bg);
  color: #94a3b8;
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand .logo-icon {
  color: #60a5fa;
}

.footer-brand .logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #f1f5f9;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-links h4,
.footer-contact h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.footer-links a,
.footer-contact a {
  display: block;
  font-size: 0.88rem;
  color: #94a3b8;
  margin-bottom: 10px;
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover,
.footer-contact a:hover {
  color: #e2e8f0;
}

.footer-bottom {
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding-top: 24px;
  font-size: 0.82rem;
  color: #64748b;
}

/* ============================================
   Theme Toggle
   ============================================ */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-border);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: all var(--transition);
}

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

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

/* Logo swap for dark mode */
.logo-header-dark { display: none; }
[data-theme="dark"] .logo-header-light { display: none; }
[data-theme="dark"] .logo-header-dark { display: block; }

/* Dark mode specific overrides for hardcoded colors */
[data-theme="dark"] .hero-description { color: #94a3b8; }
[data-theme="dark"] .btn-outline { color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); }
[data-theme="dark"] .btn-outline:hover { color: #e2e8f0; border-color: rgba(148, 163, 184, 0.5); }
[data-theme="dark"] .btn-primary:hover { background: #3b82f6; box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3); }
[data-theme="dark"] .hero-badge { color: #7dd3fc; }
[data-theme="dark"] .site-footer { background: #020617; }
[data-theme="dark"] .prose img { box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
[data-theme="dark"] .lang-link.active { box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

/* ============================================
   Responsive
   ============================================ */

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

  .nav-right {
    flex-direction: row-reverse;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
  }

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

  .lang-toggle.active {
    position: absolute;
    top: 72px;
    right: 24px;
    z-index: 101;
    margin-top: 24px;
  }

  .hero { padding: 60px 0 70px; }
  .hero h1 { font-size: 2.2rem; }
  .hero-description { font-size: 1rem; }

  .expertise-grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .post-header h1 { font-size: 1.8rem; }
  .section-title { font-size: 1.6rem; }

  .post-nav { flex-direction: column; }
  .post-nav-link.next { text-align: left; margin-left: 0; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}
