/* ============================================================
   Better Life Makers
   Warm almanac / letterpress editorial, tuned for legibility.
   Paper ground, iron ink, one terracotta accent.

   Readability rules for this site:
   - body copy never below ~18px, measure never above ~66ch
   - every interactive target at least 3.5rem tall
   - text/background pairs kept above WCAG AA
   ============================================================ */

:root {
  --paper: #f5efe3;
  --paper-raised: #fdfaf4;
  --paper-deep: #e9dfcd;
  --ink: #201b16;
  --ink-soft: #4a4139;
  --accent: #9c4522;
  --accent-deep: #7d3519;
  --on-accent: #fdfaf4;
  --hairline: rgba(32, 27, 22, 0.2);
  --shadow: 0 1px 2px rgba(32, 27, 22, 0.06), 0 10px 26px rgba(32, 27, 22, 0.07);

  --ease-out: cubic-bezier(0.16, 0.84, 0.32, 1);
  --grain-opacity: 0.2;

  --measure: 62ch;
  --page: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17130f;
    --paper-raised: #221c17;
    --paper-deep: #100d0b;
    --ink: #f2e9db;
    --ink-soft: #c1b3a1;
    --accent: #f0a173;
    --accent-deep: #f7bd97;
    --on-accent: #17130f;
    --hairline: rgba(242, 233, 219, 0.24);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.35);
    --grain-opacity: 0.16;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 2rem;
}

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--paper);
  background-image: radial-gradient(
    120% 80% at 18% 0%,
    color-mix(in oklab, var(--paper) 92%, #fff) 0%,
    var(--paper) 46%,
    var(--paper-deep) 100%
  );
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Karla", ui-sans-serif, system-ui, sans-serif;
  /* Large by default: this page is read by people who want it large. */
  font-size: clamp(1.15rem, 1rem + 0.45vw, 1.375rem);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ---------- Atmosphere ---------- */

/* Fixed, so the noise never repaints with a scrolling container. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='220' height='220' filter='url(%23n)' opacity='0.5'/></svg>");
}

@media (prefers-color-scheme: dark) {
  .grain {
    mix-blend-mode: screen;
  }
}

/* Concentric rule-work, kept inside the hero so it never sits under body copy. */
.orbit {
  position: absolute;
  z-index: 0;
  top: -34%;
  right: -18vmin;
  width: min(70vmin, 620px);
  height: min(70vmin, 620px);
  stroke: var(--accent);
  stroke-width: 0.7;
  opacity: 0.3;
  pointer-events: none;
  transform-origin: center;
  animation: drift 60s linear infinite;
}

.orbit circle:nth-child(2) {
  stroke-dasharray: 3 9;
}

.orbit circle:nth-child(3) {
  stroke: var(--ink);
  opacity: 0.45;
}

@keyframes drift {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Shared shell ---------- */

.wrap {
  width: min(100% - clamp(2rem, 8vw, 6rem), var(--page));
  margin-inline: auto;
}

/* Available to screen readers, invisible on screen. Absolutely positioned, so
   it never becomes a flex item inside .btn and never adds a phantom gap. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0;
  z-index: 20;
  transform: translateY(-140%);
  padding: 1rem 1.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 0.6rem 0.6rem;
  transition: transform 0.18s var(--ease-out);
}

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

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

/* ---------- Header & navigation ---------- */

/* Always visible, never collapsed behind a menu icon. */
.site-header {
  position: relative;
  z-index: 3;
  border-block-end: 1px solid var(--hairline);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.1rem;
}

.brand {
  display: inline-block;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 48, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  padding-block: 0.4rem;
}

.brand em {
  font-style: italic;
  font-variation-settings: "opsz" 48, "SOFT" 58, "WONK" 1;
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  border-block-end: 3px solid transparent;
}

.site-nav a:hover {
  color: var(--accent);
  border-block-end-color: var(--accent);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  border-block-end-color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 8vw, 6.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.title {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 144, "SOFT" 34, "WONK" 0;
  font-weight: 550;
  font-size: clamp(3rem, 11vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

/* Each word rides up out of its own mask; overflow:hidden is load-bearing. */
.line {
  display: block;
  overflow: hidden;
  padding-block: 0.08em;
  margin-block: -0.08em;
}

.reveal {
  display: block;
  will-change: transform;
  animation: rise 1s var(--ease-out) both;
}

.line:nth-child(1) .reveal {
  animation-delay: 0.06s;
}
.line:nth-child(2) .reveal {
  animation-delay: 0.16s;
}
.line:nth-child(3) .reveal {
  animation-delay: 0.26s;
}

@keyframes rise {
  from {
    transform: translate3d(0, 108%, 0) rotate(1.4deg);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0) rotate(0);
    opacity: 1;
  }
}

/* The one thing you remember. */
.title em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 58, "WONK" 1;
  color: var(--accent);
}

.tagline {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 60, "SOFT" 40, "WONK" 0;
  font-weight: 500;
  font-size: clamp(1.4rem, 1.05rem + 1.5vw, 2.15rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  max-width: 24ch;
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
  color: var(--ink);
  text-wrap: balance;
}

.rule {
  border: 0;
  height: 1px;
  background: var(--hairline);
  margin: clamp(1.5rem, 4vw, 2.5rem) 0;
  width: min(100%, 34rem);
  transform-origin: left center;
  animation: draw 1s var(--ease-out) 0.45s both;
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.lede {
  max-width: var(--measure);
  margin: 0;
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(3rem, 7vw, 5.5rem);
  border-block-start: 1px solid var(--hairline);
}

.section:first-of-type {
  border-block-start: 0;
}

.section-title {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 96, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

.section-intro {
  max-width: var(--measure);
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem);
  color: var(--ink-soft);
}

.prose {
  max-width: var(--measure);
}

.prose p {
  margin: 0 0 1.15em;
}

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

.prose strong {
  font-weight: 700;
  color: var(--ink);
}

/* ---------- Project cards ---------- */

.projects {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
}

.project {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.project-media {
  margin: 0;
  background: var(--paper-deep);
  border-block-end: 1px solid var(--hairline);
}

.project-media img {
  display: block;
  width: 100%;
  height: auto;
}

.project-body {
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.project-title {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 72, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0.65rem 0 0;
}

.project-subtitle {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 40, "SOFT" 50, "WONK" 1;
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.55rem);
  line-height: 1.35;
  color: var(--accent);
  margin: 0.5rem 0 0;
  max-width: 34ch;
}

.project-body .prose {
  margin-block-start: 1.25rem;
}

/* Wide screens: picture beside the words. */
@media (min-width: 62rem) {
  .project {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .project-media {
    /* Stretches to the row, image stays centred inside it. */
    display: flex;
    align-items: center;
    border-block-end: 0;
    border-inline-end: 1px solid var(--hairline);
  }

  .project--no-media {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Status badge ---------- */

.badge {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 2px solid currentColor;
}

.badge--live {
  color: var(--accent-deep);
}

.badge--soon {
  color: var(--ink-soft);
}

@media (prefers-color-scheme: dark) {
  .badge--live {
    color: var(--accent);
  }
}

.note {
  max-width: var(--measure);
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border-inline-start: 5px solid var(--hairline);
  background: color-mix(in oklab, var(--paper-deep) 55%, transparent);
  border-radius: 0 0.6rem 0.6rem 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* ---------- Lists ---------- */

.steps,
.bullets {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.9rem;
}

.steps {
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 3.4rem;
  min-height: 2.4rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0.1em;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1;
}

.bullets li {
  position: relative;
  padding-inline-start: 2.2rem;
}

.bullets li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.35rem;
  top: 0.62em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--accent);
}

.list-heading {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-variation-settings: "opsz" 36, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem);
  margin: 2rem 0 0;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-block-start: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3.75rem;
  padding: 0.9rem 2rem;
  border: 2px solid transparent;
  border-radius: 0.7rem;
  font-family: inherit;
  font-size: clamp(1.1rem, 1.02rem + 0.35vw, 1.3rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease-out),
    color 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow);
}

.btn--primary:hover {
  background: var(--accent-deep);
  transform: translateY(-2px);
}

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

.btn--secondary:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-2px);
}

.btn--large {
  min-height: 4.25rem;
  padding-inline: 2.5rem;
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
}

@media (max-width: 30rem) {
  .btn {
    width: 100%;
  }
}

/* ---------- Contact ---------- */

.contact-card {
  max-width: 44rem;
  margin-block-start: 2rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
}

.contact-label {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.email-link {
  display: inline-block;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 48, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(1.3rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  word-break: break-word;
  padding-block: 0.35rem;
}

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

/* ---------- Footer ---------- */

.site-footer {
  border-block-start: 1px solid var(--hairline);
  padding-block: clamp(2rem, 5vw, 3rem);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: baseline;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--ink);
  font-weight: 600;
  text-underline-offset: 0.2em;
}

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

/* ---------- Subpage bits ---------- */

.page-header {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.page-title {
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 144, "SOFT" 34, "WONK" 0;
  font-weight: 600;
  font-size: clamp(2.5rem, 1.6rem + 4vw, 5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0.75rem 0 0;
  text-wrap: balance;
}

.page-logo {
  display: block;
  width: clamp(9rem, 22vw, 13rem);
  height: auto;
  margin: 0 0 1.5rem;
  border-radius: 0.9rem;
}

.figure {
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  max-width: 46rem;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
}

.figure figcaption {
  margin-block-start: 0.85rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  font-weight: 700;
  color: var(--ink);
  text-underline-offset: 0.2em;
}

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

/* ---------- Reduced motion ---------- */

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

  .reveal,
  .rule,
  .orbit,
  .skip-link,
  .btn {
    animation: none;
    transition: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .rule {
    transform: scaleX(1);
  }

  .btn:hover {
    transform: none;
  }
}
