/* ============================================================
   Cornerstone — warm-minimalist atelier, signed with pixel craft
   Plain CSS, no build. Two typefaces: Fraunces (serif) + Silkscreen (pixel).
   ============================================================ */

/* ---------- Fonts (self-hosted, OFL) ---------- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Silkscreen";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/silkscreen-400.woff2") format("woff2");
}
@font-face {
  font-family: "Silkscreen";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/silkscreen-700.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  --bone:      #f3ede3;
  --bone-deep: #ece2d2;
  --paper:     #f8f3ea;
  --sand:      #e0d5c3;
  --ink:       #26211c;
  --ink-2:     #5f5448;
  --ink-3:     #8a7e6e;
  --clay:      #c2613f;
  --clay-deep: #9e4427;
  --shadow:    #8a7e6e;
  --line:      rgba(38, 33, 28, 0.14);
  --line-soft: rgba(38, 33, 28, 0.08);

  --serif: "Fraunces", "Hoefler Text", Georgia, "Times New Roman", serif;
  --pixel: "Silkscreen", ui-monospace, "Courier New", monospace;

  --maxw: 1140px;
  --gutter: clamp(1.25rem, 5vw, 3.25rem);
  --pad-block: clamp(4.5rem, 11vh, 8.5rem);
  --bar-h: 3.6rem;                /* ~sticky top bar height; hero is pulled up under it */

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-optical-sizing: auto;
}

body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.09rem);
  line-height: 1.62;
  font-weight: 400;
  letter-spacing: 0.004em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
img[src$=".svg"], .pixelated { image-rendering: pixelated; }

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

::selection { background: var(--clay); color: var(--bone); }

:focus-visible {
  outline: 2.5px solid var(--clay-deep);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------- Paper grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.06'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- Shared layout ---------- */
.topbar, main, .footer { width: 100%; }

.band, .contact {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  scroll-margin-top: 5.5rem;
}

.eyebrow {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(0.6rem, 0.55rem + 0.2vw, 0.7rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay-deep);
  line-height: 1.5;
}

/* ---------- Wordmark lockup (Cornerstone + struck SaaS) ---------- */
.lockup {
  display: inline-flex;
  align-items: flex-start;
  white-space: nowrap;
}
.lockup__name {
  font-family: var(--serif);
  font-weight: 540;
  letter-spacing: -0.018em;
}
.lockup__saas {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 0.4em;
  color: var(--shadow);
  margin-left: 0.28em;
  margin-top: 0.12em;
  position: relative;
  letter-spacing: 0.01em;
}
.lockup__saas::after {            /* the strike */
  content: "";
  position: absolute;
  left: -0.14em;
  right: -0.14em;
  top: 50%;
  height: max(2px, 0.16em);
  background: var(--clay);
  transform: translateY(-50%) scaleX(1);
  transform-origin: left center;
}

.lockup--hero {
  /* desktop hits the 7rem cap; the gentler slope keeps it off the edge on ~320px phones */
  font-size: clamp(2.4rem, 0.9rem + 7.6vw, 7rem);
  line-height: 0.96;
  margin: 0.28em 0 0;
}
.lockup--hero .lockup__name { font-weight: 560; }
.lockup--hero .lockup__saas {
  font-size: 0.26em;
  margin-top: 0.55em;
  color: var(--ink-3);
}
.lockup--hero .lockup__saas::after { transform: translateY(-50%) scaleX(0); }

.lockup--sm { font-size: 1.12rem; }
.lockup--sm .lockup__saas { font-size: 0.46em; margin-top: 0.05em; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--gutter);
  background: color-mix(in srgb, var(--bone) 86%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease;
}
.topbar.is-scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bone) 94%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand__mark { width: 1.4em; height: auto; }

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 2rem);
  font-family: var(--pixel);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topnav a { color: var(--ink-2); transition: color 0.2s ease; }
.topnav a:hover { color: var(--ink); }
.topnav__cta {
  color: var(--clay-deep) !important;
  border-bottom: 2px solid var(--clay);
  padding-bottom: 2px;
}
.topnav__cta:hover { color: var(--ink) !important; }

/* ---------- Hero (full-bleed interactive tile field) ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  /* pulled up under the translucent sticky bar so the tile field owns the whole
     viewport (grid.js then sizes the cube to the edges, clearing the bar) */
  margin-top: calc(-1 * var(--bar-h));
  overflow: hidden;
  display: flex;
  align-items: flex-start;        /* copy pinned to the top; cube fills behind it */
}
/* the cornerstone as a full-screen tile field; grid.js centers the cube in it.
   Before JS / if canvas sampling is blocked, this CSS background shows the cube. */
