/* Self-hosted fonts: Unbounded (headings) and Hanken Grotesk (body). Both are open source (SIL OFL). */
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 300; font-display: swap; src: url("assets/fonts/unbounded-latin-ext-300-normal.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: "Unbounded"; font-style: normal; font-weight: 300; font-display: swap; src: url("assets/fonts/unbounded-latin-300-normal.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: "Unbounded"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/unbounded-latin-ext-400-normal.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: "Unbounded"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/unbounded-latin-400-normal.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: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/hanken-grotesk-latin-ext-400-normal.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: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/hanken-grotesk-latin-400-normal.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: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/hanken-grotesk-latin-ext-500-normal.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: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/hanken-grotesk-latin-500-normal.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; }

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #595959;
  --line: #d9d9d9;
  --accent: #7a1024;        /* bordo, used as text/lines */
  --accent-fill: #7a1024;   /* bordo, used as a filled surface */
  --on-accent: #ffffff;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --fg: #f2f2f2;
  --muted: #a6a6a6;
  --line: #2a2a2a;
  --accent: #e0506a;
  --accent-fill: #8f1631;
  color-scheme: dark;
}

/* If JavaScript is off, still follow the visitor's system setting */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000;
    --fg: #f2f2f2;
    --muted: #a6a6a6;
    --line: #2a2a2a;
    --accent: #e0506a;
    --accent-fill: #8f1631;
    color-scheme: dark;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

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

a { color: inherit; }

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

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

.wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--accent-fill);
  color: var(--on-accent);
  padding: 0.6rem 1rem;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
  transition: color 0.25s ease;
}
.wordmark:hover { color: var(--accent); }

.nav { display: flex; gap: 1.75rem; }

.nav a {
  position: relative;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding-block: 0.25rem;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav a:hover::after,
.nav a:focus-visible::after { transform: scaleX(1); }
.nav a:hover { color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.4s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(20deg); }
.theme-toggle svg { grid-area: 1 / 1; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

@media (max-width: 45rem) {
  .nav { gap: 1.25rem; }
  .nav a:not(.keep) { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  gap: 3rem;
  align-items: center;
  padding-block: clamp(2rem, 6vw, 4rem) clamp(4rem, 8vw, 6rem);
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: 1.3fr 1fr;
    min-height: calc(100svh - 4.25rem);
    gap: 4rem;
  }
}

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 12.5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
@media (min-width: 60rem) {
  .name { font-size: clamp(3.4rem, 6.6vw, 6.25rem); }
}

.name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.name .line > span {
  display: block;
  transform: translateY(110%);
  animation: rise 1s var(--ease) forwards;
}
.name .line:nth-child(2) > span { animation-delay: 0.12s; }

@keyframes rise { to { transform: translateY(0); } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

.role {
  margin: 2rem 0 0;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 500;
  color: var(--accent);
}

.lede {
  margin: 1rem 0 0;
  max-width: 30ch;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.hero-text > :not(.name),
.portrait {
  opacity: 0;
  animation: appear 0.9s ease 0.55s forwards;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--accent-fill);
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s var(--ease);
}
.btn:hover { transform: translateY(-2px); }

.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: transparent; color: var(--accent); border-color: var(--accent); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Portrait */
.portrait {
  margin: 0;
  width: 100%;
  max-width: 25rem;
  padding: 0 18px 18px 0;
  justify-self: center;
}
@media (min-width: 60rem) {
  .portrait { justify-self: end; }
}

.portrait-tilt {
  position: relative;
  aspect-ratio: 4 / 5;
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.3s ease-out;
}
.portrait-tilt::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  transform: translate(18px, 18px);
  transition: transform 0.5s var(--ease);
}
.portrait:hover .portrait-tilt::before { transform: translate(8px, 8px); }

.portrait-tilt img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  outline: 1px solid var(--line);
  outline-offset: -1px;
}
:root[data-theme="dark"] .portrait-tilt img { filter: brightness(0.9) contrast(1.05); }

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--line); }

