/* 1Helm docs & product pages — hand-drawn paper design shared with the storybook and manual */

@font-face {
  font-family: 'Virgil';
  src: url('/assets/fonts/Virgil.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fdfaf3;
  --ink: #2a2a2e;
  --ink-soft: #3d3d44;
  --muted: #6b6b72;
  --faint: #85857e;
  --blue: #3b6fd4;
  --blue-deep: #2c56a8;
  --yellow: #f6c945;
  --red: #d9534f;
  --card: #fffdf6;
  --shadow: rgba(60, 50, 20, 0.12);
  --wobble: 255px 22px 225px 22px / 22px 225px 22px 255px;
  --wobble-sm: 225px 16px 255px 16px / 16px 255px 16px 225px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: 'Virgil', 'Segoe Print', 'Comic Sans MS', cursive;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--blue-deep); }
img { max-width: 100%; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--card);
  border: 2.5px solid var(--blue);
  border-radius: var(--wobble-sm);
  padding: 0.3em 0.9em;
  z-index: 200;
}
.skip-link:focus { left: 12px; }

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(253, 250, 243, 0.92);
  backdrop-filter: blur(4px);
  border-bottom: 2.5px solid rgba(42, 42, 46, 0.15);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem clamp(1rem, 4vw, 2.5rem);
}
.brand {
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand img { height: 38px; width: 38px; border-radius: 9px; object-fit: cover; }
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.3rem, 1.5vw, 1rem);
}
.site-nav a {
  color: var(--blue-deep);
  text-decoration: none;
  font-size: 1.05rem;
  padding: 0.15em 0.6em;
  border: 2px solid transparent;
  border-radius: var(--wobble-sm);
}
.site-nav a:hover { border-color: var(--blue); background: var(--card); }
.site-nav a[aria-current="page"] { border-color: var(--blue); background: rgba(246, 201, 69, 0.25); color: var(--ink); }
.site-nav .nav-download {
  border: 2.5px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 3px 6px var(--shadow);
  transform: rotate(-1deg);
}
.site-nav .nav-download:hover { background: var(--yellow); border-color: var(--ink); transform: rotate(-1deg) scale(1.05); }
.nav-toggle { display: none; }

/* ---- footer ---- */
.site-footer {
  border-top: 2.5px solid rgba(42, 42, 46, 0.15);
  margin-top: 4rem;
  padding: 2.2rem clamp(1rem, 4vw, 2.5rem) 1.6rem;
}
.footer-lead { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.6rem; }
.footer-lead img { height: 52px; width: 52px; border-radius: 11px; object-fit: cover; }
.footer-lead strong { display: block; font-weight: normal; font-size: 1.3rem; }
.footer-lead span { color: var(--muted); font-size: 1rem; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.4rem;
  max-width: 980px;
  margin-bottom: 1.8rem;
}
.footer-grid h2 { font-weight: normal; font-size: 1.05rem; color: var(--faint); margin: 0 0 0.4rem; }
.footer-grid a { display: block; text-decoration: none; font-size: 1rem; padding: 0.12em 0; }
.footer-grid a:hover { text-decoration: underline; }
.footer-floor {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 0.95rem;
  border-top: 2px dashed rgba(42, 42, 46, 0.15);
  padding-top: 1rem;
}
.footer-floor a { color: var(--blue-deep); text-decoration: none; }
.footer-floor a:hover { text-decoration: underline; }

/* ---- shared content ---- */
main { max-width: 1080px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 2rem; }

h1, h2, h3 { font-weight: normal; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); margin: 1.8rem 0 0.6rem; }
h3 { font-size: 1.25rem; color: var(--blue-deep); margin: 1.3rem 0 0.4rem; }
h1 em, h2 em {
  font-style: normal;
  background: linear-gradient(180deg, transparent 58%, rgba(246, 201, 69, 0.55) 58%, rgba(246, 201, 69, 0.55) 92%, transparent 92%);
  padding: 0 0.1em;
}
p, li { color: var(--ink-soft); }
p { margin-bottom: 0.8rem; max-width: 66ch; }
ul, ol { margin: 0 0 0.9rem 1.4rem; max-width: 62ch; }
li { margin-bottom: 0.35rem; }
strong { font-weight: normal; color: var(--ink); }
p strong, li strong { color: var(--blue-deep); }

