/* Self-hosted fonts (latin subset) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/inter.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: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif.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: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-italic.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 {
  --bg: #0a0a0a;
  --text: #b5b5b5;
  --muted: #9d9d9d;
  --heading: #ededed;
  --accent: #d6c3a1;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Faint warm glow in the top corner */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60rem 40rem at 0% 0%, rgba(214, 195, 161, 0.05), transparent 70%);
}

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

h1, h2, h3 { color: var(--heading); margin: 0; font-weight: 400; line-height: 1.15; }
p { margin: 0 0 1.25rem; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* Layout */
.layout {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.sidebar { margin-bottom: 5rem; }

.avatar {
  display: block;
  width: 72px;
  height: 72px;
  margin-bottom: 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}

.name {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 9vw, 4.75rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.title {
  margin: 1.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.tagline { max-width: 23rem; margin-top: 1.25rem; }

.nav { display: none; }

.social { display: flex; gap: 0.5rem; margin: 2.25rem 0 0 -0.75rem; }
/* 44px tap targets */
.social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--muted); transition: color 0.3s var(--ease); }
.social a:hover { color: var(--heading); }

/* Sections */
.section { margin-bottom: 7rem; scroll-margin-top: 3rem; }

.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--heading);
}
.section-heading .num { color: var(--accent); }
.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.lead {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.6vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin-bottom: 2rem;
}
.lead em { color: var(--accent); }

.link {
  color: var(--heading);
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.link:hover { color: var(--accent); border-color: var(--accent); }

.sub-heading {
  margin: 3.5rem 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* Highlights */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  border-top: 1px solid var(--line);
}
.highlights li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem 1.25rem 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.stat {
  font-family: var(--serif);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--heading);
}
.stat-label { font-size: 0.95rem; line-height: 1.5; }

/* Skills */
.skills { margin: 0; border-top: 1px solid var(--line); }
.skills div {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.skills dt { color: var(--heading); font-weight: 500; }
.skills dd { margin: 0; }

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

.card {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.4s var(--ease);
}

@media (hover: hover) {
  .projects:hover .card:not(:hover) { opacity: 0.55; }
}

.card-index {
  padding-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.card-title { font-family: var(--serif); font-size: 1.65rem; letter-spacing: -0.01em; }
.card-title a { display: inline-flex; align-items: baseline; gap: 0.5rem; transition: color 0.3s var(--ease); }
/* Make the whole row clickable via the title link */
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-title a:focus-visible { outline: none; }
.card-title a:focus-visible::after { outline: 1px solid var(--accent); outline-offset: -1px; }
.card:hover .card-title a,
.card-title a:focus-visible { color: var(--accent); }

.card-title svg { width: 0.75rem; height: 0.75rem; transition: transform 0.4s var(--ease); flex-shrink: 0; }
.card:hover .card-title svg { transform: translate(3px, -3px); }

.card-desc { margin: 0.4rem 0 0.9rem; max-width: 34rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  /* Shifted left so a separator that starts a wrapped line is clipped by .card-body */
  margin-left: -1.4rem;
}

.card-body { min-width: 0; overflow: hidden; }

/* Secondary link sits above the card's full-row overlay link */
.card-ext {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}
.card-ext:hover { color: var(--accent); }
.card-ext svg { width: 0.7rem; height: 0.7rem; }
.tag::before {
  content: "/";
  display: inline-block;
  width: 1.4rem;
  text-align: center;
  color: var(--line-strong);
}

/* Contact */
.email {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  color: var(--heading);
  border-bottom: 1px solid var(--line-strong);
  overflow-wrap: anywhere;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.email:hover { color: var(--accent); border-color: var(--accent); }

.contact-list { margin-top: 2rem; }
.label {
  display: inline-block;
  min-width: 5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.footer p { margin: 0; }

/* Desktop: fixed left column */
@media (min-width: 1024px) {
  .layout {
    display: flex;
    justify-content: space-between;
    gap: 5rem;
    padding: 0 3rem;
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 42%;
    max-height: 100vh;
    padding: 7rem 0 5rem;
    margin: 0;
  }

  .nav { display: block; margin-top: 4.5rem; }
  .nav a {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0;
    font-family: var(--mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
    transition: color 0.3s var(--ease);
  }
  .nav a::before {
    content: "";
    width: 1.75rem;
    height: 1px;
    background: currentColor;
    transition: width 0.4s var(--ease), background-color 0.3s var(--ease);
  }
  .nav a:hover,
  .nav a.active { color: var(--heading); }
  .nav a:hover::before,
  .nav a.active::before { width: 3.5rem; background: var(--accent); }

  .content { width: 58%; padding: 7rem 0 0; }
  .section { margin-bottom: 9rem; scroll-margin-top: 7rem; }
}
