/* Shared by every page: header bar, toggles, search. */

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

:root {
  --blue: #0000FF;
  --red: #FF0000;
  --gutter: clamp(16px, 3vw, 40px);
  /* Three type sizes for the whole site: titles and the header, running text, small labels */
  --fs-1: 18px;
  --fs-2: 15px;
  --fs-3: 13px;
}

body {
  font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
  color: var(--blue);
  background: #fff;
  font-size: var(--fs-2);
  line-height: 1.4;
}

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

a:hover {
  color: var(--red);
}

a, button, input {
  -webkit-tap-highlight-color: transparent;
}

/* ─── Header: the card, stretched into a bar ─── */

/* One logo unit (u) is one unit of the original card drawing.
   The logo box is 48.69 units high, so everything in the header scales with --logo-h.
   The header with toggles and search stays at full size while the page scrolls. */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  padding: var(--gutter) var(--gutter) 0;
  /* Header text one size above the pills: 10 units = 18px */
  --logo-h: calc(18px * 4.869);
  --u: calc(var(--logo-h) / 48.69);
  --line: max(1px, calc(var(--u) * 0.5));
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: calc(var(--u) * 6);
  border: var(--line) solid var(--blue);
  padding: calc(var(--u) * 2.08);
}

.logo {
  display: block;
  flex: none;
}

/* Desktop: four lines, 48.69 units high. Phone: three lines, 36.5 units, so the
   contacts below follow at the same line spacing (11.34 units) as the logo's lines. */
.logo svg {
  display: block;
  width: auto;
}

.logo-desk {
  height: var(--logo-h);
}

.logo-phone {
  display: none !important;
  height: calc(var(--u) * 36.5);
}

.logo:hover .st3 {
  fill: var(--red);
}

.contacts {
  list-style: none;
  text-align: right;
  text-transform: uppercase;
  font-size: calc(var(--u) * 10);
  line-height: calc(var(--u) * 11.34);
  padding: calc(var(--u) * 2.5) calc(var(--u) * 2.84) 0 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.contacts button {
  font: inherit;
  color: inherit;
  text-transform: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.contacts button:hover {
  color: var(--red);
}

/* Thin arrow after the CV link. Same 0.5 line as the logo box. */
.link-arrow {
  width: 0.6em;
  height: 0.72em;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.5;
  vertical-align: baseline;
  margin-left: 0.15em;
}

/* ─── Toggles ─── */

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
}

.toggle {
  display: inline-block;
  font: inherit;
  font-size: var(--fs-2);
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--blue);
  padding: 0.45em 0.8em 0.4em;
  cursor: pointer;
}

.toggle:hover {
  color: var(--red);
  border-color: var(--red);
}

.toggle.active {
  background: var(--blue);
  color: #fff;
}

.toggle.active:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.toggle sup {
  font-size: 0.62em;
  margin-left: 0.15em;
}

.toggle.empty {
  opacity: 0.35;
}

/* ─── Search ─── */

main {
  padding: 24px var(--gutter) 80px;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5em;
  border: 1px solid var(--blue);
  padding: 0.55em 0.8em;
  margin: 0 0 16px;
  font-size: var(--fs-1);
}

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--blue);
  border: none;
  outline: none;
  background: none;
}

.search input::placeholder {
  color: var(--blue);
  opacity: 0.45;
}

.search button {
  font: inherit;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  visibility: hidden;
}

.search.filled button {
  visibility: visible;
}

.search button:hover {
  color: var(--red);
}

/* Back to the top, bottom right; shown once the page has scrolled a screen down */
.to-top {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 20;
  font: inherit;
  font-size: var(--fs-1);
  line-height: 1;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--blue);
  padding: 0.35em 0.6em;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.to-top.shown {
  visibility: visible;
  opacity: 1;
}

.to-top:hover {
  color: var(--red);
  border-color: var(--red);
}

h2 {
  font-size: var(--fs-2);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--blue);
  padding-bottom: 6px;
  margin-bottom: 20px;
}

/* ─── Phone ─── */

@media (max-width: 700px) {
  /* Scales down on narrow phones, so the email still fits in the frame */
  .top {
    --logo-h: clamp(60px, 22vw, 84px);
  }

  .logo-desk {
    display: none !important;
  }

  .logo-phone {
    display: block !important;
  }

  .bar {
    flex-direction: column;
    gap: 0;
  }

  .contacts {
    text-align: left;
    padding: 0 0 0 calc(var(--u) * 3.09);
  }

  .toggles {
    gap: 6px;
    padding: 10px 0;
  }

  .toggle {
    font-size: var(--fs-3);
  }

  .search {
    font-size: var(--fs-2);
    margin-bottom: 12px;
  }
}
