/* ---------- tokens ---------- */
:root {
  --bg: #fdfdfc;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --rule: #e6e6e3;
  --link: #1a1a1a;
  --accent: #2f5cff;
  --max: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 20px 64px;
  /* keep the footer pinned to the bottom on short pages */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.wrap > main { flex: 1 0 auto; }

h1, h2, h3 { line-height: 1.25; font-weight: 600; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

ul { padding-left: 1.2rem; margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* ---------- nav ---------- */
.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 3rem;
}
.nav .brand { font-weight: 600; text-decoration: none; }
.nav .brand:hover { color: var(--accent); }
.nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; }
.nav li { margin: 0; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }

/* ---------- lists of items (posts, projects) ---------- */
.items { list-style: none; padding: 0; margin: 0; }
.items li {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.items li:last-child { border-bottom: 1px solid var(--rule); }
.items .title { font-weight: 600; text-decoration: none; }
.items .title:hover { color: var(--accent); }
.items .meta { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.items .desc { margin: 4px 0 0; color: var(--text); }

.row { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; }

/* ---------- resume ---------- */
.entry { display: grid; grid-template-columns: 110px 1fr; gap: 16px; margin-bottom: 1.25rem; }
.entry .when { color: var(--muted); font-size: 0.9rem; padding-top: 3px; }
.entry .what strong { font-weight: 600; }
.entry ul { margin-top: 0.4rem; margin-bottom: 0; }
@media (max-width: 480px) {
  .entry { grid-template-columns: 1fr; gap: 2px; }
}

.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 0; list-style: none; }
.tags li { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  flex-wrap: wrap;
}
#last-updated { font-size: 0.8rem; color: var(--faint); }
.footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.easter-note { font-size: 0.8rem; font-style: italic; color: var(--faint); }
#last-updated a { color: inherit; }
/* ---------- contact links under the intro ---------- */
.contacts { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.9rem; }
.contacts li { margin: 0; }
.contacts a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.contacts a:hover { color: var(--accent); }
.contacts svg { width: 18px; height: 18px; flex: none; }

.links { display: flex; gap: 16px; flex-wrap: wrap; }
footer .links a { color: var(--muted); }
footer .links a:hover { color: var(--accent); }

/* ---------- intro word effects ---------- */
.fx-invisible,
.fx-micro,
.fx-macro {
  cursor: default;
  line-height: 0;
  transition: color 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), font-size 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* the .is-on state is set by word-fx.js when the pointer is near the word */

/* nearly the background color until hovered */
.fx-invisible { color: #d6d6d2; }
.fx-invisible.is-on { color: var(--text); }

/* small until hovered */
.fx-micro { font-size: 0.72em; }
.fx-micro.is-on { font-size: 1em; }

/* slightly large until hovered */
.fx-macro { font-size: 1.2em; }
.fx-macro.is-on { font-size: 1em; }

/* electrons orbiting "atoms" */
.fx-atom { position: relative; display: inline-block; }
.fx-atom svg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3.6em;
  height: 1.45em;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}
.fx-atom ellipse { fill: none; stroke: #8a8a8a; stroke-width: 0.4; opacity: 0.7; }
.fx-atom circle { fill: #0d1a40; }
@media (prefers-reduced-motion: reduce) {
  .fx-atom circle { display: none; }
}

/* electrons flowing along a wire and turning into bits under
   "electrons to bits" (drawn by word-fx.js); inline-block keeps the
   phrase on one line so the wire never breaks */
.fx-flow { position: relative; display: inline-block; }
.fx-flow canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.fx-bits { display: inline-block; }

/* "bytes" shows its ASCII codes in hex while hovered (word-fx.js swaps the
   text and eases the width) */
.fx-bytes {
  display: inline-block;
  cursor: default;
  white-space: nowrap;
  transition: width 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.fx-bytes > span { transition: opacity 0.11s ease; }
.fx-bytes.is-hex { font-family: var(--mono); font-size: 0.85em; }

/* interests: light underline, text nudged slightly toward navy */
.topic {
  color: #1f2638;
  text-decoration: underline;
  text-decoration-color: #d4d4cf;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ---------- "recent projects" link to the portfolio ---------- */
/* heading + squiggly arrow + handwritten note; the whole area links to the
   portfolio and turns shiny metal while hovered */
.cta {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: fit-content;
  margin: 3.5rem 0 0.75rem;
  color: var(--text);
  text-decoration: none;
}
/* invisible padding so hovering near the area counts too */
.cta::before { content: ""; position: absolute; inset: -18px -18px -12px -18px; }
.cta:hover { color: var(--text); }
.cta h2 { margin: 0; }

.cta-arrow {
  flex: none;
  width: 44px;
  height: 30px;
  margin-bottom: 0.45em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 30' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 27c4 2 8-3 5-7s3-9 10-8c8 1 14-1 22-7'/%3E%3Cpath d='M32 3.5l7.5 1.5-3.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 30' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 27c4 2 8-3 5-7s3-9 10-8c8 1 14-1 22-7'/%3E%3Cpath d='M32 3.5l7.5 1.5-3.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.cta-note {
  width: 4.9em;
  margin: -2.9rem 0 0.6em;
  font-family: "Caveat", cursive;
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1;
  transform: rotate(-8deg);
  transform-origin: left bottom;
}

/* the metal: one light band sweeping across all three pieces at once
   (fixed attachment lines the gradient up across them). Only on devices
   that can really hover, so a tap on a phone just follows the link. */
@media (hover: hover) {
  .cta:hover .metal,
  .cta:focus-visible .metal {
    background-image: linear-gradient(105deg,
      #1c1f24 0%, #474d55 14%, #9ca3ac 24%, #f5f7f9 28%, #9ca3ac 32%,
      #3a3f46 44%, #1c1f24 52%, #555b63 66%, #c4cad1 74%, #ffffff 76%,
      #8a9099 80%, #2a2e34 92%, #1c1f24 100%);
    background-size: 480px 480px;
    background-attachment: fixed;
    animation: cta-sheen 0.9s linear infinite;
  }
  .cta:hover h2.metal, .cta:hover .cta-note,
  .cta:focus-visible h2.metal, .cta:focus-visible .cta-note {
    color: transparent;
    -webkit-background-clip: text;
            background-clip: text;
  }
  .cta:hover .metal { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7)); }
}
@keyframes cta-sheen { to { background-position: 480px 0; } }
@media (prefers-reduced-motion: reduce) {
  .cta .metal { animation: none !important; }
}
@media (max-width: 420px) {
  .cta-arrow { width: 30px; }
}

/* music notes drifting off "harp" (spawned by word-fx.js) */
.fx-harp { position: relative; cursor: default; }
.harp-note {
  position: absolute;
  bottom: 0.9em;
  font-size: 0.95em;
  line-height: 1;
  color: #0d1a40;
  pointer-events: none;
  opacity: 0;
}

/* no grey tap flash on iOS when toggling the effect words */
.fx-invisible, .fx-micro, .fx-macro, .fx-bytes, .fx-harp, .cta { -webkit-tap-highlight-color: transparent; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .wrap { padding: 28px 16px 24px; }

  /* project rows: always put the date under the title instead of letting
     it wrap onto its own line only when the title happens to be long */
  .items .row { flex-direction: column; gap: 0; }
  .items .meta { margin-top: 0; }

  /* footer: stack links and meta, both left-aligned */
  footer { margin-top: 2.5rem; padding-top: 1.25rem; flex-direction: column; align-items: flex-start; }
  .footer-meta { align-items: flex-start; text-align: left; }
}
