/* ---------- Font: Lato, served from this site ---------- */
@font-face {
  font-family: "Lato";
  src: url("../fonts/lato-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("../fonts/lato-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("../fonts/lato-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Colors ---------- */
:root {
  color-scheme: light dark;

  /* light: warm paper */
  --bg: #f7f5f0;
  --text: #55514a;
  --strong: #1f1d1a;
  --muted: #6e6a61;
  --line: rgba(31, 29, 26, 0.12);
  --card-hover-bg: rgba(31, 29, 26, 0.04);
  --glow: rgba(255, 255, 255, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* dark: warm off-black */
    --bg: #1c1b19;
    --text: #aba699;
    --strong: #efece4;
    --muted: #908b80;
    --line: rgba(239, 236, 228, 0.12);
    --card-hover-bg: rgba(239, 236, 228, 0.045);
    --glow: rgba(255, 222, 173, 0.045);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Lato", system-ui, sans-serif;
  font-size: 1.0625rem; /* 17px at the default browser setting */
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Light that follows the cursor (positioned by js/site.js) */
.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    375px circle at var(--x, 50%) var(--y, 50%),
    var(--glow),
    transparent 75%
  );
}
.glow.on {
  opacity: 1;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 24px;
  /* The fade-in lives here, not on <body>: an animated transform on an
     ancestor of .glow would make its fixed position scroll with the page. */
  animation: fade-in 0.9s ease both;
}

/* ---------- Text ---------- */
h1,
h2,
h3 {
  margin: 0;
  font-size: inherit; /* headings stand out by weight and color, not size */
  font-weight: 700;
  color: var(--strong);
}

p {
  margin: 0 0 1.2em;
}

a {
  color: var(--strong);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover {
  text-decoration-color: currentColor;
}

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

/* Read by screen readers, not shown on screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 72px;
}

.site-name {
  font-weight: 700;
  color: var(--strong);
  text-decoration: none;
}
/* away from the home page the name is a way back, so it reads as a link */
.site-name:not([aria-current="page"]) {
  color: var(--muted);
}
.site-name:not([aria-current="page"]):hover {
  color: var(--strong);
}

.site-nav {
  display: flex;
  gap: 24px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--strong);
}

/* ---------- Sections ---------- */
section {
  margin-bottom: 64px;
}

section > h2 {
  margin-bottom: 16px;
}

.role,
.meta {
  color: var(--muted);
}

/* keep the gap between sections even, whatever a section ends with */
section > :last-child {
  margin-bottom: 0;
}

/* ---------- Social logo links ---------- */
.social {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.social a {
  display: block;
  /* bigger tap area without moving the icons */
  padding: 6px;
  margin: -6px;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) {
  .social a:hover {
    color: var(--strong);
    transform: translateY(-2px);
  }
}
.social svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ---------- Experience cards ---------- */
.cards {
  list-style: none;
  margin: 0 -16px;
  padding: 0;
}

.card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 16px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.card-date {
  color: var(--muted);
  font-size: 0.88em;
  padding-top: 0.15em;
}

.card-body > span {
  display: block;
}

.card-title {
  font-weight: 700;
  color: var(--strong);
}

.card-arrow {
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-left: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.card-sub {
  color: var(--muted);
}

.card-text {
  margin-top: 8px;
}

@media (hover: hover) {
  .card:hover {
    background: var(--card-hover-bg);
    border-color: var(--line);
  }
  .card:hover .card-arrow {
    color: var(--strong);
    transform: translate(2px, -2px);
  }
  /* dim the cards that are not being pointed at */
  .cards:has(.card:hover) .card:not(:hover):not(:focus-visible) {
    opacity: 0.5;
  }
}

.card:focus-visible {
  background: var(--card-hover-bg);
  border-color: var(--line);
}

/* ---------- Rows (writing list) ---------- */
.rows {
  list-style: none;
  margin: 0 -16px;
  padding: 0;
}

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.row-meta {
  color: var(--muted);
  font-size: 0.88em;
  white-space: nowrap;
}

@media (hover: hover) {
  .row:hover {
    background: var(--card-hover-bg);
    border-color: var(--line);
  }
  .rows:has(.row:hover) .row:not(:hover):not(:focus-visible) {
    opacity: 0.5;
  }
}

.row:focus-visible {
  background: var(--card-hover-bg);
  border-color: var(--line);
}

/* ---------- Project and writing pages ---------- */
article {
  margin-bottom: 64px;
}

article > :last-child {
  margin-bottom: 0;
}

article h2 {
  margin: 2em 0 0.6em;
}

.back {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--muted);
  text-decoration: none;
}
.back:hover {
  color: var(--strong);
}

main ul:not([class]) {
  margin: 0 0 1.2em;
  padding-left: 1.2em;
}

/* ---------- Contact form ---------- */
.contact-form {
  margin-top: 32px;
}

.field {
  margin-bottom: 24px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--strong);
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--strong);
  background: var(--card-hover-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}
.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.field input:focus {
  outline: none;
  border-color: var(--strong);
}

.form-closed {
  margin-top: 32px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-hover-bg);
  color: var(--strong);
}

.hint {
  margin: 6px 0 0;
  font-size: 0.88em;
  color: var(--muted);
}

/* bot trap: off-screen rather than display:none, so naive bots still fill it */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.button {
  padding: 10px 22px;
  font: inherit;
  font-weight: 700;
  color: var(--bg);
  background: var(--strong);
  border: 1px solid var(--strong);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
@media (hover: hover) {
  .button:hover {
    opacity: 0.85;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- Small screens / reduced motion ---------- */
@media (max-width: 480px) {
  .page {
    padding: 56px 20px 72px;
  }
  .site-header {
    margin-bottom: 48px;
  }
  .card {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }
  .glow {
    display: none;
  }
  * {
    transition: none !important;
  }
}
