/* ==========================================================================
   The Five Gallon x Alchemy — shared token layer + components
   Tokens: design/website-design/alchemy/tokens.json (alchemy.digital scrape)
   Fonts: Inter Tight (PP Neue Montreal sub) + Newsreader italic (Reckless sub)
   ========================================================================== */

:root {
  --ink: #111111;
  --canvas: #F8F8F8;
  --white: #FFFFFF;
  --grey: #888888;
  --green: #AFFA64;
  --green-hover: #A2F94B;
  --stage: #111111;
  --ink-05: rgba(17, 17, 17, 0.05);
  --ink-10: rgba(17, 17, 17, 0.10);
  --ink-20: rgba(17, 17, 17, 0.20);
  --on-ink: #FFFFFF;
  --btn-hover-dark: #040404;

  --sans: 'PP Neue Montreal', 'Inter Tight', 'Helvetica Neue', sans-serif;
  --serif: 'Reckless Neue', 'Newsreader', serif;

  --massive: clamp(40px, 6.5vw, 125px);
  --huge: clamp(29px, 4.4vw, 83px);
  --large: clamp(25px, 3.4vw, 63px);
  --med: clamp(21px, 2.2vw, 38px);
  --reg: clamp(16px, 1.5vw, 25px);
  --body: clamp(16px, 1.3vw, 20px);
  --label: 14px;

  --gutter: max(2.5vw, 16px);
  --section: clamp(4.5rem, 9vw, 12rem);
  --half-section: calc(var(--section) / 2);
  --header-h: 4.5rem;

  --snap: cubic-bezier(.83, 0, .17, 1);
  --glide: cubic-bezier(.22, 1, .36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: var(--body);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

/* thin scrollbar, alchemy-style */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.5); border-radius: 10px; }

::selection { background: var(--ink); color: var(--on-ink); }

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

a { color: inherit; text-decoration: none; }

em, .serif {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

h1, h2, h3, h4 { font-weight: 500; }
h1 { font-size: var(--huge); line-height: 1.0; }
h2 { font-size: var(--large); line-height: 1.0; }
h3 { font-size: var(--med); font-weight: 400; line-height: 1.1; }
h4 { font-size: var(--reg); font-weight: 400; line-height: 1.2; }

.display-massive { font-size: var(--massive); font-weight: 500; line-height: 0.9; }

.label {
  font-size: var(--label);
  line-height: 1.2;
  display: block;
}
.label--ruled {
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--ink);
}
.meta { color: var(--grey); font-size: var(--label); }

.wrap { padding-left: var(--gutter); padding-right: var(--gutter); }

.section { padding-top: var(--section); padding-bottom: var(--section); }
.section--half { padding-top: var(--half-section); padding-bottom: var(--half-section); }

/* first band of every page (the masthead above it is in-flow) */
.hero, .pagehead {
  padding-top: var(--half-section);
  padding-bottom: var(--half-section);
}

/* ==========================================================================
   Masthead — the tall at-rest header, alchemy.digital layout:
   big stencil mark left, giant wordmark right, nav under the wordmark,
   full-width hairline, then the breadcrumb label.
   ========================================================================== */

