/* Glass folders (coach page, #folder). Pairs with js/glass-folder.v1.js.
   After the Glass Folder Cards component, ported from React to plain script:
   a back panel holding generated artwork, the files the folder contains, and
   a frosted front panel hinged on its bottom edge that blurs whatever moves
   behind it. Hover leans the glass toward you; a click opens it and fans the
   files out; + drops a new file in. Smoked glass only, in the site's palette. */

/* ---- the section around them */
.gf-desk{
  display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; align-items: end;
  gap: 40px 28px; margin-top: 8px;
}
.gf-mount{ width: 100%; max-width: 340px; }
.gf-mount > ul{ margin: 0; padding: 0 0 0 18px; color: var(--t3); font-size: 14px; line-height: 1.7; }   /* without script */
.gf-mount > ul b{ color: #fff; font-weight: 600; }
.gf-read{
  min-height: 3.2em; max-width: 640px; margin: 36px auto 0; text-align: center;
  font-size: 15px; line-height: 1.6; color: var(--t3);
}
.gf-read b{ color: #fff; font-weight: 600; }
@media (prefers-reduced-motion: no-preference){
  .gf-read.is-new{ animation: gf-read .45s cubic-bezier(.23,1,.32,1) both; }
  @keyframes gf-read{ from{ opacity: 0; translate: 0 6px; } }
}
.gf-hint{ margin: 10px 0 0; text-align: center; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--t5); }
@media (max-width: 1100px){ .gf-desk{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px){
  .gf-desk{ grid-template-columns: 1fr; gap: 28px; }
  .gf-desk .gf-read{ margin: 4px auto 8px; text-align: left; }
}

/* ---- the folder */
.gf-root{
  --gf-px: 0; --gf-py: 0;
  --gf-ease: cubic-bezier(.2, .8, .2, 1);
  --gf-spring: cubic-bezier(.34, 1.36, .5, 1);
  --gf-hinge: 0deg; --gf-lift: 42px; --gf-spread: 0px; --gf-fan: 0deg; --gf-stack: 15px;
  --gf-ink: #f5f5f7; --gf-ink-soft: rgba(245, 245, 247, .58);
  position: relative; display: block; margin: 0 auto;
  -webkit-tap-highlight-color: transparent; isolation: isolate;
}
.gf-root:hover, .gf-root:focus-within{ --gf-hinge: -11deg; --gf-lift: -34px; --gf-spread: 8px; --gf-fan: 1.4deg; --gf-stack: 10px; }
.gf-root[data-open]{ --gf-hinge: -24deg; --gf-lift: -96px; --gf-spread: 40px; --gf-fan: 5deg; --gf-stack: 30px; }

.gf-stage{ position: absolute; left: 0; top: 0; width: 340px; height: 272px; transform-origin: 0 0; }
.gf-tilt{
  position: absolute; inset: 0;
  transform: perspective(1400px) rotateX(calc(var(--gf-py) * -3deg)) rotateY(calc(var(--gf-px) * 4deg));
  transition: transform .9s var(--gf-ease);
}
.gf-shadow{
  position: absolute; left: 18px; right: 18px; bottom: -6px; height: 60px; border-radius: 40px;
  background: rgba(0, 0, 0, .62); filter: blur(22px);
  transform: translateX(calc(var(--gf-px) * -8px));
  transition: transform .9s var(--gf-ease), opacity .9s var(--gf-ease);
}
.gf-back{ position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg, #1d222a 0%, #0c0f13 100%); }
.gf-art{
  position: absolute; left: -12px; top: -12px; max-width: none;
  transform: translate(calc(var(--gf-px) * -7px), calc(var(--gf-py) * -6px)) scale(1.02);
  transition: transform 1.1s var(--gf-ease), opacity 1.2s var(--gf-ease), filter 1.2s var(--gf-ease);
}
canvas.gf-art{ opacity: 0; filter: blur(14px) saturate(.6); }
canvas.gf-art[data-ready]{ opacity: 1; filter: none; }
.gf-back-sheen{
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(120% 80% at 80% 0%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 60%);
}
.gf-rim{ position: absolute; left: 0; top: 0; max-width: none; overflow: visible; pointer-events: none; fill: none; }
.gf-back-rim{ width: 340px; height: 272px; }
.gf-back-rim path{ stroke: rgba(255, 255, 255, .16); stroke-width: 1; }

/* ---- files */
.gf-files{
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  clip-path: inset(-400px -400px 10px -400px);    /* nothing hangs out of the bottom of the pocket */
}
.gf-sheet{
  all: unset; box-sizing: border-box; position: absolute; left: 34px; top: 96px; width: 272px; height: 184px;
  border-radius: 16px; overflow: hidden; cursor: pointer; pointer-events: auto;
  background: linear-gradient(180deg, #2c2c30 0%, #1c1c1f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 .5px rgba(255, 255, 255, .08), 0 12px 28px -8px rgba(0, 0, 0, .7);
  transform-origin: 50% 100%;
  transform:
    translate(calc(var(--gf-jx) + var(--gf-slot) * var(--gf-spread)), calc(var(--gf-lift) + var(--gf-depth) * var(--gf-stack) * -1))
    rotate(calc(var(--gf-jr) + var(--gf-slot) * var(--gf-fan)));
  transition:
    transform .75s var(--gf-spring) calc(var(--gf-depth) * 40ms),
    box-shadow .4s var(--gf-ease), translate .9s var(--gf-ease), opacity .9s var(--gf-ease);
}
.gf-sheet--art{ background: #1a1a1d; }
.gf-root[data-open] .gf-sheet:hover, .gf-root[data-open] .gf-sheet:focus-visible, .gf-root[data-open] .gf-sheet[aria-pressed="true"]{
  transform:
    translate(calc(var(--gf-jx) + var(--gf-slot) * var(--gf-spread)), calc(var(--gf-lift) + var(--gf-depth) * var(--gf-stack) * -1 - 18px))
    rotate(calc(var(--gf-slot) * var(--gf-fan) * .6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 0 0 1px rgba(186, 208, 255, .35), 0 22px 40px -12px rgba(0, 0, 0, .8);
  transition-delay: 0s;
}
.gf-sheet:focus-visible{ outline: 2px solid rgba(186, 208, 255, .9); outline-offset: 2px; }
.gf-sheet-art{ position: absolute; left: 0; top: 0; width: 272px; height: 184px; max-width: none; transition: opacity .9s var(--gf-ease), filter .9s var(--gf-ease); }
canvas.gf-sheet-art{ opacity: 0; filter: blur(10px); }
canvas.gf-sheet-art[data-ready]{ opacity: 1; filter: none; }
.gf-sheet--art::after{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .42) 0%, rgba(0, 0, 0, 0) 34%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
.gf-sheet-head{
  position: absolute; left: 14px; right: 14px; top: 11px; z-index: 1;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; white-space: nowrap;
}
.gf-sheet-name{ overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 560; letter-spacing: -.005em; color: #fafafa; }
.gf-sheet-meta{ flex: none; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; letter-spacing: .02em; color: rgba(250, 250, 250, .66); }
.gf-lines{ position: absolute; left: 14px; right: 14px; top: 40px; display: flex; flex-direction: column; gap: 9px; }
.gf-lines i{ display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); }
.gf-lines i:first-child{ height: 9px; margin-bottom: 4px; background: rgba(255, 255, 255, .16); }

.gf-sheet--drop{ animation: gf-drop .85s var(--gf-ease) both; }
@keyframes gf-drop{
  0%{ translate: 0 -190px; rotate: -9deg; opacity: 0; }
  35%{ opacity: 1; }
  72%{ translate: 0 10px; rotate: 1deg; }
  100%{ translate: 0 0; rotate: 0deg; opacity: 1; }
}

/* ---- front glass */
.gf-front{
  position: absolute; left: 0; top: 74px; width: 340px; height: 198px; z-index: 10;
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  transform-origin: 50% 100%;
  transform: perspective(760px) rotateX(var(--gf-hinge));
  transition: transform .8s var(--gf-spring), translate 1s var(--gf-ease), opacity 1s var(--gf-ease);
}
.gf-front--bump{ animation: gf-bump .7s var(--gf-ease) .38s both; }
@keyframes gf-bump{ 0%{ scale: 1; } 35%{ scale: 1.018 .975; } 70%{ scale: .996 1.006; } 100%{ scale: 1; } }
.gf-tint{ position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18, 20, 24, .18) 0%, rgba(12, 14, 18, .62) 46%, rgba(7, 9, 12, .94) 100%); }
.gf-spec{
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: .16;
  background: radial-gradient(260px 200px at calc(50% + var(--gf-px) * 46%) calc(30% + var(--gf-py) * 40%), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 70%);
}
.gf-front-rim{ width: 340px; height: 198px; opacity: .55; }
.gf-front-rim path{ stroke-width: 2.4; transition: stroke-width .3s var(--gf-ease); }
.gf-hit{ all: unset; position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.gf-front:has(.gf-hit:focus-visible) .gf-front-rim{ opacity: 1; }
.gf-front:has(.gf-hit:focus-visible) .gf-front-rim path{ stroke: #bad0ff; stroke-width: 5; }   /* the keyboard focus ring: the folder's own edge, lit */
.gf-hit:focus-visible ~ .gf-label .gf-title{ text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.gf-label{ position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 4px; max-width: 200px; pointer-events: none; color: var(--gf-ink); }
.gf-root[data-place="bottom-left"] .gf-label{ left: 28px; bottom: 32px; }
.gf-root[data-place="top-left"] .gf-label{ left: 28px; top: 34px; }
.gf-root[data-place="top-right"] .gf-label{ right: 32px; top: 52px; align-items: flex-start; }
.gf-title{ font-size: 18px; font-weight: 500; line-height: 1.15; letter-spacing: -.012em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-meta{
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .03em;
  color: var(--gf-ink-soft); white-space: nowrap; animation: gf-roll .5s var(--gf-ease) both;
}
@keyframes gf-roll{ from{ opacity: 0; translate: 0 7px; filter: blur(3px); } to{ opacity: 1; translate: 0 0; filter: blur(0); } }

/* ---- the + key */
.gf-key{
  all: unset; box-sizing: border-box; position: absolute; right: 22px; bottom: 22px; z-index: 12;
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; cursor: pointer;
  color: #111113;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #ececee 55%, #d2d2d6 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -3px 8px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .4), 0 14px 22px -8px rgba(0, 0, 0, .7);
  transition: transform .35s var(--gf-spring), box-shadow .35s var(--gf-ease), opacity .6s var(--gf-ease) .7s, scale .7s var(--gf-spring) .7s;
}
.gf-key:hover{ transform: translateY(-2px); }
.gf-key:active{ transform: translateY(0) scale(.93); transition-duration: .12s; }
.gf-key:focus-visible{ outline: 2px solid rgba(186, 208, 255, .9); outline-offset: 3px; }
.gf-glyph{ display: block; max-width: none; fill: none; stroke: currentColor; stroke-linecap: round; width: 26px; height: 26px; stroke-width: 1.6; }
.gf-glyph.is-turn{ animation: gf-turn .6s var(--gf-spring); }
@keyframes gf-turn{ from{ rotate: -90deg; } to{ rotate: 0deg; } }

/* ---- entrance: the folder assembles itself */
.gf-root:not([data-entered]) .gf-back, .gf-root:not([data-entered]) .gf-back-rim{ translate: 0 22px; opacity: 0; }
.gf-root:not([data-entered]) .gf-sheet{ translate: 0 -120px; opacity: 0; }
.gf-root:not([data-entered]) .gf-front{ translate: 0 46px; opacity: 0; }
.gf-root:not([data-entered]) .gf-key{ opacity: 0; scale: .6; }
.gf-root:not([data-entered]) .gf-shadow{ opacity: 0; }
.gf-back, .gf-back-rim{ transition: translate 1s var(--gf-ease), opacity .9s var(--gf-ease); }
.gf-root[data-entered] .gf-sheet{ transition-delay: calc(var(--gf-depth) * 40ms), 0s, calc(.18s + var(--gf-depth) * 90ms), calc(.18s + var(--gf-depth) * 90ms); }
.gf-root[data-entered] .gf-front{ transition-delay: 0s, .42s, .42s; }

@media (prefers-reduced-motion: reduce){
  .gf-root *, .gf-root *::before, .gf-root *::after{ transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
  .gf-tilt{ transform: none; }
}
