/* editorial - "the Olivetti dossier": a light, print-grade theme for fedterzi.com */

:root {
  --carta: #f6f4ee;       /* paper */
  --inchiostro: #1d1b18;  /* ink */
  --vermiglio: #c8321e;   /* Olivetti vermilion - punctuation only */
  --grafite: #6f6a61;     /* secondary */
  --filo: #dbd6ca;        /* hairlines */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --rail: clamp(8.5rem, 17vw, 11rem);
  --gutter: 2.75rem;
  --measure: 66ch;
}

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

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

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

main,
footer {
  max-width: 59rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

main {
  padding-top: clamp(2.25rem, 7vh, 4.5rem);
}

::selection {
  background: var(--inchiostro);
  color: var(--carta);
}

/* --- links: ink text on a vermilion thread; hover thickens - print does not move --- */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--vermiglio);
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--vermiglio);
  text-decoration-thickness: 0.12em;
}

:focus-visible {
  outline: 2px solid var(--vermiglio);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: -100vw;
  z-index: 10;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--inchiostro);
  color: var(--carta);
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.skip-link:focus-visible {
  left: 0;
}

/* --- hero: the letterhead, the name, the red full stop --- */

.hero {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gutter);
  margin-bottom: clamp(2.5rem, 7vh, 4.5rem);
}

.hero > * {
  grid-column: 1 / -1;
}

.kicker {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grafite);
  border-bottom: 1px solid var(--filo);
  padding-bottom: 0.8rem;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.display {
  font-size: clamp(2.75rem, 8.5vw, 6.25rem);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.stop {
  color: var(--vermiglio);
}

.role {
  margin-top: 1.1rem;
  font-variant-caps: small-caps;
  letter-spacing: 0.17em;
  font-size: 1.15rem;
}

.epigraph {
  grid-column: 2;
  margin-top: clamp(1.75rem, 4vh, 2.75rem);
  font-style: italic;
  font-size: 1.1875rem;
  line-height: 1.55;
  max-width: 34em;
  padding-left: 1.35em;
  text-indent: -1.35em;
}

.epigraph::before {
  content: "";
  font-style: normal;
  color: var(--grafite);
}

/* --- sections: hairline rule, vermilion tick over the rail, mono label --- */

section {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: baseline;
  border-top: 1px solid var(--filo);
  padding-block: 1.9rem 3.25rem;
  scroll-margin-top: 1.5rem;
}

section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: var(--rail);
  height: 1px;
  background: var(--vermiglio);
}

section > * {
  grid-column: 2;
}

section > h2 {
  grid-column: 1;
}

h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grafite);
  text-align: right;
}

#experience h2,
#education h2 {
  margin-bottom: 2rem;
}

.sec-body {
  max-width: var(--measure);
}

.sec-body p + p {
  margin-top: 1.05rem;
}

/* --- experience: dates in the margin rail, a beautifully set curriculum --- */

.job,
.edu {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: baseline;
}

.job + .job {
  margin-top: 2.1rem;
  padding-top: 2.1rem;
  border-top: 1px solid var(--filo);
}

.job-rail {
  grid-column: 1;
  text-align: right;
}

.job-when {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.job-where {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--grafite);
  margin-top: 0.3rem;
}

.job-body {
  grid-column: 2;
  max-width: var(--measure);
}

.job-head {
  font-size: 1.3125rem;
  line-height: 1.3;
  font-weight: 400;
}

.job-company {
  font-weight: 700;
}

.dash {
  color: var(--grafite);
  font-weight: 400;
}

.job-role {
  font-style: italic;
  font-weight: 400;
}

.job-points {
  list-style: none;
  margin-top: 0.85rem;
}

.job-points li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.55rem;
}

.job-points li:last-child {
  margin-bottom: 0;
}

.job-points li::before {
  content: "–";
  position: absolute;
  left: 0.2rem;
  color: var(--vermiglio);
}

.job-tech {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--grafite);
}

.job-tech span + span::before,
.skill-group span + span::before {
  content: " · ";
  color: var(--grafite);
}

/* --- skills --- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.9rem 2.5rem;
}

.skill-group h3 {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grafite);
  margin-bottom: 0.45rem;
}

.skill-group p {
  font-size: 1rem;
}

/* --- education --- */

.edu + .edu {
  margin-top: 1.9rem;
}

.edu-years {
  grid-column: 1;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.edu-body {
  grid-column: 2;
  max-width: var(--measure);
}

.edu-school {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
}

.edu-degree {
  font-style: italic;
  margin-top: 0.15rem;
}

/* --- contact --- */

.contact-line {
  font-size: 1.125rem;
}

.contact-note {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--grafite);
}

/* --- footer: colophon and the three settings --- */

footer {
  padding-bottom: 3.5rem;
}

footer::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--filo);
  margin-bottom: 1.6rem;
}

.theme-switch,
.colophon {
  margin-left: calc(var(--rail) + var(--gutter));
}

.theme-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--grafite);
}

.ts-label {
  margin-right: 0.4rem;
}

.theme-switch a {
  color: var(--inchiostro);
}

.theme-switch a:hover {
  color: var(--vermiglio);
}

.theme-switch a[aria-current] {
  text-decoration: none;
  color: var(--grafite);
}

.ts-sep {
  color: var(--grafite);
}

.colophon {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--grafite);
}

/* --- 404 --- */

.error-page .display {
  font-size: clamp(2.25rem, 7vw, 4.25rem);
}

.error-page main {
  min-height: 60vh;
}

/* --- narrow screens: the rail folds above the text --- */

@media (max-width: 45.99rem) {
  .hero,
  section,
  .job,
  .edu {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero > *,
  section > *,
  .epigraph,
  .job,
  .edu,
  .job-rail,
  .job-body,
  .edu-years,
  .edu-body {
    grid-column: 1;
  }

  section > h2 {
    grid-column: 1;
    text-align: left;
    margin-bottom: 1.4rem;
  }

  #experience h2,
  #education h2 {
    margin-bottom: 1.4rem;
  }

  section::before {
    width: 3.5rem;
  }

  .job-rail {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.9rem;
    text-align: left;
    margin-bottom: 0.55rem;
  }

  .job-where {
    margin-top: 0;
  }

  .edu-years {
    text-align: left;
    margin-bottom: 0.3rem;
  }

  .theme-switch,
  .colophon {
    margin-left: 0;
  }
}

/* --- print: this theme is a print CV; give it the page it deserves --- */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 10.5pt;
  }

  main,
  footer {
    max-width: none;
    padding: 0;
  }

  .skip-link,
  .theme-switch {
    display: none;
  }

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

  #contact a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: var(--mono);
    font-size: 8pt;
    color: #444;
  }

  p {
    orphans: 3;
    widows: 3;
  }

  .display {
    font-size: 26pt;
  }

  .hero {
    margin-bottom: 1.5rem;
  }

  .kicker {
    margin-bottom: 1.25rem;
  }

  .epigraph {
    margin-top: 1rem;
  }

  section {
    padding-block: 1rem 1.6rem;
  }

  .job,
  .edu,
  .skill-group {
    break-inside: avoid;
  }

  .job + .job {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
  }

  .colophon {
    margin-left: 0;
  }
}

/* --- motion: there is none - print does not move; belt and braces --- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