.masthead { padding: 1.25rem var(--gutter) 0; }
.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}
.mark-cycler.mark-cycler--big {
  width: clamp(96px, 12vw, 170px);
  height: clamp(96px, 12vw, 170px);
  color: var(--ink);
}
.masthead__right { margin-left: auto; text-align: right; }
.masthead__wordmark {
  font-size: clamp(44px, 8vw, 120px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.masthead__nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.1rem;
}
.masthead__nav a {
  font-size: clamp(16px, 1.2vw, 18px);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s var(--snap);
}
.masthead__nav a:hover { border-color: var(--ink); }
.masthead__nav a[aria-current="page"] { border-color: var(--ink); }
.masthead__nav .btn {
  border-bottom: none;
  padding: 0.45em 0.85em;
}
.masthead__nav .btn:hover { border-color: transparent; }
.masthead__rule {
  border-top: 1px solid var(--ink);
  margin: 1.5rem calc(-1 * var(--gutter)) 0;
}
.masthead__crumb { font-size: var(--reg); padding: 1rem 0 0; font-weight: 400; }

@media (max-width: 700px) {
  .masthead__top { flex-direction: column; align-items: flex-start; }
  .masthead__right { margin-left: 0; text-align: left; }
  .masthead__nav { justify-content: flex-start; }
}

/* label-left / content-right split */
.split {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 4fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 700px) {
  .split { grid-template-columns: 1fr; gap: 1.25rem; }
}

.measure { max-width: 34em; }
.measure-wide { max-width: 60rem; }

hr.rule { border: 0; border-top: 1px solid var(--ink); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: var(--body);
  font-weight: 400;
  line-height: 1.2;
  padding: 0.45em 0.85em;
  border: none;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  background: var(--ink);
  color: var(--on-ink);
  transition: background-color .15s var(--snap), color .15s var(--snap);
}
.btn:hover { background: var(--btn-hover-dark); }

.btn--green { background: var(--green); color: var(--ink); }
.btn--green:hover { background: var(--green-hover); }

.btn--ghost { background: var(--ink-10); color: var(--ink); }
.btn--ghost:hover { background: var(--ink-20); }

.btn--on-stage { background: var(--white); color: var(--ink); }
.btn--on-stage:hover { background: var(--canvas); }

/* ==========================================================================
   Linkline — 1px underline that swipes through the word on hover
   ========================================================================== */

.linkline {
  background-image: linear-gradient(to right, currentColor 0 33.3%, transparent 33.3% 66.6%, currentColor 66.6% 100%);
  background-size: 300% 0.05em;
  background-repeat: no-repeat;
  background-position: 100% bottom;
  padding-bottom: 0.15em;
  transition: background-position 1s var(--glide);
}
.linkline:hover { background-position: 0 bottom; }

/* ==========================================================================
   The green page-edge frame (thin band peeking around the canvas)
   ========================================================================== */

.edge-frame {
  position: fixed;
  inset: 0;
  border: 3px solid var(--green);
  pointer-events: none;
  z-index: 90;
}

/* ==========================================================================
   Fixed chrome: mark top-left, links top-right, chat pin bottom-left.
   Content scrolls underneath; legibility via mix-blend-mode: difference
   (white chrome reads as ink on canvas, white on the dark stage).
   ========================================================================== */

.chrome { position: fixed; z-index: 60; }

/* the condensed chrome only appears once the masthead has scrolled away */
.chrome--mark, .chrome--links, .chrome--cta, .chrome--toggle {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .3s var(--snap), transform .3s var(--snap);
}
body.is-scrolled .chrome--mark,
body.is-scrolled .chrome--links,
body.is-scrolled .chrome--cta,
body.is-scrolled .chrome--toggle {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.chrome--mark {
  top: 14px;
  left: var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  mix-blend-mode: difference;
  color: #EEEEEE; /* difference vs #F8F8F8 -> near-ink; vs #111 -> near-white */
}
.chrome__wordmark { font-size: var(--label); line-height: 1.1; }

/* the cycling stencil mark, alchemy-style */
.mark-cycler {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
}
.mark-cycler svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.mark-cycler svg.is-on { opacity: 1; }
.mark-cycler [stroke] { stroke: currentColor; }

/* accent marks: rationed pail + badge stamps, injected by main.js from
   logo-variants.js (see design/logo-lab/v6/ship.py). Ink by default,
   white on the dark stage. */
.mark-accent {
  display: inline-block;
  width: 34px;
  height: 34px;
  vertical-align: middle;
  margin-left: 0.6rem;
  color: var(--ink);
}
.split > .mark-accent { grid-column: 1; grid-row: 2; margin: 0.35rem 0 0; }
.mark-accent svg { display: block; width: 100%; height: 100%; }
.mark-accent--seal { width: 76px; height: 76px; margin-top: 0.75rem; }
.footer .mark-accent { color: #ffffff; }


.chrome--links {
  top: 0;
  right: calc(var(--gutter) + 7.5rem);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.75rem;
  mix-blend-mode: difference;
  color: #EEEEEE;
}
.chrome--links a {
  font-size: var(--label);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s var(--snap);
}
.chrome--links a:hover { border-color: currentColor; }
.chrome--links a[aria-current="page"] { border-color: currentColor; }

.chrome--cta {
  top: 1.35rem;
  right: var(--gutter);
  font-size: var(--label);
  border: 1px solid var(--canvas); /* invisible on canvas, defines it on the stage */
}

.chrome--toggle {
  display: none;
  top: 1.55rem;
  right: var(--gutter);
  font-family: var(--sans);
  font-size: var(--label);
  background: none;
  border: none;
  border-bottom: 1px solid currentColor;
  padding: 0 0 2px;
  cursor: pointer;
  mix-blend-mode: difference;
  color: #EEEEEE;
}

/* the scroll-triggered hand-raiser, pinned bottom-left */
.chrome--chat {
  bottom: 1.25rem;
  left: var(--gutter);
  font-size: var(--reg);
  mix-blend-mode: difference;
  color: #EEEEEE;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .3s var(--snap), transform .3s var(--snap);
}
.chrome--chat.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.chrome--chat:hover em { text-decoration: underline; text-underline-offset: 0.15em; }

@media (max-width: 860px) {
  .mark-cycler { width: 40px; height: 40px; }
  .chrome--toggle { display: block; position: fixed; z-index: 61; }
  .chrome--cta { right: calc(var(--gutter) + 4.25rem); }
  .chrome--links {
    display: none;
  }
  .chrome--links.is-open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    padding: calc(var(--header-h) + 0.5rem) var(--gutter) 1.5rem;
    background: var(--canvas);
    color: var(--ink);
    mix-blend-mode: normal;
    border-bottom: 1px solid var(--ink);
    z-index: 59;
  }
}

/* ==========================================================================
   Numbered editorial index (the house way to present services)
   Big sentence-case rows on full-width 1px hairlines.
   ========================================================================== */

.index { border-bottom: 1px solid var(--ink); }
.index__row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55em 0;
  border-top: 1px solid var(--ink);
}
.index__num { font-size: var(--label); }
.index__title {
  font-size: var(--huge);
  font-weight: 500;
  line-height: 1.0;
}
a.index__row:hover .index__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.index__meta {
  font-size: var(--label);
  text-align: right;
  color: var(--ink);
}
.index__meta .meta { display: block; margin-top: 0.35em; }
@media (max-width: 700px) {
  .index__row { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .index__meta { grid-column: 2; text-align: left; }
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: block; margin-bottom: 1.5rem; }
.field > span {
  display: block;
  font-size: var(--label);
  margin-bottom: 0.5rem;
}
input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], select, textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: var(--body);
  color: var(--ink);
  background: var(--ink-05);
  border: 1px solid var(--ink-05);
  border-radius: 0.25em;
  padding: 1em;
  box-shadow: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 7em; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
}
::placeholder { color: var(--grey); }

