:root {
  --bg: #edf1f4;
  --paper: rgba(251, 253, 254, 0.82);
  --paper-strong: #fcfdfe;
  --ink: #111827;
  --muted: #5d6b7a;
  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.18);
  --accent: #0f5f8c;
  --accent-dark: #0a4768;
  --shadow: 0 10px 24px rgba(63, 82, 102, 0.05);
  --display: "Canela", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Suisse Intl", "Avenir Next", "Inter", "Segoe UI", sans-serif;
  --content: 760px;
  --wide: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 95, 140, 0.08), transparent 20%),
    linear-gradient(180deg, #f4f7f9 0%, var(--bg) 46%, #e8edf1 100%);
  font-family: var(--sans);
  line-height: 1.58;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(calc(100% - 2rem), var(--wide));
  margin: 0 auto;
  padding: 1.25rem 0 4.5rem;
}

.page-shell-narrow {
  width: min(calc(100% - 2rem), 900px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0 1.75rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.inline-link:hover,
.inline-link:focus-visible {
  color: var(--accent-dark);
}

.hero,
.feature-card,
.post-preview,
.archive-item,
.article {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  padding: 2.75rem;
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -4rem -4rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 95, 140, 0.12), transparent 66%);
  pointer-events: none;
}

.eyebrow,
.feature-label,
.post-meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h1,
.section-heading h2,
.article h1,
.feature-card h2,
.post-preview h3,
.archive-item h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.hero h1 {
  max-width: none;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
}

.hero-copy,
.section-heading p,
.article-dek {
  max-width: 48rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.hero-copy {
  max-width: none;
  margin-top: 0.9rem;
}

.hero-copy span {
  color: var(--ink);
}

.en {
  color: var(--muted);
  font-size: 0.88em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.3rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.62rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 550;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--accent);
  border-color: transparent;
  color: #f7fbff;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.52);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.feature-card,
.post-preview,
.archive-item {
  border-radius: 0.9rem;
  padding: 1.35rem;
}

.feature-card {
  position: relative;
}

.feature-card::before,
.post-preview::before,
.archive-item::before,
.article::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  margin-bottom: 1rem;
  background: var(--line-strong);
}

.latest-posts {
  margin-top: 3.25rem;
}

.section-heading {
  margin-bottom: 1.25rem;
}

.latest-posts .section-heading {
  text-align: right;
}

.section-heading h1,
.section-heading h2,
.article h1 {
  font-size: clamp(1.9rem, 4.3vw, 2.9rem);
}

.latest-posts .section-heading h2 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
}

.post-preview h3,
.archive-item h2 {
  font-size: 1.35rem;
}

.post-preview a,
.archive-item a {
  transition: color 160ms ease;
}

.post-preview a:hover,
.archive-item a:hover,
.post-preview a:focus-visible,
.archive-item a:focus-visible {
  color: var(--accent-dark);
}

.archive {
  display: grid;
  gap: 1rem;
}

.article {
  max-width: 70vw;
  margin: 0 auto;
  padding: 1.9rem;
  border-radius: 1rem;
}

.article p,
.article blockquote {
  font-size: 0.98rem;
}

.article .formula {
  font-family: "Courier New", "Consolas", monospace;
  font-size: 0.92rem;
  background: rgba(15, 95, 140, 0.05);
  border-left: 2px solid rgba(15, 95, 140, 0.25);
  padding: 0.4rem 0.85rem;
  margin: 0.25rem 0;
  max-width: none;
  color: var(--ink);
}

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.45;
}

/* Header row */
.article thead {
  background: rgba(15, 95, 140, 0.04);
}

.article thead th {
  padding: 0.55rem 0.85rem;
  text-align: left;
  font-size: 0.70rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-top: 1px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
}

/* Numeric columns: header and data cells both right-aligned */
.article thead th.num,
.article tbody td.num,
.article tfoot td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.article thead th.num {
  padding-right: 1rem;  /* extra right breathing room for number headers */
}

/* Body cells */
.article tbody td {
  padding: 0.42rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
}

.article tbody tr:last-child td {
  border-bottom: none;
}

.article tbody td.num {
  font-size: 0.84rem;
  padding-right: 1rem;
  color: var(--ink);
}

.article tbody td.label {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Subtle row striping for readability */
.article tbody tr:nth-child(even) {
  background: rgba(17, 24, 39, 0.018);
}

.article tfoot td {
  padding: 0.6rem 0.85rem 0;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 2px solid var(--line-strong);
  font-style: italic;
}

.article .panel-heading {
  margin: 1.4rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.article .abstract-section {
  margin: 1.5rem 0;
  padding: 1.2rem 1.4rem;
  background: rgba(15, 95, 140, 0.03);
  border-left: 2px solid rgba(15, 95, 140, 0.18);
  border-radius: 0 0.5rem 0.5rem 0;
}

.article .abstract-section h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.article .abstract-section p {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.65;
}

.article .section-divider {
  margin: 2rem 0 1.25rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.article .footnotes {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.article .footnotes ol {
  padding-left: 1.5rem;
  margin: 0;
}

.article .footnotes li {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.4rem;
}

sup.fn {
  font-size: 0.65em;
  color: var(--accent);
  margin-left: 1px;
}

.article figure {
  margin: 1.75rem 0;
  text-align: center;
}

.article figure img {
  max-width: 55%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  display: inline-block;
}

.article figcaption {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

.article ol.algo-steps {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.article ol.algo-steps li {
  font-size: 0.97rem;
  line-height: 1.65;
  margin-bottom: 0.6rem;
  max-width: none;
}

.article .data-share {
  margin: 2.5rem 0 1.5rem;
  padding: 1.4rem 1.6rem;
  background: rgba(15, 95, 140, 0.05);
  border: 1px solid rgba(15, 95, 140, 0.18);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article .data-share-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.article .data-share p {
  margin: 0;
  font-size: 0.95rem;
}

.article p {
  max-width: none;
}

.article blockquote {
  margin: 1.75rem 0;
  padding-left: 1rem;
  border-left: 2px solid rgba(15, 95, 140, 0.36);
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.08rem;
  line-height: 1.45;
}

.article-dek {
  margin-top: 0.9rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.archive-item,
.post-preview,
.feature-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(248, 251, 253, 0.82));
}

@media (min-width: 901px) {
  .feature-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
  }

  .latest-posts {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 1rem;
    align-items: start;
  }

  .latest-posts .section-heading {
    margin-bottom: 0;
    padding-top: 0.35rem;
  }

  .post-preview {
    min-height: 100%;
  }
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 2rem 1.5rem;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--wide));
    padding-top: 0.75rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 1.5rem;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .hero h1 {
    max-width: none;
  }

  .article,
  .feature-card,
  .post-preview,
  .archive-item {
    padding: 1.15rem;
  }
}
