/* FONTS */

@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: e'), url('fira-code-normal-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: e'), url('fira-code-normal-symbols2.woff2') format('woff2');
  unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F;
}

@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: e'), url('fira-code-normal-latin.woff2') format('woff2');
  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';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('inter-italic-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('inter-italic-latin.woff2') format('woff2');
  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';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('inter-normal-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('inter-normal-latin.woff2') format('woff2');
  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;
}

:root {
  --font-primary: Inter, Helvetica, Tahoma, Arial, sans-serif;
  --font-code: 'Fira Code', Consolas, Menlo, Monaco, 'Courier New', monospace;
}


/* DOCUMENT */

html, body {
  margin: 0;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: break-word;
}

body {
  box-sizing: border-box;
  min-width: 360px;
  padding: 144px 28px 128px;
}

::selection {
  background: #000;
  color: #fff;
}

/* RESETS */

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
}

/* GLOBALS */

a {
  padding: 2px 4px 3px;
  margin: -2px -4px -3px;
  font-weight: 600;
  text-decoration: none;
  color: #000;
}

a:hover {
  background: #D9D9D9;
}

pre {
  max-width: 100%;
  overflow-x: auto;
}

code {
  font-family: var(--font-code);
}

pre code {
  display: block;
}

p:first-child {
  margin-top: 0;
}

p:last-child {
  margin-bottom: 0;
}

p:target {
  scroll-margin-top: 16px;
}

/* HEADER */

.header {
  margin-bottom: 144px;
}

/* LOGO */

.logo {
  font-size: 36px;
  line-height: 1.2;
}

/* WRITINGS */

.writings {
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.writing__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 16px;
  line-height: 20px;
}

.writing__item p,
.writing__item pre {
  margin: 0;
}

.writing__item h2 {
  grid-area: title;
  font-size: 16px;
  line-height: 20px;
}

.writing__item h2 a {
  display: inline-block;
  width: fit-content;
}

.writing__item p {
  grid-area: description;
}

.writing__item footer {
  grid-area: meta;
}

.writing__item footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 16px;
  opacity: .2;
}

.writing__item_type_essay footer {
  opacity: 0.4;
}

.writing__item_type_research footer {
  opacity: 0.6;
}

@media (min-width: 960px) {
  .writing__item {
    display: grid;
    grid-template-areas: 
      'meta title'
      'meta description';
    grid-template-columns: 320px 1fr;
    max-width: 960px;
  }

  .writing__item footer {
    gap: 4px;
  }
}

/* WRITING */

.writing {
  display: grid;
  grid-template-areas: 
    'header'
    'content'
    'meta';
  max-width: 640px;
}

.writing__header {
  grid-area: header;
  margin-bottom: 144px;
}

.writing__header h1 {
  font-size: 36px;
  line-height: 1.2;
}

.writing__content {
  grid-area: content;
  max-width: min(640px, calc(100vw - 28px * 2));
  font-size: 16px;
  line-height: 1.4;
}

.writing__content sup a {
  padding: 2px 4px 1px;
  margin: -2px -4px -1px;
}

.writing__content li + li {
  margin-top: 16px;
}

.writing__content hr {
  margin: 32px 0;
  text-align: center;
  border: 0;
}

.writing__content hr::before {
  content: '***';
  font-family: var(--font-code);
  color: #000;
}

.writing__meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 64px;
  font-size: 14px;
  line-height: 16px;
  opacity: .4;
}

.writing__footnotes {
  margin-top: 64px;
}

.writing__footnotes h2 {
  font-weight: 700;
  font-size: 16px;
  line-height: 20px;
}

.writing__footnotes ol {
  margin: 16px 0 0;
  padding: 0 0 0 20px;
}

.writing__footnotes ol li + li {
  margin-top: 16px;
}

.writing__footnotes ol li:target {
  scroll-margin-top: 16px;
}

.writing__footnotes ol li:target::marker {
  font-weight: 700;
}

.writing__footnotes a[href$="-source"] {
  position: relative;
  top: 2px;
  padding: 3px 4px 0px;
  margin: -3px -4px 0;
}

@media (min-width: 960px) {
  .writing {
    grid-template-areas: 
    '. header'
    'meta content';
    grid-template-columns: 320px 1fr;
    max-width: 960px;
  }

  .writing__meta {
    margin-top: 0;
  }
}

/* PAGE FOOTER */

.page-footer {
  box-sizing: border-box;
  max-width: 640px;
  margin-top: 128px;
  text-align: center;
  user-select: none;
}

.page-footer a {
  line-height: 1.4;
}

@media (min-width: 960px) {
  .page-footer {
    position: absolute;
    top: 154px;
    left: 28px;
    margin-top: 0;
    white-space: nowrap;
  }
}
