/* antonypradervand.ch — "The well-governed document"
   Palette (exactly five colors, per docs/01-DESIGN-BRIEF.md) */

:root {
  --paper: #FCFAF5;
  --ink: #1A1915;
  --muted: #6B675C;
  --hairline: #DFD9CC;
  --accent: #A2401F;
}

/* ---------- fonts (self-hosted) ---------- */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+2013-2014, U+2018-2019, U+201C-201D, U+2026, U+00B7;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0152-0153, U+1E00-1EFF;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+00B7;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0152-0153;
}

/* ---------- base ---------- */

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

html {
  font-size: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem; /* 17px — sans reads larger than serif at equal size */
  font-weight: 400;
  line-height: 1.65;
  max-width: 60rem; /* ~960px content column */
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.2rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.05rem; margin: 0; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 120ms;
}
a:hover { color: var(--ink); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The mono metadata seam */
.meta {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8125rem; /* 13px */
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.meta a { color: var(--muted); }
.meta a:hover { color: var(--accent); }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--paper);
  padding: 0.25rem 0.5rem;
  z-index: 10;
}

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

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 2.5rem;
}

.site-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.site-name a {
  color: var(--ink);
  text-decoration: none;
}
.site-name a:hover { color: var(--accent); }

.site-header-right {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-header nav[aria-label] a {
  color: var(--ink);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 1rem;
}
.site-header nav[aria-label] a:first-child { margin-left: 0; }
.site-header nav[aria-label] a:hover { color: var(--accent); }
.site-header nav[aria-label] a[aria-current="page"] { color: var(--accent); }

/* language dropdown */
.lang-menu {
  position: relative;
}
.lang-menu summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.15rem 0;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { color: var(--accent); }
.lang-menu[open] summary { color: var(--accent); }
.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--hairline);
  min-width: 9rem;
  z-index: 20;
}
.lang-menu ul a {
  display: block;
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  color: var(--muted);
}
.lang-menu ul a:hover { color: var(--accent); }
.lang-menu ul a[aria-current="true"] { color: var(--accent); }

/* ---------- home ---------- */

.intro-block {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.intro-text { flex: 1 1 auto; min-width: 0; }

.headline {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}
.intro-text > .meta { display: block; margin-bottom: 0.2rem; }
.intro-text > .contact-inline { margin-bottom: 1.25rem; }

/* matted frame: outer hairline, paper margin, inner hairline */
.portrait-frame {
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  padding: 6px;
  background: var(--paper);
  align-self: flex-start;
}
.portrait {
  display: block;
  width: 150px;
  height: 150px;
  border: 1px solid var(--hairline);
  object-fit: cover;
}
.portrait-placeholder {
  flex: 0 0 auto;
  background: transparent;
}

/* functional link/location icons (monochrome, inherit text color) */
.icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.12em;
  margin-right: 0.5em;
  fill: currentColor;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 2.1;
}

/* ---------- entries (CV rhythm: mono metadata left, serif content right) ---------- */

.entry {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 0 1.5rem;
  margin-bottom: 1.5rem;
}
.entry:last-child { margin-bottom: 0; }

.entry-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  padding-top: 0.3rem; /* optical alignment with the h3 baseline */
}

.org {
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* mandate list under an affiliation entry — one fold for the whole list */
details.mandates {
  margin-top: 0.75rem;
}
.mandates summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.1rem 0;
}
.mandates summary::-webkit-details-marker { display: none; }
.mandates summary::before {
  content: "\25B8"; /* ▸ */
  display: inline-block;
  width: 1rem;
  font-size: 0.85em;
}
.mandates[open] summary::before { content: "\25BE"; /* ▾ */ }
.mandates summary:hover { color: var(--accent); }
.mandates summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.mandates-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--hairline);
}
.mandate {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0 1.25rem;
  margin-bottom: 0.9rem;
  font-size: 0.9375rem; /* mandates sit one step below the body text */
}
.mandate:last-child { margin-bottom: 0; }
.mandate .entry-meta { padding-top: 0.15rem; }
.mandate-title {
  font-size: inherit;
  font-weight: 400;
  margin: 0;
}
.mandate-body p { margin-bottom: 0.25rem; }
.mandate-body p:last-child { margin-bottom: 0; }

