html {
  scroll-padding-top: 8rem;
}

/* Page transitions are the UA default root crossfade, driven by nav.js.
   Deliberately no rules here. Do not add @view-transition (Chromium flashes
   white — docs/site-go-templ-spike.md) or override animation/duration/blend:
   the shorthand strips plus-lighter, so identical pixels dip mid-fade. */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  text-decoration: none;
}

/* Chrome */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
}

.site-nav {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 1.25rem 0;
  margin-bottom: 1.25rem;
}

.nav-links {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 2rem;
  overflow-x: auto;
  padding: 0.5rem 1.5rem;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  position: relative;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  padding-bottom: 0.2rem;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-link:hover {
  color: var(--color-accent);
}

.nav-link:hover::after {
  transform: scaleX(0.5);
}

.nav-link--active {
  color: var(--color-accent);
}

.nav-link--active::after {
  transform: scaleX(1);
}

.nav-end {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  position: relative;
}

.nav-end::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, var(--color-bg));
  pointer-events: none;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
}

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

/* Page shells */

.page,
.case-study,
.article {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.case-study .prose,
.article .prose {
  max-width: none;
}

.prose h2 + ul:not(.tech-chips):not(.impact-metrics) {
  list-style: none;
  padding: 0;
}

.prose h2 + ul:not(.tech-chips):not(.impact-metrics) > li {
  font-size: 1.0625rem;
  line-height: 1.7;
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
}

.prose h2 + ul:not(.tech-chips):not(.impact-metrics) > li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

.case-study-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.header-badges {
  margin-bottom: 0.75rem;
}

.header-badges:empty {
  display: none;
}

.status-badge {
  display: inline-flex;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.625rem;
  border-radius: 4px;
}

.status--ongoing {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status--archived {
  background: rgba(115, 115, 115, 0.15);
  color: var(--color-text-muted);
}

.page-head h1,
.case-study-header h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.case-study-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

.meta-separator {
  opacity: 0.5;
}

.outcome-summary {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
}

.tech-chips,
.tags-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0;
}

.tags-list {
  margin-bottom: 1rem;
}

.prose .tech-chips,
.case-study-header .tech-chips {
  margin: 1rem 0 0;
}

.prose .tech-chips {
  margin: 1rem 0 2rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-secondary);
}

li.tag {
  margin-bottom: 0;
}

.tag--lang  { color: var(--tag-lang);  background: var(--tag-lang-bg);  border-color: var(--tag-lang-br); }
.tag--gfx   { color: var(--tag-gfx);   background: var(--tag-gfx-bg);   border-color: var(--tag-gfx-br); }
.tag--infra { color: var(--tag-infra); background: var(--tag-infra-bg); border-color: var(--tag-infra-br); }
.tag--web   { color: var(--tag-web);   background: var(--tag-web-bg);   border-color: var(--tag-web-br); }


/* Lists, home, contact, journey */

.page-head {
  margin-bottom: 3rem;
}

.page-intro {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 700px;
}

.page-stats {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
}

.project-group {
  margin-bottom: 4rem;
}

.group-header {
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
}