/* ==========================================================================
   Marquee — between last module and footer
   ========================================================================== */

.marquee {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--ink);
  padding: 1.1rem 0;
  background: var(--canvas);
}
.marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  padding-right: 2.5rem;
  animation: marquee 28s linear infinite;
}
.marquee__item { font-size: 28px; font-weight: 400; }
.marquee__glyph svg { width: 22px; height: 27px; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* ==========================================================================
   Footer — the dark stage, a destination
   ========================================================================== */

.footer {
  background: var(--stage);
  color: var(--on-ink);
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: var(--half-section);
  padding-bottom: 2rem;
}
@media (min-width: 1200px) { .footer { min-height: 90vh; } }

.footer__call {
  font-size: var(--massive);
  font-weight: 500;
  line-height: 0.9;
  color: var(--on-ink);
  display: inline-block;
  margin: var(--half-section) 0;
}
.footer__call em { display: inline; }

.footer__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2.5rem;
  margin-bottom: var(--half-section);
}
.footer__col .label {
  color: var(--on-ink);
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--on-ink);
  margin-bottom: 1em;
}
.footer__col a, .footer__col p {
  display: block;
  font-size: var(--label);
  color: var(--on-ink);
  margin-bottom: 0.75em;
}
.footer__col a:hover { color: var(--green); }

