:root {
  --bg: #f1f5f9;
  --bg-subtle: #e2e8f0;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --accent: #0d9488;
  --accent-light: #14b8a6;
  --accent-dark: #0f766e;
  --accent-bg: rgba(13, 148, 136, 0.08);
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --card-shadow-hover: 0 12px 24px -8px rgba(15, 23, 42, 0.15), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --font-sans: "Noto Sans SC", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Noto Sans SC", system-ui, sans-serif;
  --ring: 0 0 0 3px rgba(13, 148, 136, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 12%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ========== Header ========== */
.header {
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #f1f5f9;
  padding: 2.75rem 1.5rem 3.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
  box-shadow: 0 14px 28px -18px rgba(15, 23, 42, 0.65);
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(13, 148, 136, 0.15), transparent),
              radial-gradient(ellipse 60% 40% at 80% 50%, rgba(30, 41, 59, 0.8), transparent);
  pointer-events: none;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 0;
  font-size: 0.95rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

/* ========== List view & Main ========== */
.list-view {
  display: block;
  min-height: 60vh;
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.tabs-type {
  gap: 0.25rem;
  margin: -1.35rem auto 0.9rem;
  width: fit-content;
  padding: 0.35rem;
  border-radius: calc(var(--radius-sm) + 4px);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 24px -16px rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
}

.tabs-type .tab-button {
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: none;
  margin-bottom: 0;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tabs-type .tab-button:hover {
  color: var(--text);
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(203, 213, 225, 0.9);
}

.tabs-type .tab-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 10px 22px -14px rgba(13, 148, 136, 0.85);
  transform: translateY(-1px);
}

.tabs-region {
  margin-bottom: 2rem;
  padding: 0.35rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  display: inline-flex;
  box-shadow: var(--card-shadow);
  gap: 0.15rem;
}

.tabs-region .tab-button {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  margin-bottom: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.tabs-region .tab-button:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.tabs-region .tab-button.active {
  background: var(--accent-bg);
  color: var(--accent-dark);
  font-weight: 600;
  transform: translateY(-1px);
}

.tab-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

/* ========== Region blocks ========== */
.region-block {
  margin-bottom: 2.5rem;
}

.region-block:last-child {
  margin-bottom: 0;
}

.region-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
}

.region-title .flag {
  font-size: 1.25rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

/* ========== Company cards ========== */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
  box-shadow: var(--card-shadow);
}

.company-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-light);
}

.company-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--bg) 0%, var(--bg-subtle) 100%);
  padding: 4px;
  border: 1px solid var(--border-light);
}

.company-logo.placeholder {
  background: linear-gradient(145deg, var(--bg-subtle) 0%, var(--border-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-soft);
}

.company-body {
  flex: 1;
  min-width: 0;
}

.company-name {
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 0.3rem;
  color: var(--text);
  line-height: 1.35;
}

.company-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.company-products {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 0.4rem 0 0;
  line-height: 1.5;
}

.company-arrow {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1rem;
  margin-top: 0.25rem;
  opacity: 0.9;
}

/* ========== People cards ========== */
.category-block {
  margin-bottom: 2rem;
}

.category-block:last-child {
  margin-bottom: 0;
}

.category-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.person-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
  box-shadow: var(--card-shadow);
}

.person-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-light);
}

.person-name {
  font-weight: 600;
  font-size: 0.98rem;
  margin: 0 0 0.25rem;
  color: var(--text);
  line-height: 1.35;
}

.person-name.deceased::after {
  content: " †";
  font-weight: 400;
  color: var(--text-soft);
}

.person-org {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0;
}

.person-work {
  font-size: 0.81rem;
  color: var(--text-soft);
  margin: 0.3rem 0 0;
  line-height: 1.45;
}

/* ========== Detail view ========== */
.detail-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: 60vh;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
}

.detail-back {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  margin: -0.35rem -0.5rem;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.detail-back:hover {
  background: var(--accent-bg);
  color: var(--accent-dark);
}

.detail-github {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.detail-github:hover {
  color: var(--accent);
  border-color: var(--accent-light);
  background: var(--accent-bg);
}

.detail-article {
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  line-height: 1.3;
  color: var(--text);
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}

.detail-body {
  font-size: 0.95rem;
  line-height: 1.75;
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.detail-body h1 { font-size: 1.2rem; }
.detail-body h2 { font-size: 1.1rem; }
.detail-body h3 { font-size: 1rem; }

.detail-body p {
  margin: 0.5rem 0;
}

.detail-body ul {
  margin: 0.5rem 0 1rem;
  padding-left: 1.5rem;
}

.detail-body li {
  margin: 0.3rem 0;
}

.detail-body a {
  color: var(--accent);
  text-decoration: none;
}

.detail-body a:hover {
  text-decoration: underline;
  color: var(--accent-dark);
}

.detail-body strong {
  font-weight: 600;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  background: var(--surface);
  margin-top: 0;
}

.footer p {
  margin: 0.3rem 0;
}

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

.footer a:hover {
  text-decoration: underline;
  color: var(--accent-dark);
}

.footer code {
  background: var(--bg-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85em;
  border: 1px solid var(--border-light);
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .header {
    padding: 2.5rem 1rem 3rem;
  }

  .logo {
    font-size: 1.65rem;
  }

  .main {
    padding: 1.5rem 1rem 3rem;
  }

  .tabs-type {
    flex-wrap: wrap;
    margin-top: -1.15rem;
    justify-content: center;
  }

  .tabs-type .tab-button {
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
  }

  .tabs-region {
    flex-wrap: wrap;
  }

  .companies-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .people-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .company-card {
    padding: 1.1rem 1.2rem;
  }

  .detail-view {
    padding: 1.5rem 1rem 3rem;
  }

  .detail-article {
    padding: 1.5rem 1.25rem;
  }

  .detail-title {
    font-size: 1.35rem;
  }
}
