/* =========================================================
   Lancelot Software landing page
   ========================================================= */

:root {
  --ink: #1E1B4B;
  --ink-soft: #4A4675;
  --paper: #FBF6EC;
  --cream: #FFF8EC;
  --violet: #6D4AFF;
  --violet-soft: #EDE7FF;
  --lilac: #A996F2;
  --gold: #FFB84D;
  --ochre: #F2A541;
  --coral: #EF6F5E;
  --gum: #3F8F72;

  --radius: 22px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 90px; overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: radial-gradient(rgba(30, 27, 75, .08) 1px, transparent 1px);
  background-size: 22px 22px;
}

main, header, footer { position: relative; z-index: 1; }

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

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  line-height: 1.08;
  margin: 0 0 .5em;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 750; }
h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 700; }
h3 { font-size: 1.35rem; font-weight: 650; }

p { margin: 0 0 1em; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: clamp(18px, 4vw, 40px);
}

.sr, .skip {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip:focus {
  clip: auto; width: auto; height: auto;
  top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--cream); border-radius: 10px;
}

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

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  padding: .85em 1.35em;
  font: 600 1rem/1 var(--font-body);
  color: var(--cream);
  background: var(--violet);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .2s;
}
.btn svg { width: 1.1em; height: 1.1em; transition: transform .2s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.btn-ghost { background: var(--cream); color: var(--ink); }
.btn-small { padding: .6em 1.05em; font-size: .92rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid transparent;
  transition: border-color .25s;
}
.site-header.scrolled { border-bottom-color: var(--ink); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.35rem;
  letter-spacing: -.01em;
}
.brand em {
  font-style: normal;
  font-weight: 500;
  margin-left: .28em;
  color: var(--ink-soft);
}
.brand-mark { width: 34px; height: 39px; transition: transform .3s; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-light { color: var(--cream); }
.brand-light em { color: var(--lilac); }

.nav-links { display: flex; align-items: center; gap: 1.8rem; }
.nav-links a:not(.btn) {
  font-weight: 500;
  text-decoration: none;
  position: relative;
}
.nav-links a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav-links a:not(.btn):hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  width: 46px; height: 46px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span:not(.sr) {
  width: 20px; height: 3px; border-radius: 3px; background: var(--ink);
  transition: transform .25s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 6vw, 70px) 0 clamp(40px, 6vw, 80px); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .45em 1em;
  font-size: .9rem;
  font-weight: 600;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.eyebrow .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gum);
  box-shadow: 0 0 0 0 rgba(63, 143, 114, .6);
  animation: ping 2s infinite;
}

.scribble {
  position: relative;
  white-space: nowrap;
  color: var(--violet);
  font-style: italic;
}
.scribble::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%; bottom: -.12em;
  height: .32em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 20' preserveAspectRatio='none'%3E%3Cpath d='M3 14 C60 4 120 4 170 9 S260 16 297 6' fill='none' stroke='%23FFB84D' stroke-width='7' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  z-index: -1;
}

.lede { font-size: clamp(1.08rem, 1.5vw, 1.22rem); color: var(--ink-soft); max-width: 36em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 2rem; }

.hero-art { position: relative; }
.hero-svg { width: 100%; height: auto; filter: drop-shadow(8px 10px 0 rgba(30, 27, 75, .9)); }

/* hero animations */
.cloud-a { animation: drift 16s ease-in-out infinite alternate; }
.cloud-b { animation: drift 12s ease-in-out infinite alternate-reverse; }
.sun { transform-origin: 455px 190px; animation: pulse 5s ease-in-out infinite; }
.ecg { stroke-dasharray: 520; stroke-dashoffset: 520; animation: ecg 4.5s ease-in-out infinite; }
.knight { animation: bob 3.6s ease-in-out infinite; }
.pennant, .flag { transform-box: fill-box; transform-origin: left center; animation: flutter 1.8s ease-in-out infinite; }
.plume { transform-box: fill-box; transform-origin: 20% 100%; animation: sway 3s ease-in-out infinite; }
.canopy { transform-box: fill-box; transform-origin: bottom center; animation: sway 5s ease-in-out infinite; }
.t2 .canopy { animation-delay: -2s; }
.window { animation: flicker 6s steps(1) infinite; }
.window.w2 { animation-delay: -2s; }
.window.w3 { animation-delay: -4s; }
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 2.6s ease-in-out infinite; }
.s2 { animation-delay: -.9s; }
.s3 { animation-delay: -1.7s; }

