:root {
  --header-h: 5.75rem;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui,
    sans-serif;
  /* Readable column; body copy ~15px like reference layouts */
  --content-max: 42rem;
  --text-body: 0.9375rem;
  --text-body-sm: 0.875rem;
  --text-ui: 0.8125rem;
}

/* Light (default) */
:root,
html[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elevated: #f4f4f7;
  --border: rgba(0, 0, 0, 0.09);
  --text: #1d1d1f;
  --muted: #5c5c5c;
  --faint: #86868b;
  --accent: #b4532a;
  --accent-hover: #943c1f;
  --nav-pill: rgba(0, 0, 0, 0.06);
  --link-hover-bg: rgba(0, 0, 0, 0.05);
  --social-hover-bg: rgba(0, 0, 0, 0.06);
  --avatar-gradient: linear-gradient(145deg, #f0f0f4, #e2e2e8);
  --avatar-border-hover: rgba(180, 83, 42, 0.45);
  --btn-outline-border: rgba(0, 0, 0, 0.22);
  --btn-outline-hover-bg: rgba(0, 0, 0, 0.04);
  --intro-pipe: rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --faint: #6e6e73;
  --accent: #d4876a;
  --accent-hover: #e0987d;
  --nav-pill: rgba(255, 255, 255, 0.08);
  --link-hover-bg: rgba(255, 255, 255, 0.06);
  --social-hover-bg: rgba(255, 255, 255, 0.06);
  --avatar-gradient: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  --avatar-border-hover: rgba(212, 135, 106, 0.45);
  --btn-outline-border: rgba(255, 255, 255, 0.35);
  --btn-outline-hover-bg: rgba(255, 255, 255, 0.06);
  --intro-pipe: rgba(255, 255, 255, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

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

.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;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -100px;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 2000;
  transition: top 0.15s ease;
  border-radius: 6px;
}

.skip-link:focus {
  top: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

strong {
  color: var(--accent);
  font-weight: 600;
}

/* Stacked shell: top bar + main */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top site header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  transform: translateY(0);
  transition: transform 220ms ease;
  will-change: transform;
}

.site-header.is-hidden {
  transform: translateY(calc(-1 * var(--header-h)));
}

@media (prefers-reduced-motion: reduce) {
  .site-header {
    transition: none;
  }
}

.site-header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: clamp(1rem, 3vw, 2rem);
  min-height: var(--header-h);
  padding: 0.85rem clamp(1.35rem, 5vw, 3.5rem);
  width: 100%;
  max-width: 90rem;
  margin-inline: auto;
}

.site-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--social-hover-bg);
}

.theme-toggle-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle .theme-toggle-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-toggle-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-toggle-sun {
  display: block;
}

.avatar-link {
  text-decoration: none;
  flex-shrink: 0;
  grid-column: 1;
  justify-self: start;
}

.avatar-link:hover {
  text-decoration: none;
}

.avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 11px;
  background: var(--avatar-gradient);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-link:hover .avatar {
  border-color: var(--avatar-border-hover);
  transform: scale(1.02);
}

.site-nav-panel {
  grid-column: 2;
  display: flex;
  min-width: 0;
  justify-content: center;
  justify-self: center;
  width: 100%;
}

.site-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  font-size: clamp(0.9375rem, 1.65vw, 1.0625rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--link-hover-bg);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--nav-pill);
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  opacity: 0.88;
}

.site-social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.email-menu {
  position: relative;
}

.email-popover {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 14rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: grid;
  gap: 0.45rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
  z-index: 25;
}

.email-menu.is-open .email-popover,
.email-menu:hover .email-popover,
.email-menu:focus-within .email-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.email-popover-address {
  margin: 0;
  font-size: var(--text-ui);
  color: var(--text);
  word-break: break-word;
}

.email-popover-action,
.email-popover-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: var(--text-ui);
  font-weight: 600;
  text-decoration: none;
}

