/* =====================================================================
   Josh Hopkins — CV
   A press proof: a sheet with a slug line of real metadata, a colour bar
   carrying the proofs, and a signed-off close.
   Four tones per theme. Anything else is an alpha mix of those four.
   ===================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL; licences in assets/fonts) ---------- */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root,
:root[data-theme="light"] {
  --paper: #f4f4f1;
  --ink: #161816;
  --rule: #5d635d;
  --sage: #4f6b53;

  --hair: color-mix(in srgb, var(--ink) 16%, transparent);
  --hair-strong: color-mix(in srgb, var(--ink) 34%, transparent);
  --on-sage: var(--paper);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #141614;
  --ink: #e9ebe6;
  --rule: #9aa19a;
  --sage: #a9c4ab;

  --hair: color-mix(in srgb, var(--ink) 16%, transparent);
  --hair-strong: color-mix(in srgb, var(--ink) 32%, transparent);
  --on-sage: var(--paper);

  color-scheme: dark;
}

:root {
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --page: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --nav-h: 60px;
  --measure: 68ch;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Base ---------- */

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html {
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: color-mix(in srgb, var(--ink) 30%, transparent) transparent;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--sage); color: var(--on-sage); }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p, ul, ol, dl, dd { margin: 0; }
p { text-wrap: pretty; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--sage);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variation-settings: "wdth" 100;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-out), color 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.btn-solid { background: var(--sage); color: var(--on-sage); }
.btn-solid:hover { background: color-mix(in srgb, var(--sage) 86%, var(--ink)); border-color: color-mix(in srgb, var(--sage) 86%, var(--ink)); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--hair-strong); }
.btn-outline:hover { border-color: var(--ink); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }
.btn:active { transform: translateY(1px); }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}
.nav-inner {
  max-width: calc(var(--page) + var(--gutter) * 2);
  height: var(--nav-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-right: auto;
  text-decoration: none;
}
.monogram {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--sage);
  color: var(--on-sage);
  font-size: 0.875rem;
  font-weight: 700;
  font-variation-settings: "wdth" 88;
  letter-spacing: 0.06em;
  line-height: 1;
}

.nav-links { display: flex; gap: 4px; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--rule);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.18s var(--ease-out);
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="true"] { color: var(--ink); }
.nav-link[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 8px;
  height: 2px;
  background: var(--sage);
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* Theme switch: a pill track with the sun and moon at either end and a
   thumb that slides under whichever theme is on. */
.theme-switch {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.switch-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, var(--paper));
  border: 1px solid var(--hair-strong);
  transition: background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 28%, transparent);
  transition: transform 0.3s var(--ease-out), background-color 0.25s var(--ease-out);
}
.switch-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  color: var(--rule);
  transition: color 0.25s var(--ease-out);
}
.switch-sun { color: var(--sage); }
.theme-switch:hover .switch-track { border-color: var(--ink); }

.theme-switch[aria-checked="true"] .switch-track {
  background: color-mix(in srgb, var(--sage) 22%, var(--paper));
}
.theme-switch[aria-checked="true"] .switch-thumb {
  transform: translateX(32px);
  background: var(--sage);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--paper) 85%, transparent);
}
.theme-switch[aria-checked="true"] .switch-sun { color: var(--rule); }
.theme-switch[aria-checked="true"] .switch-moon { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-thumb, .switch-icon { transition: none; }
}

/* ---------- Hero sheet ---------- */

.hero {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) var(--gutter) clamp(48px, 6vw, 80px);
}

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}

.hero h1 {
  font-size: clamp(3.25rem, 7.4vw, 6rem);
  line-height: 0.92;
  font-weight: 650;
  font-variation-settings: "wdth" 72;
  letter-spacing: -0.02em;
}

/* "Now" marker on the role line: a still sage dot, so it reads as present
   tense without implying live data. */
.role-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 0.7em;
  color: var(--sage);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  vertical-align: 0.25em;
}
.role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 22%, transparent);
}

/* Where Josh is based: sits with the contact actions, well apart from "Now". */
.role-loc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  color: var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
}
.reticle { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--sage); stroke-width: 1.8; }
.reticle .reticle-core { fill: var(--sage); stroke: none; }