.eyebrow {
  display: inline-block;
  font-size: 1rem;
  color: var(--blue-deep);
  letter-spacing: 0.06em;
  padding: 0.12em 0.7em;
  border: 2.5px solid var(--blue);
  border-radius: var(--wobble-sm);
  background: rgba(246, 201, 69, 0.25);
  transform: rotate(-1.2deg);
  margin-bottom: 0.9rem;
}
.live-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50% 45% 55% 50%;
  background: #5a9e4b;
  margin-right: 0.35em;
}

.page-hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.page-hero p { margin: 0.8rem auto 0; }
.page-hero .eyebrow { margin-bottom: 0.6rem; }

.intro { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.micro { font-size: 0.95rem; color: var(--faint); max-width: 60ch; }

.section { margin: 2.2rem 0; }
.prose, .prose-wide { max-width: 760px; }
.prose-wide { max-width: 860px; margin: 0 auto; }

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(59, 111, 212, 0.1);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  color: var(--blue-deep);
}

pre {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 200px 14px 180px 14px / 14px 22px 14px 20px;
  padding: 0.9rem 1.2rem;
  margin: 0.9rem 0;
  overflow-x: auto;
  max-width: 760px;
  box-shadow: 0 4px 8px var(--shadow);
}
pre code { background: none; padding: 0; color: var(--ink); }
pre.diagram, .diagram { white-space: pre; color: var(--ink-soft); }

table { border-collapse: collapse; margin: 1rem 0; font-size: 1rem; }
th, td { border: 2px solid rgba(42, 42, 46, 0.35); padding: 0.45rem 0.8rem; text-align: left; }
th { background: rgba(246, 201, 69, 0.25); font-weight: normal; }

/* ---- buttons ---- */
.button-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin: 1.4rem 0 0.6rem; align-items: center; }
.button {
  display: inline-block;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.4em 1.1em;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--card);
  box-shadow: 0 4px 8px var(--shadow);
  transform: rotate(0.6deg);
  transition: transform 0.15s ease;
}
.button:hover { transform: rotate(0.6deg) scale(1.05); }
.button.primary { background: var(--yellow); transform: rotate(-0.8deg); }
.button.primary:hover { transform: rotate(-0.8deg) scale(1.05); }
.button.quiet { border-color: rgba(42, 42, 46, 0.4); color: var(--muted); box-shadow: none; }

/* ---- code cards ---- */
.code-card {
  max-width: 760px;
  margin: 1rem 0;
  border: 2.5px solid var(--ink);
  border-radius: 18px 22px 16px 24px;
  background: var(--card);
  box-shadow: 0 4px 8px var(--shadow);
  overflow: hidden;
}
.code-card .code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1rem;
  border-bottom: 2.5px solid rgba(42, 42, 46, 0.25);
  font-size: 0.95rem;
  color: var(--faint);
}
.code-card .code-head button {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--blue-deep);
  background: none;
  border: 2px solid var(--blue);
  border-radius: var(--wobble-sm);
  padding: 0.1em 0.7em;
  cursor: pointer;
}
.code-card .code-head button:hover { background: rgba(59, 111, 212, 0.08); }
.code-card pre { border: none; border-radius: 0; box-shadow: none; margin: 0; }

/* ---- docs layout ---- */
.docs-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-top: 1rem;
}
.docs-nav {
  position: sticky;
  top: 82px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
}
.docs-nav strong { font-weight: normal; font-size: 0.95rem; color: var(--faint); margin-bottom: 0.5rem; }
.docs-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.22em 0.6em;
  border-left: 3px solid rgba(59, 111, 212, 0.25);
  margin-bottom: 2px;
}
.docs-nav a:hover { color: var(--blue-deep); border-left-color: var(--blue); background: rgba(59, 111, 212, 0.06); }
.docs-nav a[aria-current="page"] { color: var(--blue-deep); border-left-color: var(--blue); background: rgba(246, 201, 69, 0.2); }

.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.4rem 0;
}
.doc-card-grid a {
  text-decoration: none;
  border: 2.5px solid var(--blue);
  border-radius: 18px 22px 16px 24px;
  background: var(--card);
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 8px var(--shadow);
  transition: transform 0.15s ease;
}
.doc-card-grid a:hover { transform: scale(1.02) rotate(-0.4deg); }
.doc-card-grid strong { display: block; font-weight: normal; color: var(--blue-deep); font-size: 1.15rem; margin-bottom: 0.2rem; }
.doc-card-grid span { color: var(--muted); font-size: 0.98rem; }

