/* Troy's pledge (privacy.html): one parchment scroll floating over the morning painting.
   Everything is drawn here: no image files besides the painting and the mascot. Colors are the palette in
   tokens.css, mixed only with opacity. Load after tokens.css, nav.css and tool.css. */

.pledge {
  --amber-rgb: 183, 121, 31;
  --stone-deep: color-mix(in srgb, var(--stone) 78%, var(--ink));   /* stone, darkened to pass 4.5:1 on the grained sheet */
  --sheet-pad: clamp(22px, 7vw, 68px);
  --rod-h: 30px;
  --rod-over: 14px;       /* how far the rolls stick out past the sheet on each side */
  --bleed: 48px;          /* room inside the clip for the sheet's shadow */
  font-size: 17px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- The painting, fixed behind everything ---------- */
.pledge-sky { position: fixed; inset: 0; height: 100vh; height: 100lvh; z-index: 0; background: var(--paper); }
.pledge-sky img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }

/* The landing page's header, on the same sky. The current page gets the gold underline the working pages use. */
.pledge .site-nav { z-index: 3; }
.pledge .site-nav-brand::before,
.pledge .site-nav-links::before { background: rgba(var(--paper-rgb), 0.6); }
.pledge .site-nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 6px; }

.pledge main { position: relative; z-index: 1; padding: clamp(84px, 13vh, 132px) 16px 0; }

/* ---------- The scroll ---------- */
.scroll {
  position: relative;
  width: min(100%, 748px);
  margin: 0 auto;
}

/* The two rolls: rounded bars in a darker paper tone, lit from above. */
.rod {
  position: relative;
  z-index: 2;
  height: var(--rod-h);
  border-radius: calc(var(--rod-h) / 2);
  background:
    /* the roll's two ends, a touch darker, each with one thin edge line */
    linear-gradient(to right, rgba(var(--ink-rgb), 0.10) 0, rgba(var(--ink-rgb), 0.10) 9px, rgba(var(--ink-rgb), 0.22) 9px, rgba(var(--ink-rgb), 0.22) 10px, transparent 10px, transparent calc(100% - 10px), rgba(var(--ink-rgb), 0.22) calc(100% - 10px), rgba(var(--ink-rgb), 0.22) calc(100% - 9px), rgba(var(--ink-rgb), 0.10) calc(100% - 9px)),
    /* the cylinder: a soft highlight near the top, shade underneath */
    linear-gradient(to bottom, rgba(var(--ink-rgb), 0.05) 0, rgba(255, 255, 255, 0.55) 22%, rgba(255, 255, 255, 0) 48%, rgba(var(--ink-rgb), 0.07) 70%, rgba(var(--ink-rgb), 0.24) 100%),
    linear-gradient(rgba(var(--amber-rgb), 0.20), rgba(var(--amber-rgb), 0.20)),
    var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(var(--ink-rgb), 0.10),
    0 1px 1px rgba(var(--ink-rgb), 0.14),
    0 10px 22px rgba(var(--ink-rgb), 0.20);
}
/* The loose edge of the outer wrap: one faint line along the roll. */
.rod::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 64%;
  height: 1px;
  background: rgba(var(--ink-rgb), 0.09);
}
.rod-bottom { margin-top: -9px; }

/* The unroll: .scroll-mover slides down from behind the top roll carrying the bottom roll, while .scroll-inner
   slides the opposite way inside the clip, so the words stay still and the paper is uncovered top to bottom. */
.scroll-mover { position: relative; z-index: 1; margin-top: -9px; }
.scroll-clip { overflow: hidden; margin: 0 calc(var(--bleed) * -1); padding: 0 var(--bleed); }