.footer__legal {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: var(--label);
  color: var(--grey);
}

/* white linkline for the stage */
.footer .linkline {
  background-image: linear-gradient(to right, currentColor 0 33.3%, transparent 33.3% 66.6%, currentColor 66.6% 100%);
}

/* ==========================================================================
   Newsletter intake — footer strip + delayed soft panel
   Scaffolding only; copy lives in newsletter.js (COPY). Provider via /api/newsletter.
   Alchemy: 0 radius, no shadow, one lime CTA, sentence case.
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nl-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem 2.5rem;
  margin-bottom: var(--half-section);
  padding-bottom: var(--half-section);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
@media (min-width: 800px) {
  .nl-footer {
    grid-template-columns: 1.2fr 1fr;
    align-items: end;
  }
}

.nl-footer .label {
  color: var(--on-ink);
  display: inline-block;
  border-bottom: 1px solid var(--on-ink);
  padding-bottom: 0.6em;
  margin-bottom: 1em;
}

.nl-footer__headline {
  font-size: var(--reg);
  font-weight: 500;
  line-height: 1.15;
  color: var(--on-ink);
  margin-bottom: 0.5em;
  max-width: 22ch;
}

.nl-footer__sub {
  font-size: var(--label);
  color: var(--grey);
  line-height: 1.35;
  max-width: 36ch;
}

.nl-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.nl-form--panel {
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.nl-form__email,
.nl-form__name {
  width: 100%;
  font-family: var(--sans);
  font-size: var(--body);
  color: var(--ink);
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.9em 1em;
  box-shadow: none;
  appearance: none;
}

.nl-form__email:focus,
.nl-form__name:focus {
  outline: none;
  border-color: var(--green);
}

.nl-form__btn {
  white-space: nowrap;
  border-radius: 0;
}

.nl-form__note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--grey);
  line-height: 1.35;
}

.nl-form__msg {
  grid-column: 1 / -1;
  font-size: var(--label);
  color: var(--on-ink);
  line-height: 1.35;
  margin-top: 0.25rem;
}

.nl-form--panel .nl-form__msg { color: var(--ink); }

.nl-form__msg.is-error { color: #e85d4c; }

.nl-form.is-done .nl-form__btn { opacity: 0.7; pointer-events: none; }

/* Soft bottom panel — preloaded, opens only after engagement */
.nl-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  pointer-events: none;
  transform: translateY(110%);
  transition: transform 0.32s var(--glide);
}

.nl-panel.is-open {
  pointer-events: auto;
  transform: translateY(0);
}

.nl-panel__inner {
  margin: 0 auto;
  max-width: 28rem;
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-bottom: none;
  border-radius: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  position: relative;
  box-shadow: none;
}

@media (min-width: 600px) {
  .nl-panel__inner {
    margin-right: var(--gutter);
    margin-left: auto;
  }
}

.nl-panel .label {
  display: inline-block;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.5em;
  margin-bottom: 0.85em;
}

.nl-panel__headline {
  font-size: var(--reg);
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 0.5em;
}

.nl-panel__sub {
  font-size: var(--label);
  color: var(--grey);
  line-height: 1.4;
  margin-bottom: 1.1rem;
}

.nl-panel__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-family: var(--sans);
}

.nl-panel__close:hover { color: var(--grey); }

.nl-panel__skip {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: none;
  border: 0;
  font-family: var(--sans);
  font-size: var(--label);
  color: var(--grey);
  cursor: pointer;
  text-align: center;
  padding: 0.4rem;
}

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

.nl-form--panel .nl-form__email,
.nl-form--panel .nl-form__name {
  background: var(--ink-05);
  border-color: var(--ink-05);
}

.nl-form--panel .nl-form__email:focus,
.nl-form--panel .nl-form__name:focus {
  border-color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .nl-panel { transition: none; }
}

/* ==========================================================================
   Entrance
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .enter {
    opacity: 0;
    transform: translateY(20px);
    animation: enter 0.45s var(--glide) forwards;
  }
  @keyframes enter {
    to { opacity: 1; transform: none; }
  }
}