.email-popover-action {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

.email-popover-copy {
  border: 1px solid transparent;
  color: var(--bg);
  background: var(--text);
  cursor: pointer;
}

.email-popover-action:hover,
.email-popover-copy:hover {
  text-decoration: none;
}

.email-popover-copy.is-copied {
  background: var(--accent);
}

.nav-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.625rem;
  height: 2.625rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.nav-menu-toggle-bar {
  display: block;
  width: 1rem;
  height: 1.5px;
  margin-inline: auto;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.15s ease;
}

.nav-menu-toggle[aria-expanded="true"] .nav-menu-toggle-bar:first-of-type {
  transform: translateY(3.25px) rotate(45deg);
}

.nav-menu-toggle[aria-expanded="true"] .nav-menu-toggle-bar:last-of-type {
  transform: translateY(-3.25px) rotate(-45deg);
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9px;
  color: var(--faint);
  transition: color 0.12s ease, background 0.12s ease;
}

.social-btn:hover {
  color: var(--text);
  background: var(--social-hover-bg);
  text-decoration: none;
}

.social-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Main column */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.35rem, 4vw, 3rem);
  max-width: calc(var(--content-max) + 6rem);
  margin-inline: auto;
  width: 100%;
}

#intro,
.route--home .section {
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

/* Dedicated full-page views (Experience / Projects from top nav) */
.route--dedicated {
  padding: 0;
  max-width: none;
  margin-inline: 0;
  width: 100%;
}

.route--dedicated.section-tint {
  max-width: none;
}

.view-section {
  max-width: var(--content-max);
  margin-inline: auto;
}

.view-section--projects {
  max-width: var(--content-max);
}

.view-narrative-divider {
  margin: 1.75rem 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.view-depth-title {
  margin: 0 0 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.view-depth-lead {
  margin: 0 0 0.65rem;
  font-size: var(--text-body-sm);
  line-height: 1.58;
  color: var(--muted);
}

.view-depth-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.view-depth-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.view-depth-heading {
  margin: 0 0 0.35rem;
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--text);
}

.view-depth-p {
  margin: 0 0 0.45rem;
  font-size: var(--text-body-sm);
  line-height: 1.58;
  color: var(--muted);
}

.view-depth-p:last-child {
  margin-bottom: 0;
}

.view-depth-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: var(--text-body-sm);
  line-height: 1.55;
  color: var(--muted);
}

.view-depth-list li + li {
  margin-top: 0.35rem;
}

.view-depth-empty {
  margin: 0;
  font-size: var(--text-body-sm);
  color: var(--faint);
}

/* Intro (hero) */
.intro {
  max-width: var(--content-max);
  padding-bottom: clamp(2rem, 5vw, 3rem);
  margin-bottom: clamp(0.85rem, 2.5vw, 1.5rem);
  border-bottom: 1px solid var(--border);
}

/* No section entrance animations */
#intro[data-content-loaded="true"],
#home-experience[data-content-loaded="true"],
#home-projects[data-content-loaded="true"] {
  opacity: 1;
  transform: none;
  animation: none;
}

.intro-title {
  margin: 0 0 0.85rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em 0.45em;
}

