:root {
  --paper: #FAF7F2;
  --ink: #1C1C1C;
  --head: #2A2A2A;
  --muted: #78736A;
  --faint: #8C8578;
  --rule: #E4DCCE;
  --accent: #34778A;
}

:root[data-theme="dark"] {
  --paper: #17171A;
  --ink: #E8E4DC;
  --head: #E8E4DC;
  --muted: #8F8B82;
  --faint: #7C786F;
  --rule: #2E2C29;
  --accent: #6FB3C4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17171A;
    --ink: #E8E4DC;
    --head: #E8E4DC;
    --muted: #8F8B82;
    --faint: #7C786F;
    --rule: #2E2C29;
    --accent: #6FB3C4;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.68;
}

.page {
  max-width: 800px;
  margin: 0 auto;
  padding: 56px 40px 0;
}

a {
  color: var(--accent);
}

/* Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-name {
  font-weight: 600;
  color: var(--ink);
}

.site-links {
  display: flex;
  gap: 20px;
}

.site-links a {
  color: var(--muted);
  text-decoration: none;
}

.site-links a:hover {
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-toggle:hover {
  color: var(--accent);
}

.theme-toggle .label-dark,
:root[data-theme="dark"] .theme-toggle .label-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .label-dark {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .label-light {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .label-dark {
    display: inline;
  }
}

/* Intro */

h1 {
  margin: 80px 0 40px;
  font-size: 44px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.028em;
  max-width: 12ch;
  color: var(--head);
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 44px;
  align-items: start;
}

.intro-text p {
  margin-bottom: 18px;
}

.intro-text p:last-child {
  margin-bottom: 0;
}

.intro-text strong {
  font-weight: 600;
}

.intro-photo img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Sections */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.section-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--ink);
}

#work .section-head {
  margin-top: 88px;
}

#before .section-head {
  margin-top: 64px;
  margin-bottom: 44px;
}

.work-intro {
  margin: 16px 0 44px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 52ch;
}

/* Items */

.work-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 24px;
  padding: 18px 0 34px;
  border-top: 1px solid var(--rule);
}

.item-index {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.work-item h3 {
  font-size: 23px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--head);
}

.item-meta {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
  text-align: right;
}

.work-item p {
  font-size: 16px;
  line-height: 1.68;
  max-width: 58ch;
  margin-bottom: 14px;
}

.work-item p:last-child {
  margin-bottom: 0;
}

.work-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(52, 119, 138, 0.35);
  padding-bottom: 2px;
}

.work-link:hover {
  border-bottom-color: var(--accent);
}

/* Footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding: 22px 0 56px;
  border-top: 1px solid var(--ink);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Legal pages */

.legal {
  padding-top: 40px;
}

.legal h2 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--head);
  margin-bottom: 24px;
}

.legal h3 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.legal p {
  font-size: 16px;
  line-height: 1.68;
  color: var(--muted);
  max-width: 58ch;
  margin-bottom: 1rem;
}

.back-link {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

/* Mobile */

@media (max-width: 720px) {
  .page {
    padding: 32px 24px 0;
  }

  h1 {
    margin: 56px 0 32px;
    font-size: 34px;
  }

  .intro-grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
  }

  .intro-photo {
    order: -1;
  }

  .intro-photo img {
    width: 140px;
    height: 140px;
  }

  #work .section-head {
    margin-top: 64px;
  }

  .work-item {
    display: block;
  }

  .item-index {
    display: block;
    margin-bottom: 8px;
  }

  .item-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .item-meta {
    text-align: left;
    white-space: normal;
  }
}
