/* Ensalvo — ensalvo.com */

/* Self-hosted fonts (SIL Open Font License, see assets/fonts/OFL-*.txt) */
@font-face {
  font-family: "Ibarra Real Nova";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/ibarra-real-nova-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Ibarra Real Nova";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/ibarra-real-nova-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  --paper: #FAF6F0;
  --paper-deep: #F2EADD;
  --sheet: #FFFDF9;
  --ink: #1F2A37;
  --ink-soft: #55606C;
  --ink-faint: #8C939B;
  --hairline: rgba(31, 42, 55, 0.12);
  --terracotta: #C8553D;
  --terracotta-deep: #B4472F;
  --saffron: #E9A23B;
  --saffron-light: #F3BD66;
  --sea: #2F6F8F;
  --sea-deep: #275E7A;

  --serif: "Ibarra Real Nova", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4.5vw, 64px);
  --header-h: 76px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --card-h: clamp(240px, 38svh, 400px);
  --card-w: calc(var(--card-h) * 0.76);
  --link-w: clamp(56px, 8vw, 112px);
  --anchor: 0.64;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: rgba(31, 42, 55, 0.28) var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--terracotta);
  overflow-x: clip;
}

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

img, svg { display: block; max-width: 100%; }
p, h1, h2, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 4px;
  border-radius: 6px;
}

.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease-out);
}
.skip:focus-visible { transform: none; }

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

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250, 246, 240, 0);
  box-shadow: 0 1px 0 rgba(31, 42, 55, 0);
  transition: background-color 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.site-header.is-scrolled {
  background: rgba(250, 246, 240, 0.94);
  box-shadow: 0 1px 0 var(--hairline);
}

.brand { display: block; border-radius: 8px; }
.brand img { width: clamp(120px, 11vw, 150px); height: auto; }

.lang {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(31, 42, 55, 0.06);
}
.lang__btn {
  appearance: none;
  border: 0;
  margin: 0;
  min-width: 44px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: 700 0.8125rem/1 var(--sans);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.lang__btn:hover { color: var(--ink); }
.lang__btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Type ---------- */

.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, min(1.2rem + 5.6vw, 9.2svh), 6rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  text-wrap: balance;
  max-width: 15em;
  font-variant-numeric: lining-nums;
}
.display .accent { color: var(--terracotta); }
.display--why { max-width: 17em; }
.display--why .date { color: var(--terracotta); white-space: nowrap; }

.lede {
  margin-top: clamp(14px, 2.4svh, 26px);
  max-width: 34ch;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 500;
  text-wrap: balance;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 22px 0 26px;
  border-radius: 999px;
  font: 700 1rem/1 var(--sans);
  letter-spacing: 0.005em;
  text-decoration: none;
  transition: background-color 0.45s var(--ease-out), color 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}