.intro-greet {
  display: inline;
  font-size: clamp(2.65rem, 9.5vw, 4.25rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
}

.intro-name {
  display: inline;
  font-size: clamp(2.65rem, 9.5vw, 4.25rem);
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

.intro-roles {
  margin: 0 0 1.35rem;
  font-size: clamp(0.9375rem, 2.1vw, 1.0625rem);
  font-weight: 500;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
}

.intro-pipe {
  color: var(--intro-pipe);
  font-weight: 300;
  -webkit-user-select: none;
  user-select: none;
}

.intro-lede {
  margin: 0 0 1.15rem;
  max-width: var(--content-max);
  font-size: clamp(1.0625rem, 1.85vw, 1.1875rem);
  line-height: 1.62;
}

.intro-lede:last-of-type {
  margin-bottom: 0;
}

.intro-cta-wrap {
  margin: 1.5rem 0 0;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.1rem;
  font-family: inherit;
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--btn-outline-border);
  border-radius: 999px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-outline:hover {
  border-color: var(--text);
  background: var(--btn-outline-hover-bg);
  color: var(--text);
  text-decoration: none;
}

/* Sections */
.section {
  padding: clamp(2rem, 4vw, 2.75rem) 0;
  max-width: var(--content-max);
}

.section-tint {
  margin: 0 calc(-1 * clamp(1.5rem, 5vw, 3.5rem));
  padding-left: clamp(1.5rem, 5vw, 3.5rem);
  padding-right: clamp(1.5rem, 5vw, 3.5rem);
  background: var(--bg-elevated);
  border-block: 1px solid var(--border);
}

.section-heading {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-sub {
  margin: 0 0 1.35rem;
  color: var(--faint);
  font-size: var(--text-body-sm);
  line-height: 1.58;
}

.section-sub a {
  font-weight: 500;
}

/* Work list */
.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
}

.work-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 1.25rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.work-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.work-index {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.1em;
  padding-top: 0.2rem;
}

.work-body h3 {
  margin: 0 0 0.35rem;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.work-body p {
  margin: 0 0 0.45rem;
  font-size: var(--text-body-sm);
  color: var(--muted);
  line-height: 1.58;
}

.work-meta {
  margin: 0 !important;
  font-size: 0.6875rem !important;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint) !important;
}

/* Dedicated Experience view (data/views.json → experienceView): intro-like type, no card chrome */
.exp-canvas-host {
  max-width: var(--content-max);
  margin-inline: auto;
}

.exp-view {
  margin: 0;
  padding: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}

.exp-view--home {
  border-bottom: 0;
  padding-bottom: 0;
}

.exp-view-head {
  margin: 0 0 clamp(1.25rem, 3vw, 1.75rem);
}

.exp-view-hero-title {
  margin: 0 0 0.75rem;
}

.exp-view-hero-title .intro-name {
  text-transform: none;
}

.exp-view-lede {
  margin: 0 0 1.25rem;
  max-width: var(--content-max);
}

.exp-view-lede:last-child {
  margin-bottom: 0;
}

.exp-view-lede a {
  color: var(--accent);
  font-weight: 500;
}

.exp-view-lede a:hover {
  color: var(--accent-hover);
}

.exp-group {
  margin-top: clamp(1.75rem, 4vw, 2.25rem);
}

.exp-group:first-of-type {
  margin-top: 0.25rem;
}

.exp-group-heading {
  margin: 0 0 1rem;
  font-size: clamp(1rem, 2vw, 1.0625rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.exp-group-items {
  display: flex;
  flex-direction: column;
}

.exp-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0 0 1.35rem;
}

.exp-group-items .exp-row:last-child {
  padding-bottom: 0;
}

.exp-row--aside {
  justify-content: space-between;
  align-items: flex-start;
}

.exp-row-main {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.exp-row-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  color: var(--faint);
}

.exp-row-icon svg {
  display: block;
}

.exp-row-title {
  display: block;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.exp-row-meta {
  margin: 0.2rem 0 0;
  font-size: var(--text-body-sm);
  color: var(--muted);
  line-height: 1.45;
}

.exp-row-bullets {
  margin: 0.55rem 0 0;
  padding-left: 1.05rem;
  color: var(--muted);
  font-size: var(--text-body-sm);
  line-height: 1.58;
}

.exp-row-bullets li + li {
  margin-top: 0.4rem;
}

.project-grid {
  margin-top: 0.25rem;
  display: grid;
  gap: 1.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .project-grid {
    grid-template-columns: 1fr;
    gap: 1.35rem;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.project-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-card-link:hover .project-card-media,
.project-card-link:focus-visible .project-card-media {
  transform: translateY(-2px);
  transition: transform 120ms ease-out;
}

.project-card-media {
  position: relative;
  min-height: 14.5rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow-soft);
}

.project-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.3) 100%);
}

.project-card-media-label {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 0 0 0.9rem 0.9rem;
  padding: 0.22rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.project-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.project-card-tag {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4fb08f;
}

.project-card-title {
  margin: 0;
  font-size: 1.72rem;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--text);
}

.project-card-summary {
  margin: 0.18rem 0 0;
  font-size: var(--text-body-sm);
  color: var(--muted);
  line-height: 1.56;
}

.exp-row-aside {
  flex-shrink: 0;
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--faint);
  padding: 0.15rem 0 0 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.exp-row-aside-logo {
  display: block;
  width: clamp(2.8rem, 8vw, 4.25rem);
  height: auto;
  object-fit: contain;
}

@media (max-width: 560px) {
  .exp-row--aside {
    flex-wrap: wrap;
  }

  .exp-row-aside {
    margin-left: auto;
  }
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 8.75rem 1fr;
  gap: 1rem 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

@media (max-width: 560px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

.timeline-dates {
  margin: 0.1rem 0 0;
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--faint);
}

.timeline-body h3 {
  margin: 0 0 0.12rem;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.timeline-org {
  margin: 0 0 0.5rem;
  font-size: var(--text-body-sm);
  color: var(--muted);
}

.timeline-body ul {
  margin: 0;
  padding-left: 1.05rem;
  color: var(--muted);
  font-size: var(--text-body-sm);
  line-height: 1.58;
}

.timeline-body li + li {
  margin-top: 0.4rem;
}

.contact-form {
  display: grid;
  gap: 0.95rem;
  max-width: var(--content-max);
}

.contact-field {
  display: grid;
  gap: 0.35rem;
}

.contact-field label {
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text);
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-body-sm);
  line-height: 1.5;
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-field textarea {
  resize: vertical;
  min-height: 8.5rem;
}

.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.contact-submit {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid var(--btn-outline-border);
  background: transparent;
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.contact-submit:hover {
  border-color: var(--text);
  background: var(--btn-outline-hover-bg);
}

.contact-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.contact-status {
  margin: 0;
  min-height: 1.15rem;
  font-size: var(--text-body-sm);
  color: var(--faint);
}

.contact-status.is-success {
  color: #1f8a5c;
}

.contact-status.is-error {
  color: var(--accent);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 1.1rem clamp(1.35rem, 4vw, 3rem) 1.75rem;
  border-top: 1px solid var(--border);
  font-size: var(--text-ui);
  color: var(--faint);
}

.site-footer p {
  margin: 0;
}

.content-status {
  margin: 0;
  color: var(--faint);
  font-size: var(--text-body-sm);
}

.content-error {
  margin: 0;
  color: var(--accent);
  font-size: var(--text-body-sm);
  line-height: 1.55;
}

/* Mobile: collapse primary nav into menu */
@media (max-width: 768px) {
  :root {
    --header-h: 4.35rem;
  }

  .site-header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "brand end"
      "panel panel";
    align-items: center;
    column-gap: 0.65rem;
    row-gap: 0;
    padding: 0.75rem 1rem;
  }

  .avatar-link {
    grid-area: brand;
    grid-column: auto;
    justify-self: start;
  }

  .site-header-end {
    grid-area: end;
    justify-self: end;
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  .site-social {
    gap: 0.1rem;
  }

  .email-popover {
    right: 0;
    min-width: min(14rem, calc(100vw - 1.5rem));
    max-width: calc(100vw - 1.5rem);
  }

  .nav-menu-toggle {
    display: flex;
    justify-self: end;
  }

  .site-nav-panel {
    grid-area: panel;
    grid-column: auto;
    flex: none;
    justify-content: stretch;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  .site-nav-panel.is-open {
    max-height: 16rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
    margin-top: 0.65rem;
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
  }

  .nav-link {
    justify-content: flex-start;
  }

  .social-btn {
    width: 2.35rem;
    height: 2.35rem;
  }

  .theme-toggle,
  .nav-menu-toggle {
    width: 2.35rem;
    height: 2.35rem;
  }
}

@media (min-width: 769px) {
  .site-header-end {
    grid-column: 3;
    justify-self: end;
  }

  .site-nav-panel {
    display: flex !important;
    max-height: none !important;
    overflow: visible !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    border-top: 0 !important;
  }

  .nav-menu-toggle {
    display: none !important;
  }
}
