:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #151515;
  --muted: #5f5f5f;
  --line: #e6e6e6;
  --link: #151515;
  --link-hover: #000000;
  --focus: #111111;
  --max-page: 840px;
  --max-reading: 820px;
  --space-page-x: 22px;
  --font-editorial: Charter, Georgia, Cambria, serif;
  --font-ui: Charter, Georgia, Cambria, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-editorial);
  font-size: 17px;
  line-height: 1.6;
  font-kerning: normal;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.site-header {
  padding: 22px var(--space-page-x) 0;
}

.site-nav {
  max-width: var(--max-page);
  margin: 0 auto;
  font-family: var(--font-ui);
}

.site-title {
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  white-space: nowrap;
}

.page {
  width: 100%;
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 30px var(--space-page-x) 78px;
}

.site-footer {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 0 var(--space-page-x) 42px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 9px;
}

.footer-nav a {
  color: var(--muted);
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.essay-page {
  max-width: var(--max-reading);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  font-weight: 380;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 30px;
  line-height: 1.16;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p {
  margin: 0 0 18px;
}

.intro {
  max-width: 560px;
  margin-bottom: 22px;
}

.intro h1 {
  margin-bottom: 8px;
  font-size: 24px;
}

.intro p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.section-title {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

.essay-list {
  margin-top: 0;
}

.essay-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  padding: 11px 0 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.essay-row:last-child {
  border-bottom: 1px solid var(--line);
}

.essay-row:visited {
  color: var(--text);
}

.essay-row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 5px;
}

.essay-year {
  padding-top: 1px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.essay-row h2 {
  margin-bottom: 3px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.28;
  text-wrap: pretty;
}

.essay-row:hover h2,
.essay-row:focus-visible h2 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}

.essay-row p {
  margin-bottom: 0;
}

.original-title,
.essay-meta,
.empty-state {
  color: var(--muted);
}

.original-title,
.essay-meta {
  font-size: 15px;
  line-height: 1.45;
}

.essay-header {
  margin-bottom: 22px;
}

.essay-header h1 {
  max-width: 780px;
  margin-bottom: 7px;
  font-size: 31px;
  font-weight: 360;
  line-height: 1.2;
}

.essay-meta {
  max-width: 760px;
  font-size: 15px;
  line-height: 1.38;
}

.essay-meta p {
  margin: 0;
}

.essay-meta a {
  color: var(--muted);
  border-bottom: 1px solid #d5d5d5;
  text-decoration: none;
}

.essay-meta a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.essay-body {
  font-size: 18.5px;
  line-height: 1.55;
}

.essay-body p {
  margin-bottom: 0.74em;
  orphans: 3;
  widows: 3;
  text-wrap: pretty;
}

.essay-body > :first-child {
  margin-top: 0;
}

.essay-body h1,
.essay-body h2,
.essay-body h3,
.essay-body h4,
.essay-body h5,
.essay-body h6 {
  margin: 1.45em 0 0.45em;
  font-weight: 430;
  line-height: 1.25;
  text-wrap: pretty;
}

.essay-body h1 {
  font-size: 1.28em;
}

.essay-body h2 {
  font-size: 1.16em;
}

.essay-body h3,
.essay-body h4,
.essay-body h5,
.essay-body h6 {
  font-size: 1em;
}

.essay-body a {
  color: var(--text);
  border-bottom: 1px solid #d2d2d2;
  text-decoration: none;
}

.essay-body a:hover {
  border-bottom-color: var(--text);
}

.footnote-ref {
  margin-left: 0.08em;
  font-size: 0.72em;
  line-height: 0;
  scroll-margin-top: 42vh;
}

.footnote-ref a {
  border-bottom: 0;
  color: var(--muted);
}

.footnote-ref a:hover,
.footnote-ref a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.essay-body blockquote {
  margin: 1.08em 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--line);
  color: #2b2b2b;
}

.essay-body ul,
.essay-body ol {
  margin: 0 0 0.85em 1.25em;
  padding: 0;
}

.essay-body li {
  margin-bottom: 0.35em;
}

.essay-body li > p {
  margin-bottom: 0.45em;
}

.essay-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  white-space: break-spaces;
}

