:root {
  --bg: #ffffff;
  --surface: #eef3f8;
  --surface-strong: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #102033;
  --muted: #4f6277;
  --link: #0b57d0;
  --link-visited: #5b3bb5;
  --focus: #ffbf47;
  --border: #16324f;
  --border-soft: #c8d5e3;
  --code-bg: #111827;
  --code-text: #f9fafb;
  --card-border: #c8d5e3;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --max-width: 96ch;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --reading-width: 78ch;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121c2c;
  --surface-strong: #182538;
  --surface-soft: #1d2c43;
  --text: #f3f7fb;
  --muted: #c4d2e4;
  --link: #8bc3ff;
  --link-visited: #d2b7ff;
  --focus: #ffd666;
  --border: #d7e0ec;
  --border-soft: #41526a;
  --code-bg: #060b14;
  --code-text: #eef4fb;
  --card-border: #41526a;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  line-height: 1.65;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  /*font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;*/
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.15em;
  text-underline-offset: 0.2em;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration-thickness: 0.2em;
}

a:hover,
a:focus-visible {
  text-decoration-skip-ink: auto;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: #000;
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
.site-footer {
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  border-bottom: 0;
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-2);
}

.site-header__inner,
main,
.site-footer p {
  max-width: calc(var(--max-width) + 4rem);
  margin: 0 auto;
  padding: var(--space-2);
}

.site-header__inner {
  display: grid;
  gap: 0.75rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1em;
  font-size: 1.65rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand__name {
  color: var(--text);
}

.brand__suffix {
  color: var(--link);
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.theme-toggle {
  display: inline-block;
  margin-top: 0.25rem;
  font-weight: 600;
}

.nav-list,
.language-list,
.tag-list,
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: var(--space-1) 0;
  padding: 0;
}

.hero,
article,
section {
  max-width: var(--max-width);
}

.hero,
article > header,
section > h1,
section > p {
  max-width: var(--reading-width);
}

.hero {
  padding: var(--space-4) 0 var(--space-3);
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.6rem);
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  margin-top: var(--space-4);
}

h3 {
  font-size: clamp(1.15rem, 1.5vw, 1.4rem);
}

p,
li,
blockquote {
  max-width: var(--reading-width);
}

p {
  margin: 0 0 1rem;
}

.article-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: grid;
  gap: var(--space-2);
}

.article-list article {
  border: 1px solid var(--card-border);
  padding: 1.25rem 1.35rem;
  border-radius: 0.8rem;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0.5rem 0 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

figure {
  margin: var(--space-4) 0;
}

img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-soft);
  border-radius: 0.75rem;
}

.article-content {
  display: grid;
  gap: 1.15rem;
  margin-top: var(--space-3);
}

.ranking-list {
  list-style: decimal;
  padding-left: 1.5rem;
  display: grid;
  gap: 1rem;
}

.ranking-list li > p {
  margin: 0.35rem 0 0;
}

.ranking-item__meta {
  color: var(--muted);
}

.ranking-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
}

.ranking-list li:first-child .ranking-card {
  border-top: 0;
  padding-top: 0;
}

.ranking-card__body {
  min-width: 0;
  flex: 1 1 auto;
}

.ranking-card__meta,
.ranking-card__summary {
  margin: 0.35rem 0 0;
}

.ranking-card__media {
  flex: 0 0 auto;
}

.ranking-card__poster-link {
  display: inline-block;
  line-height: 0;
  border-radius: 0.4rem;
}

.ranking-card__poster-link:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

.ranking-card__poster {
  display: block;
  max-height: 145px;
  width: auto;
  height: auto;
  border-radius: 0.4rem;
}

.article-content pre {
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: 0.75rem;
}

.article-content blockquote {
  border-left: 4px solid var(--link);
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--surface-soft);
  border-radius: 0 0.75rem 0.75rem 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--space-3);
}

.breadcrumbs {
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: 0.95rem;
}

.tag-list a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  text-decoration: none;
}

.tag-list a:hover,
.tag-list a:focus-visible {
  background: var(--surface);
}

article > aside {
  margin-top: var(--space-4);
}

article > p:last-child,
.site-footer p:last-child {
  margin-bottom: 0;
}

@media (max-width: 48rem) {
  .site-header__inner,
  main,
  .site-footer p {
    padding: var(--space-2) var(--space-1);
  }

  html {
    font-size: 1.05rem;
  }

  .ranking-card {
    flex-direction: column;
  }

  .ranking-card__media {
    order: 2;
  }

  .article-list article {
    padding: 1rem;
  }

  h1 {
    font-size: clamp(1.9rem, 10vw, 2.6rem);
  }
}
