:root {
  --paper: #f7f3ec;
  --card: #fffdf9;
  --ink: #232a34;
  --muted: #5c6470;
  --faint: #8b929c;
  --line: #e7e0d4;
  --accent: #cf6a4c;
  --accent-ink: #a84a2f;
  --midnight: #1b2233;
  --amber: #e2a24a;
  --sky: #5b8cb0;
  --shadow: 0 24px 44px -26px rgba(27, 34, 51, 0.42);
  --serif: 'Familjen Grotesk', system-ui, sans-serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
}

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

a:hover {
  color: var(--accent);
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 74px;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  background: rgba(247, 243, 236, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.site-title {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.5rem);
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a.gh {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
}

.site-nav a.gh:hover {
  border-color: var(--ink);
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.9rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 22px -8px var(--accent);
}

.button.primary:hover {
  color: #fff;
  box-shadow: 0 14px 30px -8px var(--accent);
}

.button.secondary {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.button.secondary:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.button .arrow {
  transition: transform 0.18s ease;
}

.button:hover .arrow {
  transform: translateX(3px);
}

/* ---------- Hero (home) ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(2.75rem, 6vw, 5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.hero-content > :first-child {
  margin-top: 0;
}

.hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.6rem, 5.2vw, 4rem);
}

.hero-content p {
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.5;
}

.eyebrow,
.card-type {
  margin: 0 0 0.8rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

/* ---------- Hero graphic panel ---------- */
.panel {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 0.92;
  background: var(--midnight);
  border-radius: 24px;
  box-shadow: 0 30px 60px -30px rgba(27, 34, 51, 0.6);
}

.panel svg {
  display: block;
  width: 100%;
  height: 100%;
}

.panel .curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1700;
  stroke-dashoffset: 1700;
  animation: draw 2.3s 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.panel-cap {
  position: absolute;
  left: 22px;
  bottom: 18px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .panel .curve { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Sections ---------- */
.section,
.page {
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2rem;
}

.section-heading h2,
.related-files h2 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Pathway cards (home) ---------- */
.pathway-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
}

.pathway {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 2rem 2rem 1.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  transition: transform 0.16s ease, box-shadow 0.24s ease, border-color 0.2s ease;
}

.pathway:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #d9cfbe;
}

.pathway-motif {
  position: relative;
  width: 100%;
  height: 118px;
  overflow: hidden;
  background: var(--midnight);
  border-radius: 14px;
}

/* Fine "lab notebook" grid texture behind the card motif graphic */
.pathway-motif::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

.pathway-motif svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.pathway .card-type {
  color: var(--faint);
}

.pathway h3 {
  margin: 0;
  font-size: 1.7rem;
}

.pathway h3 a {
  color: var(--ink);
}

.pathway h3 a:hover {
  color: var(--accent-ink);
}

.pathway p {
  margin: 0;
  color: var(--muted);
}

.pathway-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--accent-ink);
  font-weight: 600;
}

.pathway:hover .arrow {
  transform: translateX(3px);
}

/* ---------- Contribute band (home) ---------- */
.band {
  position: relative;
  overflow: hidden;
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto clamp(2.5rem, 5vw, 4rem);
  padding: clamp(2.5rem, 4.5vw, 3.6rem);
  color: #fff;
  background: var(--midnight);
  border-radius: 28px;
}

/* Fine "lab notebook" grid texture on the contribute band */
.band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* keep band content above the texture layer */
.band > * {
  position: relative;
}

.band .eyebrow {
  color: var(--amber);
}

.band h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.2rem;
  margin-top: 2.2rem;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.step .bar {
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.step .no {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.step h3 {
  margin: 0;
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.step p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.98rem;
  line-height: 1.5;
}

.step code {
  padding: 0.05rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.85em;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

.band-action {
  margin-top: 2.1rem;
}

/* ---------- Listing / detail cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.4rem;
}

.example-card {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.24s ease;
}

.example-card:hover {
  transform: translateY(-4px);
}

.example-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.example-card-body {
  padding: 1.3rem;
}

.example-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.3rem;
  line-height: 1.2;
}

.example-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.example-card h3 a:hover {
  color: var(--accent-ink);
}

.example-card p {
  margin: 0;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 0.25rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--accent-ink);
  background: rgba(207, 106, 76, 0.09);
  border: 1px solid rgba(207, 106, 76, 0.26);
  border-radius: 999px;
}

.page-body,
.example-detail,
.resource-detail {
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.page-body {
  max-width: 820px;
}

.page-body h1,
.example-detail h1,
.resource-detail h1 {
  margin-top: 0;
  line-height: 1.05;
}

.page-body p,
.page-body li,
.content p,
.content li {
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
}

.example-detail-header {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 2rem);
  align-items: center;
  margin-bottom: 1.5rem;
}

.example-detail-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.example-detail h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.15rem;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin: 0 0 2rem;
}

.metadata-grid div {
  padding: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metadata-grid dt {
  font-family: var(--mono);
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metadata-grid dd {
  margin: 0.25rem 0 0;
  font-weight: 600;
}

.content {
  max-width: 780px;
}

.content h2 {
  margin-top: 2rem;
  line-height: 1.2;
}

.resources-intro {
  margin-bottom: 1.5rem;
}

.resource-list {
  display: grid;
  gap: 1rem;
}

.resource-list h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.15;
}

.resource-card {
  padding: 1.4rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease;
}

.resource-card:hover {
  transform: translateY(-3px);
}

.resource-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.3rem;
  line-height: 1.2;
}

.resource-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.resource-card h3 a:hover {
  color: var(--accent-ink);
}

.resource-card p {
  margin: 0;
  color: var(--muted);
}

.resource-detail-header {
  max-width: 820px;
  margin-bottom: 1.5rem;
}

.resource-detail h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.resource-content {
  padding-top: 0.25rem;
}

.related-files {
  margin-top: 2.5rem;
}

.file-list {
  display: grid;
  gap: 0.75rem;
}

.file-link {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
}

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

.file-link span {
  font-weight: 700;
}

.file-link small {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.75rem 0 2.5rem;
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--muted);
  font-weight: 500;
}

.site-footer a:hover {
  color: var(--ink);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero,
  .pathway-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 2rem;
  }

  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  .site-nav {
    flex-wrap: wrap;
  }
}