.btn__arrow {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s var(--ease-out);
}
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  margin-top: clamp(20px, 3.4svh, 36px);
  background: var(--terracotta-deep);
  color: #FFFDF9;
  box-shadow: 0 1px 2px rgba(120, 40, 20, 0.18), 0 10px 24px -12px rgba(180, 71, 47, 0.7);
}
.btn--primary:hover { background: #A33F29; }

.btn--light {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(10, 30, 45, 0.2), 0 14px 30px -14px rgba(10, 30, 45, 0.6);
}
.btn--light:hover { background: var(--saffron); }
.btn--light:focus-visible { outline-color: var(--saffron); }

/* ---------- Scene (hero + chain) ---------- */
/* Default (no JS / reduced motion): a finished chain in normal flow. */

.scene { position: relative; }
.scene__inner {
  padding: calc(var(--header-h) + clamp(40px, 8svh, 96px)) 0 clamp(56px, 10svh, 120px);
}
.scene__copy { padding: 0 var(--gutter); }
.copy--why { margin-top: clamp(72px, 12vw, 160px); }

.chain {
  position: relative;
  margin-top: clamp(40px, 6svh, 72px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 32px 0 40px;
}
.chain::-webkit-scrollbar { display: none; }

.track {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: max-content;
  padding: 0 var(--gutter);
}

.sun {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: calc(var(--gutter) + var(--card-w) / 2);
  width: calc(var(--card-h) * 1.32);
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle at 34% 30%, var(--saffron-light), var(--saffron) 62%);
}

/* ---------- Invoice card ---------- */

.card {
  position: relative;
  flex: none;
  width: var(--card-w);
  height: var(--card-h);
  padding: calc(var(--card-w) * 0.075);
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  border-radius: clamp(14px, 1.6vw, 22px);
  background: var(--sheet);
  box-shadow:
    0 0 0 1px rgba(31, 42, 55, 0.05),
    0 2px 4px rgba(31, 42, 55, 0.04),
    0 12px 28px -14px rgba(31, 42, 55, 0.22);
}
.card > * { position: relative; z-index: 1; }
.card__lift {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  box-shadow: 0 30px 60px -24px rgba(90, 45, 10, 0.38), 0 10px 20px -10px rgba(31, 42, 55, 0.16);
  opacity: 0;
  pointer-events: none;
}

.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card__id { display: grid; gap: 2px; }
.card__kind {
  font-size: 6cqi;
  font-weight: 600;
  color: var(--ink-soft);
}
.card__no {
  font-family: var(--serif);
  font-size: 9cqi;
  font-weight: 600;
  letter-spacing: -0.005em;
  font-variant-numeric: lining-nums tabular-nums;
}

.seal { width: 16cqi; height: 16cqi; flex: none; overflow: visible; }
.seal__ring {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  opacity: 0;
}
.seal__fill { fill: var(--terracotta); transform-box: fill-box; transform-origin: center; }
.seal__check {
  fill: none;
  stroke: #FFFDF9;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.card__body { display: grid; gap: 1.5cqi; }
.card__concept { font-size: 6.4cqi; font-weight: 600; color: var(--ink-soft); line-height: 1.3; }
.card__amount {
  font-family: var(--serif);
  font-size: 15cqi;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.card__date { font-size: 5.6cqi; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.card__hash {
  display: grid;
  gap: 2cqi;
  padding-top: 4cqi;
  border-top: 1px dashed rgba(31, 42, 55, 0.16);
}
.card__hash div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card__hash dt { font-size: 5.4cqi; font-weight: 600; color: var(--ink-soft); }
.hash {
  font-family: var(--mono);
  font-size: 5.4cqi;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.hash--self { color: var(--ink); font-weight: 600; }

.card__foot { display: flex; align-items: flex-end; justify-content: space-between; }
.qr { width: 17cqi; height: 17cqi; fill: var(--ink); shape-rendering: crispEdges; }
.vf { font-size: 4.6cqi; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-faint); }

/* ---------- Link between cards ---------- */

.link {
  position: relative;
  flex: none;
  width: var(--link-w);
  height: 32px;
  display: grid;
  place-items: center;
}
.link__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--terracotta);
  transform-origin: 0 50%;
}
.link__knot {
  position: relative;
  width: 38px;
  height: 20px;
  padding: 0;
  overflow: visible;
  fill: var(--paper);
  stroke-width: 3;
}
.link__knot rect:first-child { stroke: var(--ink); }
.link__knot rect:last-child { stroke: var(--terracotta); fill: none; }

/* ---------- Animated scene (motion allowed + GSAP present) ---------- */

.motion .scene { height: 100vh; height: 100svh; overflow: clip; }
.motion .scene__inner {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  padding: calc(var(--header-h) + clamp(16px, 6svh, 72px)) 0 clamp(16px, 4svh, 48px);
}
.motion .scene__copy { display: grid; grid-template-columns: minmax(0, 1fr); }
.motion .copy { grid-area: 1 / 1; }
.motion .copy--why { margin-top: 0; opacity: 0; visibility: hidden; }

.motion .chain {
  margin-top: clamp(12px, 3svh, 40px);
  padding: 0;
  overflow: visible;
  display: flex;
  align-items: center;
}
.motion .track { padding: 0; will-change: transform; }
.motion .sun { left: calc(var(--anchor) * 100%); }

.motion [data-intro] { opacity: 0; }

/* ---------- Points ---------- */

.points {
  padding: clamp(96px, 16svh, 200px) var(--gutter) clamp(88px, 14svh, 180px);
}
.points__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
  max-width: 1320px;
}
.point {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  align-content: start;
  padding-top: clamp(24px, 3vw, 36px);
  border-top: 1px solid var(--hairline);
}
.point__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
}
.point__icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.point__icon svg * { stroke-dasharray: 1; stroke-dashoffset: 0; }
.point--terracotta .point__icon { background: rgba(200, 85, 61, 0.12); color: var(--terracotta-deep); }
.point--saffron .point__icon { background: rgba(233, 162, 59, 0.2); color: #9A5E0E; }
.point--sea .point__icon { background: rgba(47, 111, 143, 0.12); color: var(--sea-deep); }

.point__text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.75rem, 1.2rem + 1.7vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 11ch;
  text-wrap: balance;
}