.sheet {
  position: relative;
  margin: 0 var(--rod-over);
  padding: 64px var(--sheet-pad) 58px;
  color: var(--ink);
}
/* The sheet's low shadow on the painting, like the landing page's paper panels. */
.sheet::before {
  content: "";
  position: absolute;
  inset: 0 5px;
  z-index: -2;
  box-shadow: 0 2px 6px rgba(var(--ink-rgb), 0.14), 0 18px 44px rgba(var(--ink-rgb), 0.24);
}
/* The paper itself: grain, a little mottling, edges that darken and wander (the #deckle filter in the page). */
.sheet-paper {
  position: absolute;
  inset: -8px 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(var(--ink-rgb), 0.16) 8px, rgba(var(--ink-rgb), 0.05) 22px, rgba(var(--ink-rgb), 0) 44px, rgba(var(--ink-rgb), 0) calc(100% - 48px), rgba(var(--ink-rgb), 0.04) calc(100% - 24px), rgba(var(--ink-rgb), 0.13) calc(100% - 8px)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .11 0 0 0 0 .1 0 0 0 0 .09 0 0 0 .55 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.011' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .72 0 0 0 0 .47 0 0 0 0 .12 0 0 0 .3 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(var(--amber-rgb), 0.045), rgba(var(--amber-rgb), 0.045)),
    var(--paper);
  box-shadow: inset 0 0 3px rgba(var(--amber-rgb), 0.5), inset 0 0 22px rgba(var(--amber-rgb), 0.17), inset 0 0 64px rgba(var(--amber-rgb), 0.07);
  filter: url(#deckle);
}

/* ---------- Head: sprigs, title, one line, the Greek key ---------- */
.pledge-head { text-align: center; }
.pledge-sprigs {
  display: block;
  width: 64px;
  height: 24px;
  margin: 0 auto 16px;
  background: var(--laurel);
  -webkit-mask: var(--sprigs) 50% 50% / contain no-repeat;
  mask: var(--sprigs) 50% 50% / contain no-repeat;
}
.pledge-head h1 { font-size: clamp(2.5rem, 6.4vw, 3.5rem); line-height: 1; margin: 0; }
.pledge-sub { margin: 14px auto 0; color: var(--stone-deep); font-size: 1.0625rem; line-height: 1.45; text-wrap: balance; }
/* tool.css fades the key to the right; here it sits centered and fades at both ends. */
.pledge .key-rule {
  width: min(100%, 300px);
  margin: 30px auto 0;
  background: var(--stone);
  filter: none;
  opacity: 0.55;
  -webkit-mask: var(--key-up) 50% 50% / 15px 12px repeat-x, linear-gradient(to right, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-composite: source-in;
  mask: var(--key-up) 50% 50% / 15px 12px repeat-x, linear-gradient(to right, transparent, #000 30%, #000 70%, transparent);
  mask-composite: intersect;
}

/* ---------- The seven articles ---------- */
.articles { list-style: none; margin: 34px 0 0; padding: 0; }
.articles > li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: 10px;
  padding: 26px 0 27px;
  /* the thin gold rule between articles */
  background: linear-gradient(to right, rgba(255, 204, 0, 0), var(--gold) 12%, var(--gold) 88%, rgba(255, 204, 0, 0)) 0 0 / 100% 1.5px no-repeat;
}
.articles > li:first-child { background: none; padding-top: 6px; }
.article-num {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.625rem;
  line-height: 1.6rem;
  letter-spacing: 0.02em;
  color: var(--cardinal);
  font-variant-numeric: lining-nums;
}
.articles h2 {
  font-family: var(--font-body);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.6rem;
  margin: 0;
  text-wrap: balance;
}
.articles p { margin: 7px 0 0; line-height: 1.58; text-wrap: pretty; }
.say { font-weight: 600; white-space: nowrap; }

/* ---------- Foot: the seal and the signature ---------- */
.pledge-foot {
  display: flex;
  align-items: flex-end;
  min-height: 104px;
  margin-top: 14px;
  padding-left: 124px;       /* the seal sits here, outside the clip so it can hang over the bottom roll */
}
.signature { flex: 1; border-top: 1px solid rgba(var(--ink-rgb), 0.28); padding-top: 10px; }
.signature-name {
  display: block;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  font-size: 2rem;
  line-height: 1;
}
.signature-note { display: block; margin-top: 8px; font-size: 0.875rem; color: var(--stone-deep); }
.signature-note a { color: inherit; text-decoration-color: rgba(var(--ink-rgb), 0.35); text-underline-offset: 3px; overflow-wrap: anywhere; }
.signature-note a:hover { color: var(--ink); }

/* Pressed wax in cardinal. The edge is a little uneven; the mascot sits in the stamped hollow. */
.seal {
  position: absolute;
  z-index: 3;
  left: calc(var(--rod-over) + var(--sheet-pad) - 4px);
  bottom: 52px;
  width: 104px;
  height: 104px;
  border-radius: 47% 53% 51% 49% / 52% 48% 53% 47%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 46%),
    radial-gradient(circle at 62% 82%, rgba(var(--ink-rgb), 0.30), rgba(var(--ink-rgb), 0) 58%),
    var(--cardinal);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.20),
    inset 0 -5px 9px rgba(var(--ink-rgb), 0.30),
    0 1px 2px rgba(var(--ink-rgb), 0.36),
    0 7px 16px rgba(var(--ink-rgb), 0.26);
  display: grid;
  place-items: center;
  transform: rotate(-7deg);
}
/* The stamp's rim: a ring pressed into the wax. */
.seal::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  box-shadow:
    inset 0 3px 5px rgba(var(--ink-rgb), 0.42),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.16),
    0 -1px 0 rgba(var(--ink-rgb), 0.18);
}
.seal img {
  position: relative;
  display: block;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  /* The mascot file as it is; multiplied into the wax so it reads as an impression, not a sticker. */
  mix-blend-mode: multiply;
  opacity: 0.84;
}

