/* Apotropic company site: the "Ring" caterpillar mark, forest greens, one yellow eyespot. */
:root {
  --font-body: "Manrope", "Segoe UI", ui-sans-serif, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, ui-monospace, monospace;

  --paper: #f3f2ed;
  --surface: #ffffff;
  --ink: #0e1f18;
  --ink-soft: #33443c;
  --muted: #5b6862;
  --rule: #e2e1d9;
  --rule-strong: #c9cbc1;
  --on-ink: #f3f2ed;
  --accent: #217c5b;
  --accent-strong: #165c43;
  --on-accent: #ffffff;
  --tile: #217c5b;
  --panel: #0e1f18;
  --dots: rgb(33 124 91 / 0.14);
  --glow: rgb(76 195 138 / 0.16);
  --ring: rgb(33 124 91 / 0.07);
  --code-bg: #07120d;
  --code-ink: #e6f0ea;
  --code-key: #7fddb0;
  --code-str: #ffd66b;
  --code-num: #f3f2ed;
  --shadow: 0 1px 0 rgb(14 31 24 / 0.04), 0 22px 44px -30px rgb(14 31 24 / 0.35);

  /* Mark: tail (6) to head (0), plus the eyespot. --mark-gap must match what the mark sits on. */
  --seg-6: #0b3d2e;
  --seg-5: #13523d;
  --seg-4: #196349;
  --seg-3: #1f7656;
  --seg-2: #2a8c66;
  --seg-1: #38a577;
  --seg-0: #4cc38a;
  --eye: #ffc93c;
  --eye-line: #0e1f18;
  --mark-gap: var(--paper);

  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 74rem;
  --radius: 1.5rem;
  --radius-lg: 2rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1813;
    --surface: #13241c;
    --ink: #e6f0ea;
    --ink-soft: #c3d2ca;
    --muted: #93a79d;
    --rule: #22362c;
    --rule-strong: #34503f;
    --on-ink: #0c1813;
    --accent: #4cc38a;
    --accent-strong: #7ad9aa;
    --on-accent: #0c1813;
    --tile: #1d6e51;
    --panel: #081310;
    --dots: rgb(76 195 138 / 0.1);
    --glow: rgb(76 195 138 / 0.1);
    --ring: rgb(76 195 138 / 0.06);
    --code-bg: #040b08;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.2), 0 22px 44px -28px rgb(0 0 0 / 0.7);

    --seg-6: #1e5843;
    --seg-5: #22664e;
    --seg-4: #267459;
    --seg-3: #2b8464;
    --seg-2: #32976f;
    --seg-1: #3dae7e;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 1.0625rem/1.65 var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(60rem 36rem at 100% -10%, var(--glow), transparent 70%),
    var(--paper);
  overflow-x: hidden;
}

/* Dot lattice that fades out down the page. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 52rem;
  background-image: radial-gradient(circle, var(--dots) 1.2px, transparent 1.6px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 999px;
  font-weight: 600;
  z-index: 10;
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--on-ink);
}

.shell {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* The mark: seven segments painted tail to head, each outlined in --mark-gap so overlaps read as cuts. */
.mark .seg {
  stroke: var(--mark-gap);
  stroke-width: 2.4;
}

.mark .s0 { fill: var(--seg-0); }
.mark .s1 { fill: var(--seg-1); }
.mark .s2 { fill: var(--seg-2); }
.mark .s3 { fill: var(--seg-3); }
.mark .s4 { fill: var(--seg-4); }
.mark .s5 { fill: var(--seg-5); }
.mark .s6 { fill: var(--seg-6); }

.mark .iris {
  fill: var(--eye);
  stroke: var(--eye-line);
  stroke-width: 2.2;
}

.mark .pupil {
  fill: var(--eye-line);
}

/* Single-colour version for solid tiles: segments in currentColor, eye cut out of the head. */
.mark-mono .seg,
.mark-mono .iris {
  fill: currentColor;
}

.mark-mono .iris {
  stroke: var(--mark-gap);
}

.mark-mono .pupil {
  fill: var(--mark-gap);
}

/* Header */
.site-header {
  padding-top: 1.25rem;
}