.role {
  margin-top: 18px;
  font-size: clamp(1.1875rem, 1.6vw, 1.375rem);
  font-weight: 600;
  line-height: 1.3;
}
.role-sep { color: var(--sage); padding: 0 0.2em; }

.positioning {
  margin-top: 18px;
  max-width: 62ch;
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.6;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.portrait {
  width: clamp(200px, 22vw, 280px);
}
.portrait img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
}

.slug {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: 44px;
  padding-bottom: 20px;
  color: var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ---------- Colour bar (the animated strip) ---------- */

.colour-bar {
  position: relative;
  background: var(--sage);
  color: var(--on-sage);
  overflow: hidden;
}

.bar-mesh {
  position: relative;
  height: 96px;
}
.stripe-mesh {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* A press colour bar: a stepped wedge of the one accent, 100% down to paper. */
.wedge {
  position: absolute;
  left: max(var(--gutter), calc((100% - var(--page)) / 2));
  top: 24px;
  display: flex;
  border: 1px solid color-mix(in srgb, var(--on-sage) 55%, transparent);
}
.wedge span { width: 22px; height: 12px; }
.wedge span:nth-child(1) { background: var(--on-sage); }
.wedge span:nth-child(2) { background: color-mix(in srgb, var(--on-sage) 80%, var(--sage)); }
.wedge span:nth-child(3) { background: color-mix(in srgb, var(--on-sage) 60%, var(--sage)); }
.wedge span:nth-child(4) { background: color-mix(in srgb, var(--on-sage) 40%, var(--sage)); }
.wedge span:nth-child(5) { background: color-mix(in srgb, var(--on-sage) 20%, var(--sage)); }
.wedge span:nth-child(6) { background: var(--sage); }

.proofs {
  position: relative;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 8px var(--gutter) clamp(36px, 5vw, 56px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}
.proof {
  padding: 4px 28px 0;
  border-left: 1px solid color-mix(in srgb, var(--on-sage) 40%, transparent);
}
.proof:first-of-type { padding-left: 0; border-left: 0; }
.proof h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 650;
  font-variation-settings: "wdth" 82;
  line-height: 1.15;
}
.proof p {
  margin-top: 8px;
  max-width: 34ch;
  font-size: 1rem;
  line-height: 1.5;
}

/* ---------- Sections ---------- */

.section {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 104px) var(--gutter) 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 3.2fr);
  gap: 16px clamp(24px, 4vw, 64px);
}
.section-head {
  border-top: 2px solid var(--ink);
  padding-top: 14px;
}
.section-head h2 {
  font-size: clamp(1.5rem, 2.2vw, 1.875rem);
  font-weight: 650;
  font-variation-settings: "wdth" 82;
  line-height: 1.1;
}
.section-meta {
  margin-top: 8px;
  color: var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.section-body {
  border-top: 1px solid var(--hair);
  padding-top: 18px;
}

.prose p { max-width: var(--measure); font-size: 1.125rem; }
.prose p + p { margin-top: 14px; }

/* ---------- Experience ---------- */

.roles { list-style: none; padding: 0; }
.role-entry {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 4px 28px;
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--hair);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.role-entry:first-child { padding-top: 4px; }
.role-entry:last-child { border-bottom: 0; }

.role-dates {
  padding-top: 5px;
  color: var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.role-entry.is-current .role-dates { color: var(--sage); font-weight: 500; }

.role-main h3 {
  font-size: 1.3125rem;
  font-weight: 650;
  font-variation-settings: "wdth" 90;
  line-height: 1.25;
}
.role-entry.is-current .role-main h3 { font-size: 1.625rem; font-variation-settings: "wdth" 84; }
.role-main h3 a { text-decoration: none; }
.role-main h3 a:hover { text-decoration: underline; text-decoration-color: var(--sage); }

.role-org {
  margin-top: 4px;
  color: var(--rule);
  font-size: 1rem;
}
.role-note {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--sage);
  border-radius: 2px;
  color: var(--sage);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: 1px;
}

.role-main ul {
  margin-top: 14px;
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}
.role-main li {
  position: relative;
  padding-left: 20px;
  line-height: 1.55;
}
.role-main li + li { margin-top: 8px; }
.role-main li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 8px;
  height: 1px;
  background: var(--sage);
}

/* ---------- Skills ---------- */

