/* ==========================================================================
   portal.html — page-local styles ("Card Reader")
   Loaded after css/styles.css. Tokens only; white / black / silver.
   The CLIENT PORTAL mini card floats beside a chrome reader plate. Hovering or
   focusing the Login button flips --read 0→1: the plate unfolds (clip-path),
   the card dips into the mouth (translateX), the LED lights, "Verified" appears.
   ========================================================================== */

/* --------------------------------------------------------------------------
   VAULT HERO (.hero.vault drops the brushed texture — restore it)
   -------------------------------------------------------------------------- */
.portal-hero {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 85% 85% at 50% 50%, transparent 55%, #141416 100%),
    #0A0A0B;
  padding-top: clamp(48px, 7vw, 96px);
}
.portal-hero .hero-grid { align-items: center; min-height: min(calc(100svh - var(--nav-height) - 230px), 540px); }
.portal-hero .eyebrow { color: #8E9199; }
.portal-hero .lead { color: #C9CCD2; }
.portal-hero h1 { color: #FFFFFF; }
.portal-hero .hero-ctas { margin-bottom: 26px; }
.hero-small { display: flex; flex-wrap: wrap; gap: 10px 36px; font-size: .9rem; color: #B9BCC3; }
.hero-small a { position: relative; color: #FFFFFF; font-weight: 600; }
.hero-small a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--chrome-edge); transform: scaleX(.3); transform-origin: left; transition: transform .22s var(--ease-out); }
.hero-small a:hover::after, .hero-small a:focus-visible::after { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   THE CARD READER
   --cw card width · --pw plate width · --dip how far the card travels · --read 0/1
   -------------------------------------------------------------------------- */
.reader-wrap { display: flex; justify-content: center; align-items: center; perspective: 1400px; }
.reader {
  --cw: min(320px, calc((100vw - 2 * var(--gutter) - 24px) / 1.6));
  --pr: .6;
  --gap: 24px;
  --pw: calc(var(--cw) * var(--pr));
  --ch: calc(var(--cw) / 1.586);
  --dip: calc(var(--gap) + var(--pw));
  --peek: .14;                       /* how much of the plate shows at rest (the mouth) */
  --read: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--gap);
  width: calc(var(--cw) + var(--gap) + var(--pw));
  padding: 56px 0;
  clip-path: inset(0 0 0 -120px);    /* nothing travels past the plate's outer edge */
}
/* the reading state — JS class, :has() fallback (separate rules so an unsupported :has never drops the class rule) */
.reader.is-reading { --read: 1; }
.portal-hero:has([data-reader-trigger]:hover) .reader { --read: 1; }
.portal-hero:has([data-reader-trigger]:focus-visible) .reader { --read: 1; }
.reader.is-reading .reader-stage { animation-play-state: paused; }
.portal-hero:has([data-reader-trigger]:hover) .reader-stage { animation-play-state: paused; }
.portal-hero:has([data-reader-trigger]:focus-visible) .reader-stage { animation-play-state: paused; }

/* card stage: float (outer) → dip (middle) → tilt (card) */
.reader-stage { position: relative; width: var(--cw); height: var(--ch); flex-shrink: 0; z-index: 1; transform-style: preserve-3d; }
.reader-card {
  position: relative;
  width: 100%; height: 100%;
  perspective: 1200px;
  transform: translate3d(calc(var(--dip) * var(--read)), 0, 0);
  transition: transform .9s var(--ease-out);
}
.reader-card .iu-card.mini {
  width: 100%;
  border-radius: 18px;
  transform: rotateX(calc(var(--my, 0) * -8deg)) rotateY(calc(var(--mx, 0) * 8deg));
  transition: transform .15s ease-out;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.9), var(--glow-white);
}
.reader-card .iu-card-shadow {
  inset: 12% 6%;
  border-radius: 18px;
  opacity: calc(.6 - var(--read) * .45);
  transition: opacity .9s var(--ease-out);
}

/* rail + hint: the reader announces itself at rest, then gets covered by the plate */
.reader-hint {
  position: absolute;
  left: calc(var(--cw) + var(--gap) + var(--pw) * var(--peek) + 16px);
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #8E9199;
  white-space: nowrap;
  opacity: calc(1 - var(--read));
  transition: opacity .25s;
  pointer-events: none;
}

/* the chrome plate */
.reader-slot {
  position: relative;
  flex-shrink: 0;
  width: var(--pw);
  height: calc(var(--ch) + 56px);
  z-index: 2;
  border-radius: 18px;
  background: var(--chrome);
  background-size: 200% 100%;
  background-position: calc(var(--light) * 100%) 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), inset 0 -1px 0 #8E9199, inset 0 0 0 1px #8E9199, 0 30px 60px -18px rgba(0,0,0,.9);
  clip-path: inset(0 calc((1 - var(--read)) * (100% - var(--peek) * 100%)) 0 0 round 18px);
  transition: clip-path .7s var(--ease-out);
  isolation: isolate;
}
.reader-brush { position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(90deg, rgba(10,10,11,.07) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; pointer-events: none; }
.reader-slot::before { content: ''; position: absolute; left: 14px; top: 0; bottom: 0; width: 44px; background: linear-gradient(90deg, rgba(10,10,11,.28), transparent); pointer-events: none; }
/* the mouth: the card disappears exactly into it */
.reader-mouth {
  position: absolute;
  left: 0; top: 50%;
  width: 14px;
  height: calc(var(--ch) + 16px);
  transform: translateY(-50%);
  background: #0A0A0B;
  border-radius: 0 3px 3px 0;
  box-shadow: inset 0 0 0 1px #26272B, inset -2px 0 3px rgba(0,0,0,.9), 1px 0 0 rgba(255,255,255,.55);
}
/* LED: dim → white glow (opacity only) */
.reader-led { position: absolute; right: 18px; top: 22px; width: 10px; height: 10px; border-radius: 50%; background: #26272B; box-shadow: inset 0 1px 2px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.6); }
.reader-led::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #FFFFFF; box-shadow: 0 0 10px 3px rgba(255,255,255,.85); opacity: var(--read); transition: opacity .3s var(--ease-out) calc(var(--read) * .75s); }
/* status text along the right edge: Reading → Verified */
.reader-text {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #26272B;
  white-space: nowrap;
}
.reader-text span { display: block; }
.reader-text .t-in { opacity: calc(1 - var(--read)); transition: opacity .2s; }
.reader-text .t-ok { position: absolute; inset: 0; opacity: var(--read); transition: opacity .3s var(--ease-out) calc(var(--read) * .8s); }
/* one shine pass when the card lands */
.reader-shine { position: absolute; top: -10%; bottom: -10%; left: 0; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent); transform: translateX(calc(-160% + var(--read) * 560%)) skewX(-20deg); transition: transform 1s var(--ease-out) calc(var(--read) * .45s); pointer-events: none; }
/* four screws — mounted */
.reader-screw { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #26272B; box-shadow: inset 0 1px 0 #8E9199, 0 1px 0 rgba(255,255,255,.7); }
.reader-screw::after { content: ''; position: absolute; left: 1px; right: 1px; top: 50%; height: 1px; margin-top: -.5px; background: #8E9199; transform: rotate(-35deg); }
.reader-screw.tl { left: 26px; top: 10px; }
.reader-screw.tr { right: 10px; top: 10px; }
.reader-screw.tr::after { transform: rotate(25deg); }
.reader-screw.bl { left: 26px; bottom: 10px; }
.reader-screw.bl::after { transform: rotate(60deg); }
.reader-screw.br { right: 10px; bottom: 10px; }
.reader-screw.br::after { transform: rotate(-70deg); }
/* SmartCredit wordmark on the silver key card */
.iu-card .iu-brand { right: 6cqw; top: 8cqw; width: 38cqw; height: auto; z-index: 3; filter: grayscale(1) contrast(1.15); opacity: .92; }

/* --------------------------------------------------------------------------
   THE KEYS — two physical cards on the mist ledger
   -------------------------------------------------------------------------- */
.key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.key {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 30px;
  align-items: center;
  padding: 30px;
  background: #FFFFFF;
  border: 1px solid #DDDFE3;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  color: #26272B;
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s;
}
.key::before { content: ''; position: absolute; top: 0; left: var(--radius); right: var(--radius); height: 1px; background: var(--chrome-edge-dark); opacity: .8; transition: opacity .3s; z-index: 2; }
.key:hover, .key:focus-visible { --lift: -6px; box-shadow: var(--shadow-2); border-color: #0A0A0B; }
.key:hover::before { opacity: 1; }
.key:focus-visible { outline: 3px solid #FFFFFF; box-shadow: 0 0 0 5px #0A0A0B; }
.key-face { perspective: 1000px; width: 200px; --rest: -4deg; }
.key:nth-child(2) .key-face { --rest: 3deg; }
.key-face .iu-card.mini {
  width: 100%;
  border-radius: 14px;
  transform: rotate(var(--rest)) rotateX(calc(var(--my, 0) * -8deg)) rotateY(calc(var(--mx, 0) * 8deg));
  transition: transform .4s var(--ease-out);
  box-shadow: 0 24px 40px -18px rgba(10,10,11,.5);
}
.key:hover .key-face, .key:focus-visible .key-face { --rest: 0deg; }
.key-body { min-width: 0; }
.key-body .mono-label { display: block; color: #26272B; margin-bottom: 8px; }
.key-body h3 { margin-bottom: 8px; color: #0A0A0B; font-size: clamp(1.25rem, 1.8vw, 1.5rem); }
.key-body p { font-size: .95rem; line-height: 1.55; }
.key-body .link { margin-top: 16px; }
.key-notes { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 40px; padding-top: 24px; border-top: 1px solid #DDDFE3; font-size: .92rem; color: #26272B; }
.key-notes .mono { font-weight: 700; color: #0A0A0B; }
.key-notes a { position: relative; color: #0A0A0B; font-weight: 600; }
.key-notes a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--chrome-edge-dark); transform: scaleX(.3); transform-origin: left; transition: transform .22s var(--ease-out); }
.key-notes a:hover::after, .key-notes a:focus-visible::after { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .portal-hero .hero-grid { gap: 36px; }
}
@media (max-width: 900px) {
  .key-grid { grid-template-columns: 1fr; max-width: 600px; }
}
@media (max-width: 640px) {
  .portal-hero .hero-ctas { flex-wrap: wrap; }
  .portal-hero .hero-ctas .btn { flex: 1 1 100%; }
  .reader { --pr: .5; --gap: 20px; --cw: min(320px, calc((100vw - 2 * var(--gutter) - 20px) / 1.5)); padding: 36px 0 28px; }
  .reader-slot { height: calc(var(--ch) + 40px); border-radius: 14px; }
  .reader-slot::before { width: 30px; }
  .reader-mouth { height: calc(var(--ch) + 12px); width: 12px; }
  .reader-led { right: 14px; top: 16px; }
  .reader-text { right: 12px; }
  .reader-hint { left: calc(var(--cw) + var(--gap) + var(--pw) * var(--peek) + 12px); }
  .key { grid-template-columns: 1fr; gap: 22px; padding: 24px 22px; }
  .key-face { width: min(220px, 100%); }
}

/* reduced motion: the card rests in the reader, verified; the plate is open */
@media (prefers-reduced-motion: reduce) {
  .reader { --read: 1; }
  .reader-hint { display: none; }
  .reader-card .iu-card.mini { transform: rotateX(8deg) rotateY(-12deg); }
}

/* ---------- App badges (client app) ---------- */
.app-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 26px; }
.app-badges-label { flex-basis: 100%; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--silver); }
.app-badge { display: inline-flex; align-items: center; gap: 10px; background: #000; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 12px; padding: 9px 16px 9px 12px; min-height: 54px; text-decoration: none; transition: transform .3s var(--ease-out), border-color .3s, box-shadow .3s; }
.app-badge:hover, .app-badge:focus-visible { transform: translateY(-2px) rotate(-.6deg); border-color: #fff; box-shadow: 0 14px 34px -14px rgba(255,255,255,.35); }
.app-badge svg { width: 26px; height: 26px; flex-shrink: 0; }
.app-badge-text { display: flex; flex-direction: column; line-height: 1.05; }
.app-badge-text small { font-size: .62rem; color: var(--silver-3); letter-spacing: .04em; }
.app-badge-text strong { font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
@media (max-width: 640px) { .app-badge { flex: 1 1 calc(50% - 6px); justify-content: center; } }