/* ---- FAQ ---- */
.faq-list { max-width: 760px; margin: 1rem auto 0; }
.faq-list details {
  border: 2.5px solid var(--blue);
  border-radius: var(--wobble);
  background: var(--card);
  padding: 0.7rem 1.1rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 4px 8px var(--shadow);
}
.faq-list summary { cursor: pointer; font-size: 1.1rem; color: var(--blue-deep); }
.faq-list details[open] summary { margin-bottom: 0.5rem; }
.faq-list details p { font-size: 1rem; }

/* ---- manifesto ---- */
.manifesto-hero h1 { font-size: clamp(2.3rem, 6vw, 4rem); }
.manifesto-lines { max-width: 720px; margin: 0 auto; padding: 1rem 0 2rem; }
.manifesto-lines p { font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.6; margin-bottom: 1.3rem; max-width: none; }
.manifesto-lines strong { color: var(--blue-deep); }
.manifesto-close {
  font-size: clamp(1.4rem, 3vw, 1.9rem) !important;
  color: var(--ink) !important;
  text-align: center;
  transform: rotate(-1deg);
  margin-top: 2rem;
}

/* ---- architecture diagram ---- */
.architecture-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
}
.architecture-diagram > div {
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  background: var(--card);
  padding: 0.8rem 1.4rem;
  text-align: center;
  box-shadow: 0 4px 8px var(--shadow);
}
.architecture-diagram span { display: block; font-size: 0.95rem; color: var(--faint); }
.architecture-diagram strong { font-weight: normal; color: var(--ink); }
.architecture-diagram small { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.4; margin-top: 0.3rem; }
.arch-captain { transform: rotate(-1deg); }
.arch-skipper { border-color: var(--blue) !important; transform: rotate(0.8deg); }
.arch-skipper span { color: var(--blue-deep); }
.arch-residents {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: 100%;
  max-width: 820px;
}
.arch-residents > div {
  border: 2.5px dashed var(--blue);
  border-radius: 14px 18px 12px 20px;
  background: rgba(59, 111, 212, 0.05);
  padding: 0.7rem 0.8rem;
  text-align: center;
}
.arch-residents span { color: var(--blue-deep); }

/* ---- product shots & cta ---- */
.product-shot { margin: 1.6rem auto; max-width: 900px; text-align: center; }
.product-shot img {
  width: 100%;
  border: 2.5px solid rgba(42, 42, 46, 0.3);
  border-radius: 14px 18px 12px 20px;
  box-shadow: 0 8px 16px var(--shadow);
}
.product-shot figcaption { color: var(--muted); font-size: 0.98rem; margin-top: 0.5rem; }

.cta {
  text-align: center;
  margin: 3rem auto 1rem;
  padding: 2rem 1.5rem;
  max-width: 780px;
  border: 2.5px dashed var(--blue);
  border-radius: 22px 28px 20px 30px;
  background: rgba(59, 111, 212, 0.04);
}
.cta .button-row { justify-content: center; }
.cta h2 { margin-top: 0.4rem; }
.cta p { margin-left: auto; margin-right: auto; }

/* ---- error page ---- */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page p { margin-left: auto; margin-right: auto; }
.error-page .button-row { justify-content: center; }

/* ---- reveal ---- */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
  [data-reveal][data-visible] { opacity: 1; transform: none; }
}

/* ---- mobile ---- */
@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: auto;
    background: none;
    border: 2.5px solid var(--blue);
    border-radius: var(--wobble-sm);
    padding: 10px 12px;
    cursor: pointer;
  }
  .nav-toggle span { display: block; width: 22px; height: 2.5px; background: var(--blue-deep); border-radius: 2px; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--paper);
    border-bottom: 2.5px solid rgba(42, 42, 46, 0.15);
    padding: 0.6rem 1rem 1rem;
    gap: 0.3rem;
  }
  .site-nav[data-open] { display: flex; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  pre, .code-card { max-width: 100%; }
  .docs-nav {
    position: static;
    max-height: none;
    border: 2.5px dashed var(--blue);
    border-radius: 16px;
    padding: 0.9rem;
    background: rgba(59, 111, 212, 0.05);
    margin-bottom: 1rem;
    display: block;
  }
  .docs-nav a { display: inline-block; border-left: none; padding: 0.15em 0.5em; }
  .footer-floor { flex-direction: column; }
}

/* simple centered footer shared with the manual */
.site-footer.simple {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  color: #85857e;
  font-size: 1rem;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
}
.site-footer.simple a { color: var(--blue-deep); text-decoration: none; }
.site-footer.simple a:hover { text-decoration: underline; }