/* ---------- sections ---------- */
.section { padding: clamp(70px, 10vw, 130px) 0; }

.section-head { max-width: 720px; margin: 0 auto clamp(40px, 6vw, 70px); text-align: center; }
.section-head p:last-child { color: var(--ink-soft); font-size: 1.12rem; }
.section-head.left { text-align: left; margin-inline: 0; margin-bottom: 2rem; }

.kicker {
  display: inline-block;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--violet);
  margin-bottom: .9rem;
}
.kicker::before { content: "✦ "; color: var(--gold); }
.kicker-light { color: var(--lilac); }

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2.5vw, 30px);
}

.card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 26px 26px 20px;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translate(-3px, -4px) rotate(-.4deg); box-shadow: 10px 11px 0 var(--ink); }
.card:nth-child(even):hover { transform: translate(-3px, -4px) rotate(.4deg); }
.card-art { width: 150px; height: auto; margin: -4px 0 14px -8px; }
.card p { color: var(--ink-soft); margin-bottom: 0; }

.card .dash { animation: dash 1.2s linear infinite; }
.card:hover .gear, .gear { animation: spin 8s linear infinite; }
.card:hover .gear { animation-duration: 2s; }
.beat { transform-box: fill-box; transform-origin: center; animation: beat 1.4s ease-in-out infinite; }

/* ---------- quest ---------- */
.quest { background: var(--violet-soft); border-block: 3px solid var(--ink); position: relative; }

.quest-map { position: relative; }
.quest-path {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 140px;
  z-index: 0;
}

.steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
  list-style: none;
  padding: 0;
  margin: 0;
}
.step {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 44px 22px 22px;
  box-shadow: var(--shadow);
  position: relative;
}
.step:nth-child(1) { margin-top: 60px; }
.step:nth-child(2) { margin-top: 10px; }
.step:nth-child(3) { margin-top: 70px; }
.step:nth-child(4) { margin-top: 0; }
.step p { color: var(--ink-soft); font-size: .98rem; margin: 0; }
.step-badge {
  position: absolute;
  top: -26px; left: 20px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font: 750 1.5rem/1 var(--font-display);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.step:nth-child(1) .step-badge { background: var(--gold); }
.step:nth-child(2) .step-badge { background: var(--coral); color: var(--cream); }
.step:nth-child(3) .step-badge { background: var(--gum); color: var(--cream); }
.step:nth-child(4) .step-badge { background: var(--violet); color: var(--cream); }

/* ---------- night band ---------- */
.night {
  position: relative;
  background: radial-gradient(120% 140% at 80% 0%, #3A2E8A 0%, var(--ink) 55%);
  color: var(--cream);
  padding: clamp(90px, 12vw, 150px) 0;
  overflow: hidden;
}
.night-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.star { transform-box: fill-box; transform-origin: center; animation: twinkle 3.2s ease-in-out infinite; }
.star.d2 { animation-delay: -.8s; }
.star.d3 { animation-delay: -1.6s; }
.star.d4 { animation-delay: -2.4s; }

.night-inner { position: relative; max-width: 900px; }
.night blockquote {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.01em;
}
.night blockquote span { color: var(--gold); font-style: italic; }
.night-sub { color: var(--lilac); font-weight: 500; }

/* ---------- round table ---------- */
.table-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(30px, 6vw, 80px);
  align-items: center;
}
.table-art svg { width: 100%; height: auto; }

.values { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.values li {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.values li:hover { transform: translateX(6px); box-shadow: 6px 4px 0 var(--ink); }
.values h3 { font-size: 1.18rem; margin-bottom: .2em; }
.values p { margin: 0; color: var(--ink-soft); font-size: .98rem; }
.chip {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 4px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  transform: rotate(45deg);
}
.chip-coral { background: var(--coral); }
.chip-green { background: var(--gum); }
.chip-gold { background: var(--gold); }
.chip-violet { background: var(--violet); }

/* ---------- contact ---------- */
.contact { padding-top: 0; }
.contact-card {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(24px, 5vw, 60px);
  align-items: center;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 32px;
  box-shadow: 10px 10px 0 var(--ink);
  padding: clamp(28px, 5vw, 64px);
}
.letter { width: 100%; max-width: 320px; margin: 0 auto; }
.letter-float { animation: bob 4s ease-in-out infinite; }
.contact-copy p { color: var(--ink-soft); font-size: 1.1rem; max-width: 34em; }

.contact-copy { min-width: 0; container-type: inline-size; }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 1.4rem; }
/* Sized to the column width so the address always stays on one line */
.email-link {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: min(2.1rem, 6cqi);
  white-space: nowrap;
  color: var(--violet);
  text-decoration: none;
  background: linear-gradient(var(--gold), var(--gold)) no-repeat left 92% / 100% .22em;
  transition: background-size .3s;
}
.email-link:hover { background-size: 100% .5em; }
.copy-btn.copied { background: var(--gum); color: var(--cream); }

/* ---------- footer ---------- */
.site-footer { color: var(--cream); }
.footer-hills { width: 100%; height: 80px; display: block; margin-bottom: -1px; }
.footer-inner { background: var(--ink); padding: 30px 0 34px; }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 248, 236, .15);
}
.footer-tag { color: var(--lilac); margin: .7rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
.footer-links a { text-decoration: none; opacity: .85; }
.footer-links a:hover { opacity: 1; color: var(--gold); }
.footer-bottom {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  font-size: .9rem;
  color: rgba(255, 248, 236, .6);
}
.footer-bottom p { margin: 0; }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- keyframes ---------- */
@keyframes drift   { from { transform: translateX(-18px); } to { transform: translateX(22px); } }
@keyframes pulse   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes bob     { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes flutter { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(-6deg) scaleX(.92); } }
@keyframes sway    { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.55); opacity: .5; } }
@keyframes flicker { 0%, 88%, 100% { fill: #FFD58A; } 90%, 94% { fill: #FFF3D6; } }
@keyframes ecg     { 0% { stroke-dashoffset: 520; opacity: 1; } 55% { stroke-dashoffset: 0; opacity: 1; } 85%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes dash    { to { stroke-dashoffset: -18; } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes beat    { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(.98); } 45% { transform: scale(1.08); } }
@keyframes ping    { 0% { box-shadow: 0 0 0 0 rgba(63, 143, 114, .6); } 80%, 100% { box-shadow: 0 0 0 10px rgba(63, 143, 114, 0); } }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 600px; margin: 0 auto; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 50px; }
  .step:nth-child(n) { margin-top: 0; }
  .quest-path { display: none; }
  .table-grid { grid-template-columns: 1fr; }
  .table-art { max-width: 460px; margin: 0 auto; }
  .contact-card { grid-template-columns: 1fr; text-align: center; }
  .contact-copy p { margin-inline: auto; }
  .email-row { justify-content: center; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 76px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    padding: 22px clamp(18px, 4vw, 40px) 28px;
    background: var(--paper);
    border-bottom: 3px solid var(--ink);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .nav-links.open { opacity: 1; transform: none; visibility: visible; }
  .nav-links a:not(.btn) { font-size: 1.15rem; }
}

@media (max-width: 620px) {
  .cards, .steps { grid-template-columns: 1fr; }
  .scribble { white-space: normal; }
  .contact-card { padding: 28px 18px; border-radius: 24px; }
}

@media (max-width: 360px) {
  .hero-actions .btn { font-size: .9rem; padding-inline: 1em; }
  .brand { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .ecg { stroke-dashoffset: 0; }
  .js .reveal { opacity: 1; transform: none; }
}