.contact-inline a { color: var(--accent); }
.contact-inline a:hover { color: var(--ink); }

.entry-body p:not(.org) { margin-bottom: 0.5rem; }

.fallback-note {
  display: block;
  margin-bottom: 0.5rem;
  font-style: normal;
}

.skill-group { margin-bottom: 1.25rem; }
.skill-group h3 { margin-bottom: 0.25rem; }

.languages { max-width: 40rem; }

.citation { max-width: 40rem; }

/* services */
.services-intro { margin-bottom: 2rem; }
.services-intro p { max-width: 40rem; }
.services-cta {
  margin-top: 2rem;
  margin-bottom: 0.25rem;
  max-width: 40rem;
}
.services .entry-meta { padding-top: 0.35rem; }
.services-teaser p { max-width: 40rem; }

section h2 {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--hairline);
}

/* cap prose measure at ~70ch */
.intro-text p:not(.meta),
.entry-body p,
.skill-group p,
.privacy p {
  max-width: 40rem;
}

address { font-style: normal; }

/* ---------- contact form (modal card) ---------- */

.contact-cta { margin-top: 0.75rem; }

dialog.contact-form {
  margin: auto;
  border: 1px solid var(--hairline);
  border-radius: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  width: calc(100% - 2.5rem);
  max-width: 40rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}
dialog.contact-form::backdrop {
  background: rgba(26, 25, 21, 0.45);
}
.dialog-inner { padding: 1.5rem 1.75rem 1.75rem; }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}
.dialog-head h2 { margin: 0; }
.dialog-close {
  background: none;
  border: none;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.2rem;
}
.dialog-close:hover { color: var(--accent); }
.dialog-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-form form { max-width: 34rem; }
.contact-form label {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  padding: 0.5rem 0.65rem;
}
.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.contact-form textarea { resize: vertical; }
.contact-form button[type="submit"] {
  font: inherit;
  font-weight: 600;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: 2px;
  padding: 0.5rem 1.4rem;
  cursor: pointer;
  transition: background-color 120ms;
}
.contact-form button[type="submit"]:hover { background: var(--ink); }
.contact-form button[type="submit"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.contact-form .hp {
  position: absolute;
  left: -9999px;
  height: 0;
  overflow: hidden;
}
.notice {
  max-width: 40rem;
  border: 1px solid var(--muted);
  padding: 0.7rem 1rem;
  font-weight: 600;
}
.notice-sent::before {
  content: "\2713"; /* ✓ */
  margin-right: 0.6rem;
}
.notice-error::before {
  content: "\2717"; /* ✗ */
  margin-right: 0.6rem;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}
.site-footer p { margin-bottom: 0.25rem; }
.site-footer > p:first-child { font-size: 0.9375rem; }
.colophon { margin-top: 0.25rem; }

/* ---------- responsive: collapse the seam below 640px ---------- */

@media (max-width: 640px) {
  .entry,
  .mandate {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .entry-meta {
    flex-direction: row;
    gap: 0.75rem;
    padding-top: 0;
  }
  .intro-block {
    flex-direction: column-reverse;
    gap: 1.25rem;
  }
  .site-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ---------- print (the CV should print beautifully) ---------- */

@media print {
  body {
    background: #fff;
    color: #000;
    max-width: none;
    padding: 0;
    font-size: 11pt;
  }
  .site-header nav,
  .lang-menu,
  .skip,
  .contact-form,
  .contact-cta,
  .site-footer { display: none; }
  .site-header {
    border-bottom: 1px solid #000;
    margin-bottom: 1.5em;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  .entry { break-inside: avoid; }
  section h2 { border-bottom-color: #000; }
  .meta { color: #444; }
}
