/* Plain CV: /cv/plain/ only, linked by src/layouts/Plain.astro. A document for
   recruiters and printers: system fonts, black on white, no view chrome. */

html[data-layout="plain"] {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #444444;
  --rule: #999999;
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 11pt;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;

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

  & body {
    margin: 0;
    padding: 32px 16px;
    background: var(--bg);
    overflow-wrap: anywhere;
  }

  & .plain {
    max-width: 72ch;
    margin: 0 auto;
  }

  & a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  & :focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
  }

  & h1,
  & h2 {
    margin: 0;
    font-size: 1em;
  }

  & p,
  & ul,
  & dl {
    margin: 0;
  }

  /* ---- header ---- */

  & .c-cv-name {
    font-size: 1.8em;
    line-height: 1.2;
  }

  & .c-cv-tagline {
    margin-top: 0.2em;
  }

  & .c-cv-location,
  & .plain-email {
    color: var(--muted);
  }

  & .c-cv-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5em;
    margin-top: 0.3em;
    padding: 0;
    list-style: none;
  }

  /* ---- sections: the label as a heading over a thin rule ---- */

  & section[aria-label]::before {
    display: block;
    margin: 1.4em 0 0.6em;
    padding-bottom: 0.15em;
    border-bottom: 1px solid var(--rule);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    content: attr(aria-label);
  }

  /* ---- roles: title and dates on one line, dates right-aligned ---- */

  & :is(.c-role, .c-leadership-item, .c-earlier-item) {
    margin-bottom: 0.9em;
  }

  & .c-role-title,
  & .c-leadership-title,
  & .c-earlier-title {
    font-weight: 600;
  }

  & .c-role-dates,
  & .c-role-location,
  & .c-leadership-org,
  & .c-earlier-org {
    color: var(--muted);
  }

  & :is(.c-role-summary, .c-leadership-summary, .c-earlier-excerpt) {
    margin-top: 0.25em;
  }

  @media (width >= 600px) {
    & .c-role {
      display: grid;
      grid-template-columns: 1fr auto;
      column-gap: 2em;
    }

    & .c-role > * {
      grid-column: 1 / -1;
    }

    & .c-role-title {
      grid-area: 1 / 1;
    }

    & .c-role-dates {
      grid-area: 1 / 2;
      text-align: right;
      white-space: nowrap;
    }

    & .c-role-org {
      grid-area: 2 / 1;
    }

    & .c-role-location {
      grid-area: 2 / 2;
      text-align: right;
    }
  }

  /* ---- patents, skills, education ---- */

  & .c-patents ul,
  & .c-education ul {
    padding: 0;
    list-style: none;
  }

  & .c-patent > *,
  & .c-education-item > * {
    display: block;
  }

  & .c-patent-number,
  & .c-education-award,
  & .c-skills dt {
    font-weight: 600;
  }

  & .c-patent-granted,
  & .c-patent-also {
    color: var(--muted);
  }

  & .c-skills dd {
    margin: 0 0 0.5em;
  }
}

@page {
  size: A4;
  margin: 12mm;
}

/* Print fits two A4 pages: smaller type, and each entry's heading details
   run onto one line. */
@media print {
  html[data-layout="plain"] {
    font-size: 9.5pt;
    line-height: 1.35;

    & body {
      padding: 0;
    }

    & section[aria-label]::before {
      margin: 0.9em 0 0.4em;
    }

    & :is(.c-role, .c-leadership-item, .c-earlier-item) {
      margin-bottom: 0.6em;
    }

    & :is(.c-role-summary, .c-leadership-summary, .c-earlier-excerpt) {
      margin-top: 0.1em;
    }

    /* Title, Org .......... Location · 2016 – present */
    & .c-role {
      grid-template-columns: auto 1fr auto auto;
      column-gap: 0.4em;
    }

    & .c-role-title {
      grid-area: 1 / 1;
    }

    & .c-role-title::after {
      content: ",";
    }

    & .c-role-org {
      grid-area: 1 / 2;
    }

    & .c-role-location {
      grid-area: 1 / 3;
    }

    & .c-role-location::after {
      content: " ·";
    }

    & .c-role-dates {
      grid-area: 1 / 4;
    }

    &
      :is(
        .c-leadership-title,
        .c-leadership-org,
        .c-earlier-title,
        .c-earlier-org
      ) {
      display: inline;
    }

    & :is(.c-leadership-title, .c-earlier-title)::after {
      content: ",";
    }

    & .c-patent > * {
      display: inline;
    }

    & .c-patent-number::after,
    & .c-patent-title::after,
    & .c-patent-granted:not(:last-child)::after {
      content: " · ";
    }

    & .c-skills {
      display: grid;
      grid-template-columns: max-content 1fr;
      gap: 0.15em 1.5em;
    }

    & .c-skills dd {
      margin: 0;
    }

    & .plain {
      max-width: none;
    }

    & .c-plain-link {
      display: none;
    }

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

    & a::after {
      content: none;
    }

    &
      :is(
        .c-role,
        .c-leadership-item,
        .c-earlier-item,
        .c-patent,
        .c-education-item
      ) {
      break-inside: avoid;
    }

    & section[aria-label]::before {
      break-after: avoid;
    }
  }
}