.section-grid {
  display: grid;
  gap: 2rem;
  padding-block: clamp(3.5rem, 8vw, 7rem);
}
@media (min-width: 60rem) {
  .section-grid { grid-template-columns: 1fr 2.2fr; gap: 4rem; }
  .section-grid > h2 { position: sticky; top: 6.5rem; align-self: start; }
}

h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h3 { margin: 0; font-weight: 500; }

.section-body p { max-width: 62ch; margin: 0 0 1.25rem; }

.intro { font-size: 1.25rem; line-height: 1.5; }

.lead-in { color: var(--muted); }

.footnote { color: var(--muted); font-size: 0.95rem; margin-top: 2rem; }

/* Pull quote */
.pull {
  margin: 3rem 0 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--accent);
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.15rem, 2.3vw, 1.6rem);
  line-height: 1.45;
  letter-spacing: -0.015em;
  max-width: 34ch;
}

/* ---------- Tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
}
@media (max-width: 62rem) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 34rem) { .tiles { grid-template-columns: 1fr; } }

.tile {
  position: relative;
  min-height: 13rem;
  padding: 1.5rem;
  background: var(--bg);
  cursor: default;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.tile h3 {
  padding-right: 1.75rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 0.92rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.tile p {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  margin: 0;
  max-width: none;
  font-size: 0.93rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.45s var(--ease);
}

/* plus sign that turns into a cross on hover */
.tile::after {
  content: "";
  position: absolute;
  top: 1.65rem;
  right: 1.5rem;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
  transition: transform 0.45s var(--ease);
}

.tile:hover,
.tile:focus-visible {
  background: var(--accent-fill);
  color: var(--on-accent);
}
.tile:hover p,
.tile:focus-visible p { opacity: 1; transform: none; }
.tile:hover::after,
.tile:focus-visible::after { transform: rotate(45deg); }
.tile:focus-visible { outline-offset: -3px; }

/* Touch screens have no hover, so always show the description */
@media (hover: none), (max-width: 45rem) {
  .tile { min-height: 0; }
  .tile p {
    position: static;
    opacity: 1;
    transform: none;
    margin-top: 0.75rem;
    color: var(--muted);
  }
  .tile:hover p, .tile:focus-visible p { color: inherit; }
  .tile::after { display: none; }
}

/* ---------- Experience & education rows ---------- */
.rows { margin: 0; padding: 0; list-style: none; }

.row {
  position: relative;
  display: grid;
  gap: 0.5rem 2rem;
  padding-block: 2rem;
  border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 48rem) {
  .row { grid-template-columns: 11rem 1fr; }
}

/* a bordo line draws across the top border on hover */
.row::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.row:hover::before { transform: scaleX(1); }

.row-when { display: flex; flex-direction: column; color: var(--muted); font-size: 0.95rem; }
.row-when time { color: var(--fg); font-weight: 500; }

.row-main { transition: transform 0.5s var(--ease); }
@media (hover: hover) {
  .row:hover .row-main { transform: translateX(10px); }
}

.row-main h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  transition: color 0.3s ease;
}
.row:hover .row-main h3 { color: var(--accent); }

.row-role { margin: 0.35rem 0 0.75rem !important; font-weight: 500; }
.row-tools { color: var(--muted); font-size: 0.95rem; margin-bottom: 0 !important; }

/* ---------- Writing / posts ---------- */
.posts {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
@media (min-width: 48rem) { .posts { grid-template-columns: repeat(2, 1fr); } }
.posts[hidden] { display: none; }
.posts iframe {
  width: 100%;
  height: 34rem;
  border: 1px solid var(--line);
  background: #fff;
}

/* ---------- Contact ---------- */
.email {
  display: inline-block;
  margin: 0.5rem 0 1.75rem;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.05rem, 4.6vw, 2.4rem);
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 1px no-repeat;
  padding-bottom: 0.25rem;
  transition: color 0.3s ease, background-size 0.5s var(--ease);
}
.email:hover { color: var(--accent); background-size: 100% 3px; }

.contact-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.link-btn {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease;
}
.link-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-inner p { margin: 0; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .name .line > span { transform: none; }
  .hero-text > :not(.name), .portrait { opacity: 1; }
}
