:root {
  --bg: #fcfcfa;
  --text: #1b1b1b;
  --muted: #595959;
  --accent: #1f4e8c;
  --rule: #e4e3dd;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

/* Links */

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: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  font-family: var(--sans);
  font-size: 0.95rem;
}

.skip-link:focus {
  top: 1rem;
}

/* Header */

.masthead {
  margin-bottom: 2.5rem;
}

.masthead::after {
  content: "";
  display: block;
  clear: both;
}

.portrait {
  float: right;
  width: 120px;
  height: auto;
  margin: 0.25rem 0 1rem 1.5rem;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.role {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: 1rem;
}

/* Sections */

h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

p {
  margin: 0 0 0.6rem;
}

cite {
  font-style: italic;
}

ul.plain {
  margin: 0;
  padding-left: 1.2rem;
}

ul.plain li + li {
  margin-top: 0.2rem;
}

/* Entries (education, projects) */

.entry + .entry {
  margin-top: 1.6rem;
}

.entry h3 {
  margin-bottom: 0.25rem;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.entry-head h3 {
  margin-bottom: 0.1rem;
}

.where {
  color: var(--muted);
}

.meta,
.when,
.detail {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}

.when {
  margin: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Compact rows (experience, writing, service) */

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

ul.rows li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

ul.rows li + li {
  margin-top: 0.55rem;
}

.detail {
  display: block;
}

/* Footer */

footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
}

footer p {
  margin: 0;
}

/* Narrow screens */

@media (max-width: 36rem) {
  body {
    font-size: 1.0625rem;
  }

  .page {
    padding: 2.5rem 1rem 2rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .portrait {
    width: 96px;
  }

  .entry-head,
  ul.rows li {
    flex-direction: column;
    gap: 0;
  }
}

/* Print */

@media print {
  @page {
    margin: 18mm 20mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .skip-link {
    display: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .contact a::after,
  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: var(--sans);
    font-size: 0.85em;
    color: #444;
  }

  .contact a[href^="mailto:"]::after {
    content: " (mtseckdev@gmail.com)";
  }

  .meta,
  .when,
  .detail,
  .where,
  .role,
  footer {
    color: #333;
  }

  .masthead {
    margin-bottom: 1.25rem;
  }

  h2 {
    margin-top: 1.4rem;
    break-after: avoid;
  }

  .entry + .entry {
    margin-top: 1rem;
  }

  ul.rows li {
    break-inside: avoid;
  }

  footer {
    margin-top: 1.5rem;
  }
}
