/* The front door's design, carried through every page behind it.
 *
 * WHY
 * / is the front door. Everything behind it used to look like a different site:
 * same palette, none of the drafting language. The grid, the ruled frame, the
 * brass hover sweep and the corner ticks are what make the front door read as a
 * drawing rather than a web page, and a visitor who walks through the door
 * should not feel the drawing stop.
 *
 * Every declaration here is lifted from public/frontdoor.css rather than
 * approximated, so there is one design and not two that resemble each other.
 * The grid geometry is the front door's .frame-wrap: 36px, var(--hair) hairlines
 * over a 54 percent panel wash. The hover sweep is its .nav-links > a::after.
 *
 * It loads on every page except /, which carries the whole system already.
 */

/* ---- 1. the drafting grid, behind the top of every page ------------------- */
/* Every wrapper, not only .wrap.top: 50 pages use "wrap top", 5 use "wrap",
   3 use "wrap wide top" and one uses "wrap wide". Keying on .top would have put
   the grid on most of the site and silently skipped the rest, which is the kind
   of nearly-everywhere that reads as a bug rather than a decision. */
.fd ~ .wrap, .wrap{ position:relative }
.wrap > *{ position:relative; z-index:1 }
.wrap::before{
  content:""; position:absolute; z-index:0; pointer-events:none;
  /* 6 Nov. -40px either side of a narrow .wrap read as a floating rectangle
     behind the h1 rather than a drafting field under the page. It bleeds the
     full viewport width now, the way the front door's grid does, and is held
     off the edges by the mask alone. */
  left:50%; right:auto; width:100vw; transform:translateX(-50%);
  /* top:0, not -28px. Pulled up it ran a hairline straight through the nav
     labels, and COMPLETE STANDARD had a line through the middle of it. The
     grid is a field under the page, not over the chrome. */
  top:0; height:290px;
  background:
    linear-gradient(var(--hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--hair) 1px, transparent 1px);
  background-size:36px 36px;
  /* fades out rather than ending, so the page does not sit in a box */
  -webkit-mask-image:linear-gradient(180deg,#000 0%,rgba(0,0,0,.55) 48%,transparent 100%),
                     linear-gradient(90deg,transparent 0,#000 7%,#000 86%,transparent 100%);
  -webkit-mask-composite:source-in;
  mask-image:linear-gradient(180deg,#000 0%,rgba(0,0,0,.55) 48%,transparent 100%),
             linear-gradient(90deg,transparent 0,#000 7%,#000 86%,transparent 100%);
  mask-composite:intersect;
  opacity:.75;
}

/* ---- 2. the ruled frame, with the front door's corner ticks --------------- */
.wrap .item, .wrap .box, .wrap table.pick{ position:relative }
.wrap .item::after, .wrap .box::after{
  content:""; position:absolute; inset:0; pointer-events:none;
  border:1px solid transparent;
  transition:border-color .25s ease;
}
.wrap .item:hover::after{ border-color:var(--rule) }
.wrap .item::before{
  content:""; position:absolute; top:-1px; left:-1px; width:9px; height:9px;
  border-top:1px solid var(--brass); border-left:1px solid var(--brass);
  opacity:0; transition:opacity .25s ease;
}
.wrap .item:hover::before{ opacity:1 }

/* ---- 3. the brass sweep the front door uses on a nav link ----------------- */
nav a:not(.brand){ position:relative }
nav a:not(.brand)::after{
  content:""; position:absolute; bottom:-3px; left:0; right:0; height:1px;
  background:var(--brass); transform:scaleX(0); transform-origin:left;
  transition:transform .25s;
}
nav a:not(.brand):hover::after{ transform:scaleX(1) }

/* ---- 4. the drafting label on a section rule ------------------------------ */
/* h2 on this site is already the front door's kicker: 10px, uppercase, tracked,
   brass-adjacent. It gains the tick the front door puts at the end of a rule. */
:not(.fd) > h2, .wrap h2{ position:relative }
.wrap h2::after{
  content:""; position:absolute; right:0; bottom:-1px;
  width:28px; height:5px;
  border-right:1px solid var(--brass); border-bottom:1px solid var(--brass);
}

/* ---- 5. the reveal, the same curve the front door uses -------------------- */
/* The first version put opacity:0 on the element and animated it to 1. A
   full-page render showed the consequence: every card and every box below the
   fold sat at opacity 0, so the prose that is the whole point of the page was
   invisible until something scrolled, and a rendering crawler would have read a
   page of blanks. The resting state is now visible and the animation only ever
   adds, so a browser that does not run it, or a scroll that never happens,
   costs nothing. */
@media (prefers-reduced-motion: no-preference){
  @supports (animation-timeline: view()){
    .wrap .item, .wrap .box, .wrap .face{
      animation:cf-rise .55s cubic-bezier(.22,.8,.28,1) both;
      animation-timeline:view(); animation-range:entry 0% cover 22%;
    }
  }
}
/* Transform only. A scroll-driven animation with fill-mode both holds its
   from-state for anything that has not scrolled into range, which includes a
   rendering crawler and a full-page capture. With opacity in the keyframe that
   meant the prose below the fold was invisible to both. The rise still reads;
   nothing can ever be unreadable. Proved by rendering the page full height and
   looking at it, twice. */
@keyframes cf-rise{ from{ transform:translateY(14px) } to{ transform:none } }