.hero__field {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bone) url("assets/cube-tiles.png") center / auto clamp(220px, 76vmin, 820px) no-repeat;
  background-size: auto min(90svh, 94vw);   /* modern: fill the viewport; ignored where svh is unsupported */
  animation: fieldIn 1.1s var(--ease) both;
}
/* the legibility scrim now lives on .hero__copy::before — anchored to the copy
   block so it dims the cube only under the text (the old corner-glow had faded
   to transparent before it reached the lede). */
/* keeps the overlaid copy aligned with the bands below (shared max-width + gutter) */
.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(5.5rem, 16vh, 9.5rem) var(--gutter) var(--pad-block);
}
.hero__copy {
  position: relative;            /* anchors the scrim below */
  max-width: 40ch;
  /* a faint bone halo — belt-and-suspenders for any dark cube-outline pixel
     that pokes through the feathered edge of the scrim */
  text-shadow: 0 0 6px var(--bone), 0 0 2px var(--bone);
}
/* soft bone wash behind the copy. The lede crosses the cube's clay face, where
   the mid-brown text is only ~1.8:1 — this keeps the dark text on a bone
   backing, and feathers out so the cube is dimmed *only* under the copy. */
.hero__copy::before {
  content: "";
  position: absolute;
  z-index: -1;                   /* behind the text, above the tile field */
  /* vertical bleed lets the feather fall outside the glyphs; horizontal bleed is
     bounded (clamp) so the wash can't reach the viewport edge as a band on phones */
  inset: -1.4rem clamp(0.5rem, 4vw, 2.6rem) -2rem clamp(0.5rem, 4vw, 2.6rem);
  /* anchored low (toward the lede) — the big wordmark above sits on the light
     tiles and needs little help; the lede is what crosses the clay face */
  background: rgba(243, 237, 227, 0.82);   /* fallback: flat bone wash (= --bone @ 82%) where color-mix() is unsupported — keeps the lede legible */
  background: radial-gradient(125% 135% at 30% 60%,
    color-mix(in srgb, var(--bone) 93%, transparent) 0%,
    color-mix(in srgb, var(--bone) 82%, transparent) 46%,
    color-mix(in srgb, var(--bone) 50%, transparent) 70%,
    transparent 88%);
  pointer-events: none;
}
.hero__lede {
  margin-top: 1.5rem;
  font-size: clamp(1.12rem, 1rem + 0.7vw, 1.42rem);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: balance;
}
/* the wink, set directly beneath the hero wordmark */
.hero__wink {
  margin-top: 0.85rem;
  font-family: var(--pixel);
  font-size: clamp(0.6rem, 0.55rem + 0.2vw, 0.72rem);
  letter-spacing: 0.05em;
  color: var(--clay-deep);
}

/* the live tile surface — grid.js fills it with .pixel-cell tiles */
.pixel-surface { display: grid; }
.pixel-cell { box-shadow: inset 0 0 0 1px rgba(38, 33, 28, 0.05); }

/* ---------- Bands ---------- */
.band {
  padding-block: var(--pad-block);
  /* crisp pixel-dotted divider instead of a hairline rule */
  background-image: repeating-linear-gradient(90deg, var(--ink-3) 0 3px, transparent 3px 9px);
  background-repeat: no-repeat;
  background-position: top left;
  background-size: 100% 3px;
}
.band__head { max-width: 32ch; margin-bottom: clamp(2.2rem, 5vw, 3.6rem); }
.band__title {
  margin-top: 0.7rem;
  font-weight: 500;
  font-size: clamp(1.7rem, 1.1rem + 2.6vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

/* capabilities — editorial 2-col list */
.capabilities {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(2rem, 4.5vw, 3.4rem) clamp(2.4rem, 6vw, 5rem);
}
.cap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  /* a short, crisp pixel-dot tick instead of a boxed cell */
  background-image: repeating-linear-gradient(90deg, var(--ink-3) 0 3px, transparent 3px 6px);
  background-repeat: no-repeat;
  background-position: top left;
  background-size: 2.2rem 3px;
}
.cap__no {
  font-family: var(--pixel);
  font-size: 0.72rem;
  color: var(--clay-deep);
  letter-spacing: 0.05em;
}
.cap__title {
  font-weight: 560;
  font-size: 1.32rem;
  letter-spacing: -0.01em;
}
.cap__body { color: var(--ink-2); max-width: 34ch; }

/* approach — three open steps that build up */
.band--approach .band__head { margin-bottom: clamp(1.8rem, 4vw, 3rem); }
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2rem, 4.5vw, 3.4rem);
}
.step { display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; }
.step__icon {
  height: clamp(40px, 6vw, 56px);
  width: auto;
  margin-bottom: 0.4rem;
}
.step__no {
  font-family: var(--pixel);
  font-size: 0.66rem;
  color: var(--clay-deep);
  letter-spacing: 0.1em;
}
.step__title { font-weight: 560; font-size: 1.28rem; }
.step__body { color: var(--ink-2); }