/* ---------- Footer links, on the painting ---------- */
.pledge-end { position: relative; z-index: 1; display: flex; justify-content: center; padding: 56px 16px 44px; }
.pledge .footer-links::before { background: rgba(var(--ink-rgb), 0.66); inset: -8px -22px; }
.pledge .footer-links :focus-visible { outline-color: var(--white); }

/* ---------- Phones ---------- */
@media (max-width: 599px) {
  .pledge { font-size: 16px; --rod-over: 7px; --rod-h: 26px; --bleed: 16px; }
  .pledge-sky img { object-position: 86% 50%; }
  .pledge main { padding-top: 68px; }
  .sheet { padding-top: 48px; padding-bottom: 48px; }
  .pledge-sub { font-size: 1rem; }
  /* numerals sit above each article */
  .articles > li { display: block; padding: 22px 0 23px; }
  .article-num { display: block; margin-bottom: 6px; font-size: 1.375rem; }
  .articles h2 { font-size: 1.125rem; }
  .pledge-foot { padding-left: 104px; min-height: 92px; }
  .seal { width: 88px; height: 88px; left: calc(var(--rod-over) + var(--sheet-pad) - 6px); }
  .seal::before { inset: 11px; }
  .seal img { width: 62px; height: 62px; }
  .signature-name { font-size: 1.75rem; }
  .signature-note { font-size: 0.8125rem; }
  .pledge-end { padding-top: 44px; }
  .pledge .footer-links a { padding: 0 clamp(4px, 1.4vw, 9px); font-size: clamp(10.5px, 3.3vw, 14px); }
}

/* ---------- Motion: the scroll unrolls once, then the seal is pressed in ---------- */
@media (prefers-reduced-motion: no-preference) {
  .scroll-mover { animation: pledge-unroll 2200ms cubic-bezier(0.3, 0.1, 0.2, 1) 200ms both; }
  .scroll-inner { animation: pledge-hold 2200ms cubic-bezier(0.3, 0.1, 0.2, 1) 200ms both; }
  .sheet > :not(.sheet-paper) { animation: pledge-ink 2200ms ease-out 200ms both; }
  .seal { animation: pledge-press 460ms cubic-bezier(0.3, 0, 0.3, 1) 2350ms both; }
}
@keyframes pledge-unroll { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes pledge-hold { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pledge-ink { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes pledge-press {
  0% { opacity: 0; transform: rotate(-7deg) scale(1.15); }
  55% { opacity: 1; transform: rotate(-7deg) scale(0.975); }
  100% { opacity: 1; transform: rotate(-7deg) scale(1); }
}