.essay-body pre {
  margin: 1.05em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
}

.essay-body pre code {
  white-space: pre;
}

.footnotes {
  margin-top: 1.8em;
  padding-top: 1em;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88em;
  line-height: 1.5;
}

.footnotes ol {
  margin-bottom: 0;
}

.footnotes li:target {
  color: var(--text);
}

.footnotes li {
  scroll-margin-top: 42vh;
}

.footnote-backref {
  margin-left: 0.25em;
  color: var(--muted);
  font-size: 0.92em;
  font-style: italic;
  border-bottom-color: transparent;
}

.footnote-backref:hover,
.footnote-backref:focus-visible {
  color: var(--text);
  border-bottom-color: var(--text);
}

.essay-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.essay-nav a {
  display: block;
  min-width: 0;
  padding: 3px 0;
  color: var(--text);
}

.essay-nav-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.essay-nav-title {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.essay-nav a:hover .essay-nav-title,
.essay-nav a:focus-visible .essay-nav-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.empty-state {
  padding: 24px 0;
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.not-found,
.about-page {
  max-width: 660px;
}

.about-page p,
.not-found p {
  font-size: 19px;
  line-height: 1.65;
}

.admin-page {
  max-width: 720px;
}

.admin-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.admin-form {
  display: grid;
  gap: 8px;
  max-width: 520px;
}

.essay-editor {
  max-width: 780px;
}

.admin-form label {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  border: 1px solid #bdbdbd;
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 9px;
  font: inherit;
}

.admin-form textarea {
  min-height: 120px;
}

.essay-editor textarea#content_uz {
  min-height: min(720px, 68vh);
  line-height: 1.55;
}

.admin-form button,
.admin-top button {
  width: fit-content;
  border: 1px solid #bdbdbd;
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  padding: 6px 11px;
  font: inherit;
  cursor: pointer;
}

.admin-form button:hover,
.admin-top button:hover {
  border-color: #777777;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.flash-list {
  padding-left: 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-top: 1px solid var(--line);
  padding: 9px 10px 9px 0;
  text-align: left;
  vertical-align: top;
}

.admin-table span {
  color: var(--muted);
  font-size: 14px;
}

.admin-inline-link {
  font-size: 14px;
}

@media (min-width: 760px) {
  .site-header {
    padding-top: 28px;
  }

  .page {
    padding-top: 36px;
  }

  .home-page {
    padding-top: 26px;
  }

  .essay-nav.has-both {
    grid-template-columns: 1fr 1fr;
    column-gap: 42px;
  }

  .essay-nav.has-both .next-link {
    text-align: right;
  }
}

@media (max-width: 560px) {
  :root {
    --space-page-x: 16px;
  }

  body {
    font-size: 17px;
    line-height: 1.6;
  }

  .site-header {
    padding-top: 18px;
  }

  .site-title {
    font-size: 14px;
  }

  .page {
    padding-top: 28px;
    padding-bottom: 60px;
  }

  .home-page {
    padding-top: 20px;
  }

  .intro {
    margin-bottom: 18px;
  }

  .intro h1 {
    font-size: 23px;
  }

  h1,
  .essay-header h1 {
    font-size: 25px;
    line-height: 1.22;
  }

  .essay-header {
    margin-bottom: 20px;
  }

  .essay-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
  }

  .essay-year {
    font-size: 14px;
  }

  .essay-row h2 {
    font-size: 17px;
  }

  .original-title,
  .essay-meta {
    font-size: 14px;
  }

  .essay-body {
    font-size: 16.5px;
    line-height: 1.54;
  }

  .essay-body p {
    margin-bottom: 0.7em;
  }

  .essay-nav {
    margin-top: 32px;
  }

  .about-page p,
  .not-found p {
    font-size: 18px;
  }

  .admin-top {
    display: block;
  }

  .admin-table {
    font-size: 15px;
  }
}