/* ---------- Close ---------- */

.close { padding: 0 clamp(8px, 2vw, 24px); }
.close__panel {
  position: relative;
  overflow: hidden;
  min-height: min(84svh, 760px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(160px, 22svh, 220px) var(--gutter) clamp(48px, 9svh, 104px);
  border-radius: clamp(24px, 3vw, 40px);
  background: var(--sea);
  color: var(--paper);
}
.close__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.close__title {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.18em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.25rem, 1.2rem + 4.4vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  max-width: 13em;
  text-wrap: balance;
}
.close__title-soft { color: rgba(250, 246, 240, 0.86); }
.close .btn { position: relative; z-index: 1; margin-top: clamp(28px, 5svh, 48px); }

.close__mark {
  position: absolute;
  z-index: 0;
  right: -6%;
  bottom: -14%;
  width: min(70vw, 820px);
  height: auto;
  fill: none;
  stroke: rgba(250, 246, 240, 0.07);
  stroke-width: 2.2;
  pointer-events: none;
}

.stamp {
  position: absolute;
  top: clamp(24px, 4vw, 56px);
  right: clamp(24px, 4vw, 56px);
  width: clamp(104px, 11vw, 136px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.stamp__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.motion .stamp__ring { animation: stamp-turn 60s linear infinite; }
.stamp__edge { fill: none; stroke: rgba(250, 246, 240, 0.32); stroke-width: 1; stroke-dasharray: 2 4; }
.stamp text {
  fill: var(--paper);
  font: 700 10px var(--sans);
  letter-spacing: 0.18em;
}
.stamp__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--saffron);
  box-shadow: 0 0 0 0 rgba(233, 162, 59, 0.55);
}
.motion .stamp__dot { animation: stamp-pulse 2.8s var(--ease-out) infinite; }

@keyframes stamp-turn { to { transform: rotate(360deg); } }
@keyframes stamp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(233, 162, 59, 0.55); }
  70%, 100% { box-shadow: 0 0 0 16px rgba(233, 162, 59, 0); }
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(32px, 5vw, 56px) var(--gutter) clamp(32px, 5vw, 48px);
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.site-footer img { width: 104px; height: auto; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  :root {
    --header-h: 64px;
    --anchor: 0.5;
    --card-h: clamp(232px, 38svh, 360px);
    --link-w: 52px;
  }
  .points__list { grid-template-columns: 1fr; gap: 0; }
  .point {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 24px 0;
  }
  .point__icon { width: 56px; height: 56px; }
  .point__text { max-width: none; }
  .close__panel { min-height: 0; padding-top: 168px; }
}

@media (max-width: 860px) and (max-height: 700px) {
  :root { --card-h: clamp(210px, 34svh, 320px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
