/* ==========================================================================
   Resume page: the header, the tool grid, the contribution calendar and the
   résumé itself. Self-contained — nothing here restyles the main page.
   ========================================================================== */

/* The tab you are on, said quietly. */
.nav a[aria-current='page'] {
  color: var(--white);
}

/* ---------- Page header ---------- */
.doc-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(8rem, 14vw, 12rem) clamp(3rem, 6vw, 5rem);
}
/* The drifting line field. It sits under everything, fades out before it
   reaches the text, and is absent entirely without JS. */
.doc-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.95;
  mask-image:
    radial-gradient(130% 105% at 72% 36%, #000 30%, rgba(0, 0, 0, 0.55) 66%, transparent 92%),
    linear-gradient(#000 70%, transparent 99%);
  -webkit-mask-image:
    radial-gradient(130% 105% at 72% 36%, #000 30%, rgba(0, 0, 0, 0.55) 66%, transparent 92%),
    linear-gradient(#000 70%, transparent 99%);
  mask-composite: intersect;
  -webkit-mask-composite: source-in;
  animation: field-in 1.6s var(--ease-soft) both;
}
@keyframes field-in {
  from {
    opacity: 0;
  }
}
/* A quiet pool behind the name, so the lines never fight the type. */
.doc-head-in {
  position: relative;
}
.doc-head-in::before {
  content: '';
  position: absolute;
  inset: -12% -8% -20% -14%;
  z-index: -1;
  background:
    radial-gradient(62% 68% at 34% 46%, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.6) 45%, transparent 76%),
    radial-gradient(34% 46% at 82% 52%, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 82%);
  pointer-events: none;
}
.doc-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(2rem, 5vw, 4rem);
}
.doc-intro {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}
/* The one photograph on the site that keeps its colour. */
.doc-photo {
  flex: none;
  width: clamp(104px, 13vw, 168px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe4ea;
  box-shadow:
    0 0 0 1px #2c2c2a,
    0 24px 50px -24px rgba(0, 0, 0, 0.9);
}
.doc-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The crop keeps a ring of the photo's own backdrop; nudging it in hides it. */
  transform: scale(1.06);
}
.doc-head h1 {
  margin-top: 1rem;
  padding-block: 0.08em;
  font-weight: 600;
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}
.doc-role {
  margin-top: 1.1rem;
  max-width: 34ch;
  color: var(--soft);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.5;
}
.doc-facts {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-facts li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--edge);
}
.doc-facts li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: clamp(2rem, 4vw, 3rem);
}

/* ---------- Tools ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.tool-card {
  padding: clamp(1.25rem, 2.4vw, 1.9rem);
  border: 1px solid #262624;
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.tool-card header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.tool-card h3 {
  font-weight: 600;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  letter-spacing: -0.02em;
}
.tool-card > p {
  max-width: 46ch;
  color: var(--grey);
  font-size: 0.9rem;
  line-height: 1.6;
}
.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}
.tool-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #303030;
  border-radius: 14px;
  background: #0f0f0f;
  color: var(--soft);
  font-size: 0.85rem;
  line-height: 1.2;
  transition:
    border-color 0.25s var(--ease),
    color 0.25s var(--ease);
}
/* Each chip carries its brand's colour in --brand; the mark wears it. */
.tool-list svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: currentColor;
  color: var(--brand, var(--grey));
  opacity: 0.92;
  transition: opacity 0.25s var(--ease);
}
/* The hand-drawn icons are strokes, not filled marks. */
.tool-list svg.stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .tool-list li:hover {
    border-color: color-mix(in srgb, var(--brand, #4d4d49) 55%, #2a2a28);
    color: var(--white);
  }
  .tool-list li:hover svg {
    opacity: 1;
  }
}
.tool-note {
  margin-top: 1.25rem;
  color: var(--grey);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ---------- GitHub contributions ---------- */
.gh {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid #262624;
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.gh-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.gh-stats div {
  padding-top: 0.9rem;
  border-top: 1px solid var(--edge);
}
.gh-stats dt {
  margin-bottom: 0.35rem;
  color: var(--grey);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.gh-stats dd {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
}
.gh-scroll {
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.gh-cal {
  display: grid;
  gap: 0.4rem;
  min-width: 46rem;
}
.gh-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}
.gh-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
}
.gh-week {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
}
.gh-day {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #161616;
  box-shadow: inset 0 0 0 1px #1f1f1f;
}
.gh-day[data-level='1'] {
  background: #39393a;
}
.gh-day[data-level='2'] {
  background: #6a6a68;
}
.gh-day[data-level='3'] {
  background: #a8a8a4;
}
.gh-day[data-level='4'] {
  background: var(--white);
}
.gh-empty {
  background: transparent;
  box-shadow: none;
}
.gh-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  color: var(--grey);
  font-size: 0.85rem;
}
.gh-key {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.gh-key i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: #161616;
  box-shadow: inset 0 0 0 1px #1f1f1f;
}
.gh-key i[data-level='1'] {
  background: #39393a;
}
.gh-key i[data-level='2'] {
  background: #6a6a68;
}
.gh-key i[data-level='3'] {
  background: #a8a8a4;
}
.gh-key i[data-level='4'] {
  background: var(--white);
}
.gh-repos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.gh-repo {
  display: block;
  padding: 1.1rem 1.25rem;
  border: 1px solid #262624;
  border-radius: 18px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.gh-repo:hover {
  border-color: #4d4d49;
  transform: translateY(-2px);
}
.gh-repo strong {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.gh-repo span {
  color: var(--grey);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- The résumé itself ---------- */
.cv {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
.cv-block {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.4rem, 2.8vw, 2.2rem);
  border: 1px solid #262624;
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.cv-block > h3 {
  align-self: start;
  color: var(--grey);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cv-body > p {
  max-width: 68ch;
  color: var(--soft);
  line-height: 1.65;
}
.cv-body > p + p {
  margin-top: 0.9rem;
}

.cv-skills {
  display: grid;
  gap: 1rem;
  margin: 0;
}
.cv-skills div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--edge);
}
.cv-skills div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.cv-skills dt {
  font-weight: 600;
}
.cv-skills dd {
  margin: 0;
  color: var(--grey);
  line-height: 1.6;
}

.cv-role + .cv-role {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--edge);
}
.cv-role-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
}
.cv-role-top h4 {
  font-weight: 600;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  letter-spacing: -0.02em;
}
.cv-role-top h4 span {
  color: var(--grey);
  font-weight: 400;
}
.cv-when {
  color: var(--grey);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.cv-sub {
  margin-top: 1.1rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cv-points {
  display: grid;
  gap: 0.6rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}
.cv-points li {
  position: relative;
  padding-left: 1.1rem;
  max-width: 72ch;
  color: var(--grey);
  line-height: 1.6;
}
.cv-points li::before {
  content: '';
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dim);
}

.cv-school {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-bottom: 1rem;
}
.cv-school + .cv-school {
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}
.cv-school:last-child {
  padding-bottom: 0;
}
.cv-school strong {
  font-weight: 600;
}
.cv-school strong span {
  color: var(--grey);
  font-weight: 400;
}

/* ---------- Down-scaling ---------- */
@media (max-width: 1080px) {
  .gh-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .doc-head-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .cv-block {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .cv-skills div {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

@media (max-width: 560px) {
  /* On a phone the photo sits above the name rather than squeezing it. */
  .doc-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
}

@media (max-width: 520px) {
  .doc-facts li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .tool-list {
    grid-template-columns: 1fr 1fr;
  }
}