/* ---------- Contact ---------- */
.contact {
  padding-block: clamp(5rem, 14vh, 10rem);
  /* crisp pixel-dotted divider */
  background-image: repeating-linear-gradient(90deg, var(--ink-3) 0 3px, transparent 3px 9px);
  background-repeat: no-repeat;
  background-position: top left;
  background-size: 100% 3px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact__title {
  margin: 0.8rem 0 2.2rem;
  font-weight: 500;
  font-size: clamp(2.1rem, 1.2rem + 4vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
  max-width: 18ch;
  text-wrap: balance;
}
/* ---------- Buttons (chunky pixel-offset shadow) ---------- */
.btn {
  --offset: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.02rem;
  letter-spacing: 0.002em;
  color: var(--bone);
  background: var(--clay);
  padding: 0.78em 1.35em;
  border: 2px solid var(--ink);
  box-shadow: var(--offset) var(--offset) 0 var(--ink);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.2s ease;
}
.btn:hover {
  background: var(--clay-deep);
  transform: translate(-2px, -2px);
  box-shadow: calc(var(--offset) + 2px) calc(var(--offset) + 2px) 0 var(--ink);
}
.btn:active {
  transform: translate(var(--offset), var(--offset));
  box-shadow: 0 0 0 var(--ink);
}
.btn__arrow { width: 0.92em; height: auto; transition: transform 0.2s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn--lg { --offset: 5px; font-size: 1.18rem; padding: 0.92em 1.7em; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(2.4rem, 5vw, 3.6rem) var(--gutter) clamp(3rem, 6vw, 4rem);
  border-top: 1px solid var(--line);
}
.footer__row {
  display: flex;
  align-items: center;
  gap: 0.9rem 1.1rem;
  flex-wrap: wrap;
}
.footer__row + .footer__row { margin-top: 1.1rem; }
.footer__row--fine {
  font-family: var(--pixel);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.footer__sep { color: var(--line); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 10;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--pixel);
  font-size: 0.7rem;
  padding: 0.6rem 0.9rem;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0.75rem; }

/* ============================================================
   Motion
   ============================================================ */

/* hero entrance: staggered rise */
.reveal { opacity: 0; animation: rise 0.85s var(--ease) both; }
.reveal[data-reveal="1"] { animation-delay: 0.05s; }
.reveal[data-reveal="2"] { animation-delay: 0.18s; }
.reveal[data-reveal="3"] { animation-delay: 0.34s; }
.reveal[data-reveal="4"] { animation-delay: 0.5s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* the tile field fades in (opacity only — no transform, so grid.js owns layout) */
@keyframes fieldIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* the joke lands: strike draws across after the wordmark settles */
.lockup--hero .lockup__saas::after {
  animation: strike 0.5s 0.85s var(--ease) forwards;
}
@keyframes strike {
  from { transform: translateY(-50%) scaleX(0); }
  to   { transform: translateY(-50%) scaleX(1); }
}

/* scroll reveals (only armed once JS confirms support) */
.js .reveal-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.js .reveal-up.is-visible { opacity: 1; transform: none; }
/* stagger children within a group */
.js .capabilities .cap.is-visible,
.js .steps .step.is-visible { transition-delay: var(--stagger, 0s); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .hero__field { animation: none !important; opacity: 1 !important; }
  .lockup--hero .lockup__saas::after { animation: none; transform: translateY(-50%) scaleX(1); }
  .js .reveal-up { opacity: 1; transform: none; transition: none; }
  .btn, .btn__arrow { transition: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 880px) {
  .hero__copy { max-width: 100%; }
}

@media (max-width: 720px) {
  .topnav { gap: 1rem; }
  .topnav a:not(.topnav__cta) { display: none; }
  .capabilities { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 1.8rem; }
}

@media (max-width: 380px) {
  .lockup--sm .lockup__name { font-size: 0.95em; }
}