.group-blurb {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.base-card,
.case-snapshot {
  display: block;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.base-card:hover,
.case-snapshot:hover {
  color: inherit;
  border-color: var(--color-accent);
  background: var(--surface-accent), var(--color-bg-elevated);
}

.base-card {
  position: relative;
  padding: 1.5rem 1.75rem;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}

.featured-badge svg {
  flex-shrink: 0;
}

.card-kicker,
.case-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.card-title {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.625rem;
  line-height: 1.4;
}

.card-description {
  display: block;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.tag-more {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  color: var(--color-text-muted);
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.arrow-link--accent {
  color: var(--color-accent);
}

.arrow-link--muted {
  color: var(--color-text-muted);
}

.arrow-link--muted:hover {
  color: var(--color-text);
}

.arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.arrow-link:hover .arrow,
.base-card:hover .arrow {
  transform: translateX(3px);
}

.home-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.hero {
  padding: 4rem 0 5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.hero-left {
  padding-right: 2rem;
}

.hero-title {
  font-size: 2.25rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.hero-title-emphasis {
  color: var(--color-text-secondary);
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.hero-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.hero-cta,
.cta-buttons,
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 6px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  color: #fff;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.btn-secondary:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}

.case-snapshots {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.case-snapshot {
  padding: 1.25rem 1.5rem;
}

.case-snapshot .case-label {
  margin-bottom: 0.375rem;
}

.case-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.case-outcome {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.introduction {
  max-width: 600px;
  margin-bottom: 5rem;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.introduction p {
  margin-bottom: 1rem;
}

.introduction p:first-child {
  color: var(--color-text);
}

.recent-section {
  margin-bottom: 5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.entries-list {
  border-top: 1px solid var(--color-border);
}

.entry-item {
  display: block;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
  color: inherit;
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-item:hover {
  color: inherit;
}

.entry-item:hover .entry-title {
  color: var(--color-accent);
}

.entry-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  opacity: 0.85;
  margin-bottom: 0.5rem;
}

.entry-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  transition: color 0.2s ease;
}

.entry-context {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.home-cta {
  padding: 3rem 0;
  border-top: 1px solid var(--color-border);
}

.home-cta h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.home-cta p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
  max-width: 500px;
  line-height: 1.6;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.footer-inner a {
  color: var(--color-text-muted);
}

.footer-inner a:hover {
  color: var(--color-text);
}

.journey-timeline {
  margin-top: 2rem;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1.5rem;
  position: relative;
}

.timeline-entry:last-child .timeline-line {
  display: none;
}

.timeline-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-bg);
  z-index: 2;
  flex-shrink: 0;
}

.timeline-dot[data-type="learning"] {
  background: #10b981;
}

.timeline-dot[data-type="transition"] {
  background: #f59e0b;
}

.timeline-line {
  position: absolute;
  top: 1rem;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--color-border);
}

.timeline-content {
  padding-bottom: 3rem;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.timeline-header time {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.timeline-type {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
}

.timeline-type[data-type="milestone"] {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.timeline-type[data-type="learning"] {
  color: #10b981;
  border-color: #10b981;
}

.timeline-type[data-type="transition"] {
  color: #f59e0b;
  border-color: #f59e0b;
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.timeline-description {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.timeline-skills-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.timeline-content .prose {
  font-size: 0.9375rem;
}

.timeline-content .prose h2 {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.75rem;
}

.timeline-content .prose h2:first-child {
  margin-top: 0;
}

.timeline-content .prose p,
.timeline-content .prose ul,
.timeline-content .prose ol {
  margin-bottom: 1rem;
}

.contact-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 1.5rem 8rem;
}

.contact-kicker {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.email-link {
  display: block;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.email-link:hover {
  color: var(--color-text-secondary);
}

.contact-context {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.contact-primary {
  margin-bottom: 3rem;
}

.contact-zone {
  padding-top: 2.5rem;
  margin-bottom: 2.5rem;
  border-top: 1px solid var(--color-border);
}

.contact-zone h2,
.contact-elsewhere h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
}

.strand-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.strand-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.strand-body {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.contact-elsewhere {
  padding-top: 2.5rem;
  border-top: 1px solid var(--color-border);
}

.contact-elsewhere h2 {
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.contact-elsewhere a {
  color: var(--color-text-secondary);
}

.contact-elsewhere a:hover {
  color: var(--color-text);
}

.toc {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.toc-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  list-style: none;
}

.toc-toggle::-webkit-details-marker {
  display: none;
}

.toc-toggle:hover {
  background: var(--color-bg-elevated);
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.toc-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding-right: 0.5rem;
}

.toc-icon {
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.toc[open] .toc-icon {
  transform: rotate(180deg);
}

.toc-list {
  list-style: none;
  padding: 0 1.25rem 1rem;
  margin: 0;
}

.toc-item {
  margin-bottom: 0.5rem;
}

.toc-item:last-child {
  margin-bottom: 0;
}

.toc-depth-3 {
  padding-left: 1rem;
}

.toc-link {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
  display: block;
}

.toc-link:hover {
  color: var(--color-text);
}

.back-link {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.back-link a {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.back-link a:hover {
  color: var(--color-text);
}

.back-link:hover .arrow {
  transform: translateX(-3px);
}

.decision {
  padding: 1.5rem;
  margin: 0 0 2rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-secondary);
}

.decision .decision-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.decision-block {
  margin-top: 1rem;
}

.decision-block strong {
  display: block;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.decision .decision-block p {
  margin: 0.5rem 0 0;
  font-size: 1.0625rem;
}

.decision-block ul {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}

.decision-block li {
  font-size: 1.0625rem;
  line-height: 1.6;
  padding: 0.25rem 0 0.25rem 1.25rem;
  position: relative;
  color: var(--color-text-secondary);
}

.decision-block li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

.impact-metrics {
  list-style: none;
  padding: 1.5rem 1.75rem;
  margin: 0 0 2rem;
  background: var(--surface-accent), var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem 2rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-value {
  font-size: 1.375rem;
  font-weight: 650;
  color: var(--color-accent);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}


@media (prefers-reduced-motion: reduce) {
  .nav-link::after,
  .arrow,
  .btn-primary,
  .toc-icon {
    transition: none;
  }
}

@media (max-width: 768px) {
  .nav-links {
    justify-content: flex-start;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
  }

  .page,
  .case-study,
  .article {
    padding: 1.5rem 1rem 3rem;
  }

  .case-study .prose {
    font-size: 1rem;
  }

  .decision {
    padding: 1.25rem;
  }

  .page-head h1,
  .case-study-header h1 {
    font-size: 2rem;
  }

  .page-intro {
    font-size: 1rem;
  }

  .prose h2 {
    font-size: 1.5rem;
  }

  .tag {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.5rem;
  }

  .tech-chips,
  .tags-list {
    gap: 0.375rem;
  }

  .home-page {
    padding: 0 1rem 3rem;
  }

  .hero {
    padding: 2.5rem 0 3rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero-left {
    padding-right: 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-cta,
  .cta-buttons,
  .cta {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    text-align: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .timeline-title {
    font-size: 1.125rem;
  }

  .timeline-description {
    font-size: 0.875rem;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .toc-toggle {
    padding: 0.875rem 1rem;
  }

  .toc-list {
    padding: 0 1rem 0.875rem;
  }

  .toc-link {
    font-size: 0.875rem;
  }
}