.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font: 700 1.6rem/1 var(--font-body);
  letter-spacing: -0.04em;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark .mark {
  width: 2.25rem;
  height: 2.25rem;
  transition: transform 400ms var(--ease-spring);
}

.wordmark:hover .mark {
  transform: rotate(-14deg);
}

.wordmark span {
  /* Optical nudge: the lowercase x-height sits low against the round mark. */
  padding-bottom: 0.12em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font: 600 0.9375rem/1 var(--font-body);
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  transition: background-color 160ms ease, color 160ms ease;
}

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

.nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--on-ink);
}

/* Type */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  font: 700 0.75rem/1.4 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* A tiny eyespot: dark ring, yellow iris, pupil looking left. */
.kicker::before {
  content: "";
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 55%, #0e1f18 0 26%, #ffc93c 29% 64%, #0e1f18 67%);
}

h1,
h2,
h3,
.h2-like {
  font-family: var(--font-body);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 6.6vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

h2,
.h2-like {
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 750;
}

h3 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 em,
h2 em {
  font-style: normal;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--eye);
  text-decoration-thickness: 0.14em;
  text-underline-offset: 0.12em;
  text-decoration-skip-ink: none;
}

.lede {
  font-size: clamp(1.125rem, 1.8vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 38rem;
  margin: 1.75rem 0 0;
}

/* Hero */
main {
  flex: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-top: clamp(3rem, 8vw, 6.5rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

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

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  font: 700 0.9375rem/1 var(--font-body);
  text-decoration: none;
  border: 1.5px solid var(--ink);
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease,
    transform 160ms var(--ease-out);
}

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

.button-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.button-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

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

/* Hero card: the mark on a white tile, as on the brand sheet, with the etymology as its caption. */
.hero-card {
  --mark-gap: var(--surface);
  margin: 0;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background:
    repeating-radial-gradient(circle at 50% 42%, transparent 0 34px, var(--ring) 34px 35px),
    var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card .mark {
  width: min(64%, 17rem);
  margin: clamp(1rem, 3vw, 2rem) auto clamp(1.5rem, 4vw, 2.75rem);
}

.hero-card figcaption {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.hero-card figcaption b {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Sections, headed like the brand sheet: small green number, bold title, tracked tag at right. */
.section {
  padding-top: clamp(3.5rem, 8vw, 6.5rem);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1rem;
}

.num {
  margin-right: 0.7em;
  font: 500 0.36em/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--accent);
  vertical-align: 0.5em;
}

.tag {
  margin: 0;
  font: 700 0.75rem/1.4 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head + .product {
  margin-top: 1.75rem;
}

.section-intro {
  margin: 0 0 2.25rem;
  max-width: 38rem;
  color: var(--ink-soft);
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: principle;
}

.principles li {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  counter-increment: principle;
}

.principles li::before {
  content: counter(principle, decimal-leading-zero);
  display: block;
  margin-bottom: 2.5rem;
  font: 500 0.875rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--accent);
}

.principles h3 {
  margin-bottom: 0.75rem;
}

.principles p {
  margin: 0;
  color: var(--ink-soft);
}

/* Product card. The home page uses the dark panel variant, which re-scopes the colour tokens. */
.product {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.panel-dark {
  --ink: #e6f0ea;
  --ink-soft: #bfd0c6;
  --muted: #8fa79b;
  --rule: rgb(230 240 234 / 0.12);
  --rule-strong: rgb(230 240 234 / 0.3);
  --on-ink: #0e1f18;
  --accent: #4cc38a;
  --accent-strong: #7ad9aa;
  --on-accent: #0e1f18;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid rgb(76 195 138 / 0.14);
}

.product-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.product-name h2,
.product-name h3 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.status {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--eye);
  color: #0e1f18;
  font: 700 0.6875rem/1 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-tagline {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--accent);
}

.product p {
  color: var(--ink-soft);
}

.facts {
  display: grid;
  gap: 1.25rem;
  margin: 1.75rem 0 0;
}

.facts div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.facts dt {
  font: 700 0.75rem/1.7 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.facts ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  position: relative;
  padding-left: 1.1rem;
}

.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

.facts li + li {
  margin-top: 0.35rem;
}

.decision {
  align-self: start;
  margin: 0;
}

.decision pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 1rem;
  font: 400 0.875rem/1.7 var(--font-mono);
}

.decision .k {
  color: var(--code-key);
}

.decision .s {
  color: var(--code-str);
}

.decision .n {
  color: var(--code-num);
}

.decision figcaption {
  margin-top: 0.75rem;
  font: 400 0.8125rem/1.5 var(--font-mono);
  color: var(--muted);
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Contact: a solid green tile with the single-colour mark, like the sheet's brand tile. */
.contact {
  --ink: #ffffff;
  --ink-soft: rgb(255 255 255 / 0.86);
  --mark-gap: var(--tile);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem 3rem;
  align-items: center;
  padding: clamp(1.75rem, 5vw, 3.5rem);
  background: var(--tile);
  color: var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.contact p {
  margin: 1.25rem 0 0;
  color: var(--ink-soft);
  max-width: 34rem;
}

.contact-mail {
  display: inline-block;
  margin-top: 1.75rem;
  color: #ffffff;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration-color: var(--eye);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.25em;
  overflow-wrap: anywhere;
}

.contact-mail:hover {
  color: var(--eye);
}

.contact :focus-visible {
  outline-color: var(--eye);
}

.contact .mark {
  width: clamp(8rem, 18vw, 13rem);
  color: #ffffff;
}

/* Page header (inner pages) */
.page-head {
  padding-top: clamp(3rem, 8vw, 6rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.page-head > * {
  max-width: 50rem;
}

.page-head .mark {
  --mark-gap: var(--paper);
  width: 6.5rem;
  margin-bottom: 2rem;
}

.note {
  margin-top: 2rem;
  color: var(--muted);
}

/* Footer */
.site-footer {
  margin-top: clamp(4rem, 10vw, 7rem);
  padding: 1.75rem 0 2.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
  color: var(--muted);
}

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

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-brand .mark {
  width: 1.4rem;
  height: 1.4rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-weight: 600;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

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

/* Motion: staggered rise for page copy; the hero mark grows tail to head, then blinks and glances. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}

/* Pixel values are SVG user units here; the pupil stays inside the iris at both ends. */
@keyframes glance {
  0%,
  30% {
    transform: none;
  }
  38%,
  62% {
    transform: translate(8.8px, -1.6px);
  }
  70%,
  100% {
    transform: none;
  }
}

.reveal {
  animation: rise 0.9s var(--ease-out) both;
}

.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.25s; }
.d4 { animation-delay: 0.35s; }
.d5 { animation-delay: 0.5s; }

.mark-live .seg,
.mark-live .eye,
.mark-live .pupil {
  transform-box: fill-box;
  transform-origin: center;
}

.mark-live .seg {
  animation: pop 0.6s var(--ease-spring) both;
}

.mark-live .s6 { animation-delay: 0.2s; }
.mark-live .s5 { animation-delay: 0.28s; }
.mark-live .s4 { animation-delay: 0.36s; }
.mark-live .s3 { animation-delay: 0.44s; }
.mark-live .s2 { animation-delay: 0.52s; }
.mark-live .s1 { animation-delay: 0.6s; }
.mark-live .s0 { animation-delay: 0.68s; }

.mark-live .eye {
  animation:
    fade 0.3s ease 1.05s both,
    blink 6s ease-in-out 2.5s infinite;
}

.mark-live .pupil {
  animation: glance 9s var(--ease-out) 3.5s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .mark-live .seg,
  .mark-live .eye,
  .mark-live .pupil {
    animation: none;
  }

  .button,
  .nav a,
  .wordmark .mark {
    transition: none;
  }
}

/* Layout breakpoints */
@media (max-width: 60rem) {
  .hero,
  .product,
  .principles {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-card {
    max-width: 30rem;
  }

  .principles li::before {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 40rem) {
  .contact {
    grid-template-columns: minmax(0, 1fr);
  }

  .contact .mark {
    order: -1;
    width: 5.5rem;
  }

  .nav a {
    padding: 0.55rem 0.75rem;
  }
}

@media (max-width: 30rem) {
  .wordmark {
    font-size: 1.35rem;
    gap: 0.55rem;
  }

  .wordmark .mark {
    width: 1.9rem;
    height: 1.9rem;
  }

  .facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem;
  }

  .button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .decision pre {
    padding: 1rem;
    font-size: 0.75rem;
  }
}