.skills > div {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 4px 28px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.skills > div:first-child { padding-top: 0; }
.skills > div:last-child { border-bottom: 0; }
.skills dt { font-weight: 600; }
.skills dd { max-width: var(--measure); }

/* ---------- Education ---------- */

.education { list-style: none; padding: 0; }
.education li {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr) auto;
  gap: 4px 28px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.education li:first-child { padding-top: 0; }
.edu-year {
  color: var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.edu-degree { font-weight: 600; }
.edu-school { color: var(--rule); text-align: right; }

.footnote {
  margin-top: 22px;
  max-width: var(--measure);
  color: var(--rule);
}

/* ---------- Sign-off ---------- */

.signoff {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 128px) var(--gutter) 0;
}
.signoff-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px 48px;
  align-items: start;
  padding: clamp(28px, 4vw, 48px) 0 0;
  border-top: 2px solid var(--ink);
}

.signoff h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 650;
  font-variation-settings: "wdth" 76;
  line-height: 1;
  letter-spacing: -0.015em;
}
.signoff-copy p { margin-top: 12px; color: var(--rule); max-width: 40ch; }
.signoff-actions .cta-row { margin-top: 0; justify-content: flex-end; }

.email-reveal { margin-top: 18px; text-align: right; }
.email-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 14px;
}
.email-address {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  user-select: all;
  overflow-wrap: anywhere;
}
.email-help { margin-top: 10px; color: var(--rule); font-size: 0.9375rem; }

.signoff .slug { justify-content: space-between; margin-top: 36px; padding-bottom: 36px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .role-sep { display: none; }
  .role-company { display: block; color: var(--rule); font-weight: 500; }
  .role-status { display: flex; width: max-content; margin: 0 0 6px; vertical-align: 0; }
  .section { grid-template-columns: minmax(0, 1fr); }
  .signoff-box { grid-template-columns: minmax(0, 1fr); }
  .signoff-actions .cta-row { justify-content: flex-start; }
  .email-reveal { text-align: left; }
  .email-line { justify-content: flex-start; }
}

@media (max-width: 760px) {
  :root { --nav-h: 56px; }
  .nav-links { display: none; }

  .sheet {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px 20px;
  }
  .hero-copy { display: contents; }
  .hero h1 { grid-column: 1; grid-row: 1; align-self: end; }
  .portrait { grid-column: 2; grid-row: 1; width: 104px; }
  .role, .positioning, .cta-row { grid-column: 1 / -1; }
  .role { margin-top: 4px; }
  .role-loc { flex-basis: 100%; margin: 0; }
  .hero { padding-top: 16px; padding-bottom: 18px; }
  .positioning { margin-top: 0; font-size: 1.0625rem; line-height: 1.5; }
  .cta-row { margin-top: 6px; row-gap: 10px; }

  .bar-mesh { height: 46px; }
  .wedge { top: 14px; }
  .proofs { grid-template-columns: minmax(0, 1fr); padding-top: 2px; padding-bottom: 28px; }
  .proof { padding: 12px 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--on-sage) 40%, transparent); }
  .proof:first-of-type { padding-top: 0; border-top: 0; }
  .proof p { margin-top: 4px; }

  .role-entry, .skills > div, .education li { grid-template-columns: minmax(0, 1fr); }
  .role-dates { padding-top: 0; }
  .edu-school { text-align: left; }
}

@media (max-width: 380px) {
  .nav-actions .btn-small { padding: 0 12px; }
  .portrait { width: 88px; }
}

/* ---------- Print: the proof, on paper ---------- */

@media print {
  :root, :root[data-theme="dark"] {
    --paper: #fff; --ink: #000; --rule: #444; --sage: #3d5540; --on-sage: #fff;
    --hair: #ccc; --hair-strong: #999;
  }
  body { font-size: 10.5pt; }
  .nav, .skip-link, .bar-mesh, .cta-row, .email-reveal, .theme-switch { display: none !important; }
  .hero { padding-top: 0; }
  .colour-bar { background: none; color: #000; border-top: 1px solid #000; border-bottom: 1px solid #000; }
  .proofs { padding: 12px 0; }
  .proof { border-color: #999; }
  .section { padding-top: 22px; break-inside: avoid-page; }
  .role-entry { break-inside: avoid; }
  .signoff { padding-top: 24px; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}
