/* saddambaialiev.com. One stylesheet, system fonts only. */

:root {
  --paper: #f3f5f4;   /* the pale haze at the horizon */
  --ink: #1e2a33;     /* slate, not black */
  --muted: #56636d;
  --accent: #2b5d86;  /* evening sky, darkened for text */
  --rule: #d6dddc;
  --mark: #dfe9d3;    /* the green of the shirt, for selected text */

  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --measure: 36rem;
  --gutter: 1.25rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171d22;
    --ink: #e2e7e9;
    --muted: #9ba7af;
    --accent: #93bde3;
    --rule: #2c363e;
    --mark: #33452c;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.1875rem);
  line-height: 1.62;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  hanging-punctuation: first;
}

::selection { background: var(--mark); color: var(--ink); }

main {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 6rem) var(--gutter) 5rem;
}

p { margin: 0 0 1em; }

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

h1 {
  font-size: clamp(2.1rem, 1.6rem + 2.4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.012em;
}

main > header { margin-bottom: 2.5rem; }

.lede {
  margin: 0.55rem 0 0;
  font-size: 1.15em;
  line-height: 1.45;
  color: var(--muted);
}

/* The photo */

.photo { margin: 0 0 2.75rem; max-width: 26rem; }

.photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: var(--rule);
}

.photo figcaption {
  margin-top: 0.6rem;
  font-size: 0.875em;
  font-style: italic;
  color: var(--muted);
}

/* Sections */

h2 {
  margin: 3.25rem 0 1rem;
  font-size: 1.3em;
  font-style: italic;
  line-height: 1.3;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

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

/* Work: a quiet list, years on the left */

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jobs li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  column-gap: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.jobs li:last-child { border-bottom: 1px solid var(--rule); }

.when {
  margin: 0;
  padding-top: 0.12em;
  font-size: 0.9em;
  color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}

.jobs h3 {
  font-size: 1em;
  font-weight: 700;
  line-height: 1.4;
}

.role {
  display: block;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}

.jobs h3 + p {
  margin: 0.35rem 0 0;
  font-size: 0.94em;
  line-height: 1.55;
}

/* Write to me */

.address {
  margin-top: 1.5rem;
  font-size: clamp(1.3em, 1.1em + 1.2vw, 1.6em);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Narrow phones: the years go above each job. */

@media (max-width: 30rem) {
  .jobs li { grid-template-columns: 1fr; }
  .when { padding-top: 0; margin-bottom: 0.15rem; }
}

/* Wide screens: the photo stays beside the letter while it is read. */

@media (min-width: 62rem) {
  main {
    max-width: none;
    display: grid;
    grid-template-columns: 21rem var(--measure);
    column-gap: clamp(3rem, 6vw, 5.5rem);
    justify-content: center;
    align-items: start;
  }
  main > * { grid-column: 2; }
  main > .photo {
    grid-column: 1;
    grid-row: 1 / span 8;
    margin: 0.6rem 0 0;
  }
}

@media (min-width: 62rem) and (min-height: 44rem) {
  main > .photo { position: sticky; top: 3rem; }
}

/* The 404 page */

.lost h1 { margin-bottom: 1rem; }
