@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-cyrillic-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --page: #ffffff;
  --grouped: #f2f2f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --label: #000000;
  --secondary-label: #6e6e73;
  --tertiary-label: #8e8e93;
  --separator: #c6c6c8;
  --soft-separator: #e5e5ea;
  --fill: #f2f2f7;
  --fill-strong: #e5e5ea;
  --accent: #3478f6;
  --accent-soft: #edf4ff;
  --accent-border: #c9dcff;
  --button-label: #ffffff;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page: #000000;
    --grouped: #000000;
    --surface: #1c1c1e;
    --surface-raised: #1c1c1e;
    --label: #ffffff;
    --secondary-label: #a1a1a6;
    --tertiary-label: #8e8e93;
    --separator: #38383a;
    --soft-separator: #2c2c2e;
    --fill: #1c1c1e;
    --fill-strong: #2c2c2e;
    --accent: #0a84ff;
    --accent-soft: #1c1c1e;
    --accent-border: #1d4f86;
    --button-label: #000000;
    --shadow: 0 12px 32px rgb(0 0 0 / 0.58);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000;
  --grouped: #000000;
  --surface: #1c1c1e;
  --surface-raised: #1c1c1e;
  --label: #ffffff;
  --secondary-label: #a1a1a6;
  --tertiary-label: #8e8e93;
  --separator: #38383a;
  --soft-separator: #2c2c2e;
  --fill: #1c1c1e;
  --fill-strong: #2c2c2e;
  --accent: #0a84ff;
  --accent-soft: #1c1c1e;
  --accent-border: #1d4f86;
  --button-label: #000000;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.58);
}

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

html {
  background: var(--page);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "Inter Variable", "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--label);
  color: var(--page);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left));
  border-block-end: 1px solid var(--soft-separator);
  background: var(--page);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.theme-control {
  display: flex;
  max-width: 68vw;
  gap: 2px;
  overflow-x: auto;
  padding: 3px;
  border: 1px solid var(--separator);
  border-radius: 11px;
  background: var(--fill);
  scrollbar-width: none;
}

.theme-control::-webkit-scrollbar {
  display: none;
}

.theme-control button {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--secondary-label);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.theme-control button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--label);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.16);
}

main {
  width: min(100%, 1040px);
  margin-inline: auto;
}

.summary-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 20px 28px;
  border-block-end: 1px solid var(--soft-separator);
}

.summary-hero.without-cover {
  display: block;
}

.cover {
  width: 112px;
  margin: 0;
}

.cover img {
  display: block;
  width: 112px;
  height: 162px;
  border-radius: 8px;
  background: var(--fill);
  box-shadow: var(--shadow);
  object-fit: cover;
}

.summary-intro {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(27px, 7vw, 48px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.03;
}

.description {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--secondary-label);
  font-size: 15px;
  line-height: 1.55;
}

.compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-block-start: 13px;
  color: var(--tertiary-label);
  font-size: 12px;
  font-weight: 550;
}

.rating {
  color: var(--label);
}

.source-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  margin: 17px 0 0;
}

.source-metadata div {
  min-width: 0;
}

.source-metadata dt {
  color: var(--tertiary-label);
  font-size: 11px;
}

.source-metadata dd {
  margin: 1px 0 0;
  font-size: 13px;
  font-weight: 600;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-block-start: 20px;
}

.action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  background: var(--surface);
  color: var(--label);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.action:hover {
  background: var(--fill);
}

.action-primary {
  border-color: var(--label);
  background: var(--label);
  color: var(--page);
}

.action-primary:hover {
  background: var(--label);
  opacity: 0.84;
}

.language-panel,
.contents,
.reader,
.related {
  margin: 0;
  padding: 24px 20px;
}

.language-panel,
.contents,
.related {
  border-block-end: 1px solid var(--soft-separator);
}

.language-panel h2,
.contents h2,
.reader > h2,
.related > h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.language-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.language-chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  color: var(--secondary-label);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.language-chip.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.contents {
  background: var(--grouped);
}

.contents ol {
  margin: 0;
  padding-inline-start: 24px;
}

.contents li + li {
  margin-block-start: 8px;
}

.contents a {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.reader {
  max-width: 780px;
  margin-inline: auto;
  padding-block: 34px 52px;
}

.reader > h2 {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.preview-section {
  scroll-margin-top: 78px;
}

.preview-section + .preview-section {
  margin-block-start: 34px;
}

.preview-section h3 {
  margin: 0 0 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter Variable", "Segoe UI", Roboto, sans-serif;
  font-size: clamp(27px, 6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.preview-section p {
  margin: 0;
  color: var(--secondary-label);
  font-family: -apple-system, BlinkMacSystemFont, "Inter Variable", "Segoe UI", Roboto, sans-serif;
  font-size: clamp(17px, 4.5vw, 20px);
  line-height: 1.72;
}

.preview-notice {
  margin-block-start: 36px;
  padding: 18px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--accent-soft);
}

.preview-notice p {
  margin: 0 0 12px;
  color: var(--secondary-label);
  font-size: 14px;
}

.preview-notice a {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.related {
  background: var(--grouped);
}

.related-grid {
  display: grid;
  gap: 12px;
}

.related-card {
  display: flex;
  min-width: 0;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--soft-separator);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
}

.related-card:hover {
  border-color: var(--separator);
}

.related-card img {
  flex: 0 0 72px;
  width: 72px;
  height: 104px;
  border-radius: 6px;
  object-fit: cover;
}

.related-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.related-type {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.related-copy strong {
  font-size: 16px;
  line-height: 1.25;
}

.related-copy > span:last-child {
  display: -webkit-box;
  overflow: hidden;
  color: var(--secondary-label);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

footer {
  display: flex;
  max-width: 1040px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-inline: auto;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  color: var(--tertiary-label);
  font-size: 13px;
}

footer a {
  color: var(--accent);
  font-weight: 650;
}

.error-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--grouped);
}

.error-card {
  width: min(100%, 430px);
  padding: 32px 24px;
  border: 1px solid var(--soft-separator);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
}

.error-card img {
  border-radius: 12px;
}

.error-card > p:first-of-type {
  margin: 10px 0 22px;
  font-weight: 700;
}

.error-card h1 {
  font-size: 28px;
}

.error-card h1 + p {
  margin: 12px 0 24px;
  color: var(--secondary-label);
}

@media (min-width: 720px) {
  .topbar {
    padding-inline: 28px;
  }

  .summary-hero {
    grid-template-columns: 188px minmax(0, 1fr);
    gap: 32px;
    padding: 42px 32px;
  }

  .cover,
  .cover img {
    width: 188px;
  }

  .cover img {
    height: 270px;
    border-radius: 10px;
  }

  .summary-actions {
    grid-template-columns: repeat(3, minmax(108px, max-content));
  }

  .language-panel,
  .contents,
  .related {
    padding-inline: 32px;
  }

  .reader {
    padding-inline: 32px;
  }

  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  main {
    margin-block-start: 28px;
    overflow: hidden;
    border: 1px solid var(--soft-separator);
    border-radius: 20px;
    background: var(--surface);
  }
}

@media (max-width: 419px) {
  .brand span {
    display: none;
  }

  .summary-hero {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    padding-inline: 16px;
  }

  .cover,
  .cover img {
    width: 96px;
  }

  .cover img {
    height: 139px;
  }

  .source-metadata {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
