:root {
  color-scheme: light dark;
  --background: #f4f1e9;
  --surface: #ebe7dc;
  --surface-hover: #e2ded2;
  --ink: #142019;
  --muted: #5c685f;
  --line: #c9c8bd;
  --accent: #e55f3f;
  --accent-ink: #9d321f;
  --focus: #147a54;
  --max-width: 1180px;
  --gutter: clamp(1.1rem, 3vw, 2.5rem);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #101713;
    --surface: #18231d;
    --surface-hover: #202e26;
    --ink: #edf0e8;
    --muted: #a9b4aa;
    --line: #334139;
    --accent: #f47d5f;
    --accent-ink: #ffad97;
    --focus: #69c99d;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% 8%, color-mix(in srgb, var(--accent) 9%, transparent) 0, transparent 28rem),
    var(--background);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.48;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  touch-action: manipulation;
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--background);
  font-weight: 700;
  transform: translateY(-180%);
  transition: transform 180ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main,
.site-footer {
  width: min(100%, calc(var(--max-width) + 2 * var(--gutter)));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  border-bottom: 1px solid var(--line);
}

.brand,
.header-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
}

.brand {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.header-link {
  position: relative;
  font-size: 0.85rem;
  font-weight: 700;
}

.header-link::after {
  position: absolute;
  right: 0;
  bottom: 0.4rem;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease-out;
}

.header-link:hover::after,
.header-link:focus-visible::after {
  transform: scaleX(1);
}

.header-link svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.hero {
  display: grid;
  min-height: auto;
  align-items: end;
  gap: clamp(2rem, 5vw, 5rem);
  grid-template-columns: minmax(0, 3fr) minmax(14rem, 1fr);
  padding-block: clamp(2rem, 4vw, 3rem) clamp(1.75rem, 3vw, 2.5rem);
}

.eyebrow,
.section-index {
  margin: 0 0 0.9rem;
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 13ch;
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(2.8rem, 5.4vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

h1 em {
  color: var(--accent);
  font-weight: 400;
}

.hero-note {
  position: relative;
  max-width: 20rem;
  padding: 1rem 0 0 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.hero-note p {
  margin-bottom: 1rem;
}

.live-mark {
  position: absolute;
  top: 1.3rem;
  left: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent);
}

.jump-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
}

.jump-link svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transition: transform 180ms ease-out;
}

.jump-link:hover svg,
.jump-link:focus-visible svg {
  transform: translateY(0.2rem);
}

.project-section {
  padding-block: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1;
}

.section-index {
  margin-bottom: 0.7rem;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.sync-status > span:first-child {
  width: 0.45rem;
  height: 0.45rem;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

.sync-status[data-state="ready"] > span:first-child {
  border: 0;
  background: var(--focus);
  animation: none;
}

.sync-status[data-state="fallback"] > span:first-child {
  border: 0;
  background: var(--accent);
  animation: none;
}

.project-grid {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  position: relative;
  display: flex;
  min-height: 21rem;
  flex-direction: column;
  padding: clamp(1.15rem, 2.25vw, 1.75rem);
  background: var(--surface);
  transition: background-color 180ms ease-out;
}

.project-card:hover,
.project-card:focus-within {
  background: var(--surface-hover);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-topline {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-repository {
  overflow-wrap: anywhere;
}

.project-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
}

.project-status span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--focus);
}

.project-status[data-kind="source"] span {
  background: var(--accent);
}

.project-title {
  margin: clamp(1.35rem, 2.5vw, 2rem) 0 0.6rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.project-description {
  max-width: 52ch;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.project-tags li {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.project-updated {
  margin-top: auto;
  margin-bottom: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.card-actions {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-actions[data-count="1"] {
  grid-template-columns: 1fr;
}

.project-action {
  position: relative;
  z-index: 1;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  transition: background-color 180ms ease-out, color 180ms ease-out, border-color 180ms ease-out;
}

.project-action-primary {
  background: var(--ink);
  color: var(--background);
}

.project-action-secondary {
  background: transparent;
  color: var(--ink);
}

.project-action-primary:hover,
.project-action-primary:focus-visible {
  border-color: var(--accent-ink);
  background: var(--accent-ink);
}

.project-action-secondary:hover,
.project-action-secondary:focus-visible {
  background: var(--ink);
  color: var(--background);
}

.project-action svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transition: transform 180ms ease-out;
}

.project-action:hover svg,
.project-action:focus-visible svg {
  transform: translateX(0.3rem);
}

.empty-state,
.notice {
  margin: 0;
  padding: 2rem;
  background: var(--surface);
  color: var(--muted);
}

.empty-state {
  grid-column: 1 / -1;
}

.notice {
  margin-top: 1rem;
  border: 1px solid var(--line);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-footer p {
  margin-bottom: 0;
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

@media (max-width: 760px) {
  .site-header {
    min-height: 3.75rem;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-block: 2.25rem 2rem;
  }

  h1 {
    font-size: clamp(3rem, 15vw, 4.6rem);
  }

  .hero-note {
    max-width: 24rem;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 1.25rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 20rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
  }
}

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

  .project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .card-actions {
    grid-template-columns: 1fr;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
