@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #fbfaf9;
  --text: #121212;
  --soft: #3f3f3e;
  --muted: #6e6e6d;
  --accent: #ff3e00;
  --line: rgba(18, 18, 18, 0.1);
  --row-hover: rgba(255, 62, 0, 0.04);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "EB Garamond", ui-serif, Georgia, serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --preview-shadow: 0 18px 48px -28px rgba(18, 18, 18, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111111;
    --text: #f5f5f5;
    --soft: #c9c9c8;
    --muted: #a3a3a3;
    --line: rgba(245, 245, 245, 0.14);
    --row-hover: rgba(255, 62, 0, 0.1);
    --preview-shadow: 0 22px 56px -24px rgba(0, 0, 0, 0.85);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaf9;
  --text: #121212;
  --soft: #3f3f3e;
  --muted: #6e6e6d;
  --line: rgba(18, 18, 18, 0.1);
  --row-hover: rgba(255, 62, 0, 0.04);
  --preview-shadow: 0 18px 48px -28px rgba(18, 18, 18, 0.45);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --text: #f5f5f5;
  --soft: #c9c9c8;
  --muted: #a3a3a3;
  --line: rgba(245, 245, 245, 0.14);
  --row-hover: rgba(255, 62, 0, 0.1);
  --preview-shadow: 0 22px 56px -24px rgba(0, 0, 0, 0.85);
}

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

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

body,
h1,
h2,
p,
ul,
li {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background-color 160ms var(--ease),
    color 160ms var(--ease);
}

::selection {
  background: rgba(255, 62, 0, 0.18);
}

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

.theme-toggle {
  position: fixed;
  z-index: 1;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  display: none;
  min-width: 3.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease),
    border-color 160ms var(--ease),
    color 160ms var(--ease);
}

.theme-control-ready .theme-toggle {
  display: block;
}

.site-shell {
  width: min(calc(100% - 3rem), 36rem);
  margin-inline: auto;
  padding-block: 5rem 10rem;
}

.profile-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  animation: avatar-in 420ms var(--ease) both;
}

.name {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.375;
}

.role {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.375;
}

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

.bio {
  margin-top: 0;
}

.bio p + p {
  margin-top: 1rem;
}

.bio em {
  font-family: var(--serif);
  font-size: 1.08em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.contact-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.text-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 160ms var(--ease);
}

.inline-logo {
  display: inline;
  width: 1em;
  height: 1em;
  margin-inline-start: 1px;
  margin-inline-end: 0.25em;
  vertical-align: -0.15em;
  border-radius: 2px;
}

.link-preview {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  width: min(18rem, calc(100vw - 1.5rem));
  pointer-events: none;
  visibility: hidden;
  transform: translate3d(var(--preview-x, 0px), var(--preview-y, 0px), 0);
  will-change: transform;
}

.link-preview.is-open {
  visibility: visible;
}

.link-preview-anim {
  transform-origin: var(--preview-origin, 50% 0%);
  opacity: 0;
  transform: scale(0.95) translateY(var(--preview-nudge, -0.75rem));
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
  will-change: transform, opacity;
}

.link-preview.is-open .link-preview-anim {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.link-preview-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
  box-shadow: var(--preview-shadow);
  color: var(--text);
}

.link-preview-media {
  position: relative;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: var(--line);
}

.link-preview-media[hidden] {
  display: none;
}

.link-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition:
    opacity 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}

.link-preview-image.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.link-preview-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem 1rem;
}

.link-preview-host {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.link-preview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-description:empty {
  display: none;
}

.projects {
  margin-top: 3.5rem;
}

.projects-title {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.375;
}

.project-list {
  margin-inline: -0.75rem;
}

.project-link {
  display: block;
  padding: 1rem 0.75rem;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms var(--ease);
}

.project-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 160ms var(--ease);
}

.project-summary {
  display: block;
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.875rem;
}

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

.identity,
.bio,
.contact-links,
.projects {
  animation: content-in 520ms var(--ease) both;
}

.identity {
  animation-delay: 60ms;
}

.bio {
  animation-delay: 120ms;
}

.contact-links {
  animation-delay: 180ms;
}

.projects {
  animation-delay: 240ms;
}

@keyframes avatar-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 40rem) {
  .site-shell {
    padding-top: 4rem;
  }

  .projects {
    margin-top: 5rem;
  }
}

@media (hover: hover) {
  .project-link:hover {
    background: var(--row-hover);
  }

  .theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .link-preview {
    transform: translate3d(var(--preview-x, 0px), var(--preview-y, 0px), 0);
  }

  .link-preview-anim {
    --preview-nudge: 0px;
    opacity: 0;
    transform: none;
    transition: opacity 120ms var(--ease-out);
  }

  .link-preview.is-open .link-preview-anim {
    opacity: 1;
    transform: none;
  }

  .link-preview-image {
    transform: none;
  }
}
