.keystone-mark-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  padding:.35rem;
  border-radius:14px;
}

.keystone-mark-link:focus-visible{
  outline:2px solid rgba(252,234,187,.85);
  outline-offset:4px;
  border-radius:14px;
}

/* =========================================================
   Keystone base
   ========================================================= */

.keystone-mark{
  --mark-width: 184px;
  --mark-height: 228px;

  --gold: #f0d79a;
  --gold-soft: rgba(240,215,154,.42);
  --gold-faint: rgba(240,215,154,.16);

  --bg-top: #28506f;
  --bg-mid: #16324a;
  --bg-bottom: #09131d;

  position:relative;
  display:inline-block;
  width:var(--mark-width);
  height:var(--mark-height);
  box-sizing:border-box;
  overflow:hidden;
  isolation:isolate;
  border-radius:0;
  filter:drop-shadow(0 12px 22px rgba(0,0,0,.28));
  transition:transform .18s ease, filter .18s ease;

  clip-path:path("M 18 18 Q 92 2 166 18 L 146 188 Q 92 168 38 188 Z");

  background:
    radial-gradient(circle at 50% 22%, rgba(120,205,255,.32), transparent 22%),
    radial-gradient(circle at 50% 46%, rgba(255,225,140,.12), transparent 30%),
    linear-gradient(to bottom, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
}

.keystone-mark::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
  clip-path:path("M 18 18 Q 92 2 166 18 L 146 188 Q 92 168 38 188 Z");
  box-shadow:
    inset 0 0 0 2px rgba(240,215,154,.84),
    inset 0 0 0 3px rgba(255,255,255,.03);
}

.keystone-mark::after{
  content:"";
  position:absolute;
  inset:12px;
  pointer-events:none;
  z-index:1;
  clip-path:path("M 24 25 Q 92 11 160 25 L 141 181 Q 92 163 43 181 Z");
  box-shadow:inset 0 0 0 1px rgba(240,215,154,.34);
}

.keystone-ring{
  position:absolute;
  inset:0;
  display:block;
  z-index:1;
  pointer-events:none;
}

.keystone-ring-outer::before{
  content:"";
  position:absolute;
  inset:0;
  clip-path:path("M 18 18 Q 92 2 166 18 L 146 188 Q 92 168 38 188 Z");
  box-shadow:inset 0 0 0 2px rgba(240,215,154,.72);
}

.keystone-ring-inner::before{
  content:"";
  position:absolute;
  inset:12px;
  clip-path:path("M 24 25 Q 92 11 160 25 L 141 181 Q 92 163 43 181 Z");
  box-shadow:inset 0 0 0 1px rgba(240,215,154,.26);
}

.keystone-title{
  position:absolute;
  top:19px;
  left:50%;
  transform:translateX(-50%);
  color:var(--gold);
  font-size:1rem;
  font-weight:700;
  letter-spacing:.22em;
  text-transform:uppercase;
  text-shadow:0 2px 8px rgba(0,0,0,.42);
  z-index:3;
  white-space:nowrap;
}

.keystone-core{
  position:absolute;
  left:50%;
  bottom:18px;
  width:12px;
  height:12px;
  margin-left:-6px;
  border-radius:50%;
  background:var(--gold);
  box-shadow:
    0 0 0 4px rgba(240,215,154,.10),
    0 0 12px rgba(240,215,154,.22);
  z-index:3;
}

.keystone-mark-link:hover .keystone-mark,
.keystone-mark-link:focus-visible .keystone-mark{
  transform:translateY(-1px);
  filter:drop-shadow(0 16px 28px rgba(0,0,0,.36));
}

.keystone-symbol{
  position:absolute;
  left:50%;
  top:52px;
  width:104px;
  height:126px;
  transform:translateX(-50%);
  z-index:4;
  overflow:visible;
  filter:drop-shadow(0 0 8px rgba(240,215,154,.10));
  pointer-events:none;
}

.keystone-symbol path,
.keystone-symbol line{
  vector-effect:non-scaling-stroke;
}

/* =========================================================
   Hall of the Eight Keystones - index.php
   ========================================================= */

.keystones-mark{
  --ks-blue-1:#07101a;
  --ks-blue-2:#0b1826;
  --ks-blue-3:#12314a;
  --ks-gold-1:#f3de9f;
  --ks-gold-2:#ddb965;
  --ks-gold-3:#b98934;
  --ks-gold-4:#7c5820;
  --ks-glow:rgba(72,170,255,.24);
  --ks-glow-soft:rgba(72,170,255,.12);

  position:relative;
  width:132px;
  height:132px;
  display:block;
  border-radius:50%;
  overflow:hidden;
  isolation:isolate;
  box-sizing:border-box;

  background:
    radial-gradient(circle at 50% 38%, rgba(255,216,120,.10), transparent 30%),
    radial-gradient(circle at 50% 52%, #112537 0%, #0a1725 62%, #06101a 100%);
  box-shadow:
    0 0 0 1px rgba(243,222,159,.16),
    0 0 22px var(--ks-glow-soft),
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 -10px 18px rgba(0,0,0,.30);
}

.keystones-mark::before{
  content:"";
  position:absolute;
  inset:7px;
  border-radius:50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(100,190,255,.10) 73%, transparent 79%),
    radial-gradient(circle at 50% 50%, transparent 64%, rgba(255,215,140,.06) 70%, transparent 76%);
  pointer-events:none;
}

.keystones-mark::after{
  content:"";
  position:absolute;
  inset:-8px;
  border-radius:50%;
  box-shadow:0 0 24px var(--ks-glow);
  opacity:.85;
  pointer-events:none;
}

/* shared inner wheel language */

.keystones-mark .codex-ring{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  border-radius:50%;
  box-sizing:border-box;
}

.keystones-mark .codex-ring-outer{
  width:126px;
  height:126px;
  border:2px solid rgba(243,222,159,.60);
  box-shadow:
    inset 0 0 0 1px rgba(255,240,200,.10),
    0 0 8px rgba(72,170,255,.10);
}

.keystones-mark .codex-ring-inner{
  width:92px;
  height:92px;
  border:1.5px solid rgba(221,185,101,.34);
}

/* arch */

.keystones-arch,
.keystones-arch-inner{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  border-radius:60px 60px 0 0;
  box-sizing:border-box;
}

.keystones-arch{
  top:20px;
  width:58px;
  height:34px;
  border:2.5px solid rgba(243,222,159,.82);
  border-bottom:none;
  background:linear-gradient(to bottom, rgba(255,240,200,.10), rgba(185,137,52,.05));
}

.keystones-arch-inner{
  top:25px;
  width:44px;
  height:24px;
  border:1.5px solid rgba(221,185,101,.30);
  border-bottom:none;
}

/* columns */

.keystones-column{
  position:absolute;
  top:45px;
  width:6px;
  height:22px;
  border-radius:2px;
  background:
    linear-gradient(to right,
      var(--ks-gold-4) 0%,
      var(--ks-gold-2) 35%,
      var(--ks-gold-1) 52%,
      var(--ks-gold-3) 78%,
      #5e4116 100%);
  box-shadow:0 1px 3px rgba(0,0,0,.18);
}

.keystones-column::before,
.keystones-column::after{
  content:"";
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  width:10px;
  height:3px;
  border-radius:2px;
  background:linear-gradient(to bottom, var(--ks-gold-1), var(--ks-gold-3));
}

.keystones-column::before{ top:-4px; }
.keystones-column::after{ bottom:-4px; }

.keystones-column-left{ left:39px; }
.keystones-column-right{ right:39px; }

/* wheel */

.keystones-wheel{
  position:absolute;
  left:50%;
  top:50%;
  width:66px;
  height:66px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  border:1px solid rgba(221,185,101,.22);
  box-shadow:
    inset 0 0 0 1px rgba(243,222,159,.06),
    0 0 10px rgba(72,170,255,.06);
}

.keystones-wheel::before{
  content:"";
  position:absolute;
  inset:8px;
  border-radius:50%;
  border:1px solid rgba(221,185,101,.18);
}

.keystones-wheel::after{
  content:"";
  position:absolute;
  inset:16px;
  border-radius:50%;
  border:1px solid rgba(221,185,101,.14);
}

/* core */

.keystones-core{
  position:absolute;
  left:50%;
  top:50%;
  width:22px;
  height:22px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  background:
    radial-gradient(circle at 35% 30%,
      rgba(255,248,210,.96) 0%,
      rgba(243,222,159,.96) 22%,
      rgba(221,185,101,.92) 52%,
      rgba(126,89,32,.98) 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.18),
    inset 0 -2px 4px rgba(0,0,0,.28),
    0 0 8px rgba(255,205,90,.16);
  z-index:3;
}

.keystones-core::before{
  content:"";
  position:absolute;
  inset:4px;
  border-radius:50%;
  border:1px solid rgba(255,245,220,.18);
}

/* eight spokes */

.keystones-spoke{
  position:absolute;
  left:50%;
  top:50%;
  width:14px;
  height:30px;
  margin-left:-7px;
  margin-top:-42px;
  transform-origin:50% 42px;
  z-index:2;
}

.keystones-spoke::before{
  content:"";
  position:absolute;
  left:50%;
  top:0;
  width:14px;
  height:30px;
  transform:translateX(-50%);
  clip-path:polygon(20% 0%, 80% 0%, 100% 26%, 100% 100%, 0% 100%, 0% 26%);
  background:
    linear-gradient(to right,
      rgba(126,89,32,.98) 0%,
      rgba(221,185,101,.94) 34%,
      rgba(243,222,159,.98) 52%,
      rgba(185,137,52,.96) 74%,
      rgba(90,61,18,.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,248,222,.18),
    inset 0 -2px 3px rgba(0,0,0,.18),
    0 0 4px rgba(0,0,0,.16);
  border-radius:1px;
}

.keystones-spoke::after{
  content:"";
  position:absolute;
  left:50%;
  bottom:-3px;
  width:8px;
  height:6px;
  transform:translateX(-50%);
  border-radius:1px 1px 2px 2px;
  background:linear-gradient(to bottom, var(--ks-gold-1), var(--ks-gold-3));
  opacity:.95;
}

.keystones-spoke-1{ transform:rotate(0deg); }
.keystones-spoke-2{ transform:rotate(45deg); }
.keystones-spoke-3{ transform:rotate(90deg); }
.keystones-spoke-4{ transform:rotate(135deg); }
.keystones-spoke-5{ transform:rotate(180deg); }
.keystones-spoke-6{ transform:rotate(225deg); }
.keystones-spoke-7{ transform:rotate(270deg); }
.keystones-spoke-8{ transform:rotate(315deg); }

/* hover */

.codex-mark-link:hover .keystones-mark{
  transform:translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(243,222,159,.22),
    0 0 28px rgba(72,170,255,.18),
    inset 0 1px 0 rgba(255,255,255,.07),
    inset 0 -10px 18px rgba(0,0,0,.30);
}

/* =========================================================
   Keystone title modifiers (clean, single source of truth)
   ========================================================= */

.keystone-title--connection{
  font-size:.86rem;
  letter-spacing:.08em;
}

.keystone-title--environment{
  font-size:.86rem;
  letter-spacing:.04em;
}

/* =========================================================
   Hall link / header alignment
   ========================================================= */

.hall-keystones-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  padding:.35rem;
}

.page-header .hall-keystones-link{
  margin-inline:auto;
}

.page-header .keystones-mark{
  margin-inline:auto;
}

/* =========================================================
   Hall card keystone previews
   ========================================================= */

.hall-card-mark{
  position:relative;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  height:132px;
  margin:0 0 .55rem;
  overflow:visible;
}

.keystone-mark--mini{
  position:absolute;
  left:50%;
  top:0;
  transform:translateX(-50%) scale(.565);
  transform-origin:top center;
  filter:drop-shadow(0 8px 14px rgba(0,0,0,.22));
}

.hall-card-link:hover .keystone-mark--mini,
.hall-card-link:focus-visible .keystone-mark--mini{
  transform:translateX(-50%) scale(.565);
}

/* optical centering for long titles in full-size keystones */
.keystone-title--connection,
.keystone-title--environment{
  width:78%;
  text-align:center;
}

/* mini long-title refinement only */
.keystone-mark--mini .keystone-title--connection{
  letter-spacing:.05em;
}

.keystone-mark--mini .keystone-title--environment{
  letter-spacing:.02em;
}

/* =========================================================
   Food — SVG proof of concept
   ========================================================= */

.food-mark{
  --bg-top: #2c5a7a;
  --bg-mid: #18364d;
  --bg-bottom: #09131d;
}

/* =========================================================
   Motion — SVG
   ========================================================= */

.motion-mark{
  --bg-top: #2a4f6c;
  --bg-mid: #162c3f;
  --bg-bottom: #08131d;
}

/* =========================================================
   Sleep — SVG
   ========================================================= */

.sleep-mark{
  --bg-top: #263f5c;
  --bg-mid: #14273a;
  --bg-bottom: #08111a;
}

/* =========================================================
   Mind — SVG
   ========================================================= */

.mind-mark{
  --bg-top: #31506c;
  --bg-mid: #193045;
  --bg-bottom: #09131d;
}

/* =========================================================
   Connection — SVG
   ========================================================= */

.connection-mark{
  --bg-top: #294a68;
  --bg-mid: #173045;
  --bg-bottom: #09131d;
}

/* =========================================================
   Environment — SVG
   ========================================================= */

.environment-mark{
  --bg-top: #2a5364;
  --bg-mid: #16323d;
  --bg-bottom: #08131a;
}

/* =========================================================
   Time — SVG
   ========================================================= */

.time-mark{
  --bg-top: #2c4868;
  --bg-mid: #182c40;
  --bg-bottom: #09121a;
}

/* =========================================================
   Purpose — SVG
   ========================================================= */

.purpose-mark{
  --bg-top: #31506b;
  --bg-mid: #1a3044;
  --bg-bottom: #09131d;
}

@media (prefers-reduced-motion: reduce){
  .keystone-mark{
    transition:none;
  }

  .keystone-mark-link:hover .keystone-mark,
  .keystone-mark-link:focus-visible .keystone-mark{
    transform:none;
  }

  .hall-card-link:hover .keystone-mark--mini,
  .hall-card-link:focus-visible .keystone-mark--mini{
    transform:translateX(-50%) scale(.565);
  }
}

/* =========================================================
   Hall page layout + keystone card previews
   ========================================================= */

.keystone-hall-page-header{
  text-align:center;
}

.keystone-hall-volume{
  margin-top:.25rem;
  opacity:.85;
}

.keystone-hall-main{
  max-width:1160px;
  margin:0 auto 1.5rem;
}

.keystone-hall-intro{
  margin-bottom:1.2rem;
}

.keystone-hall-intro-last{
  margin-bottom:0;
}

.hall-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:1.2rem;
  align-items:stretch;
  margin-top:1rem;
}

.hall-grid--keystones{
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
}

.hall-card-link{
  display:block;
  text-decoration:none;
  color:inherit;
}

.hall-card{
  position:relative;
  margin:0;
  padding:1.05rem 1rem 1rem;
  height:100%;
  box-sizing:border-box;
  border-radius:12px;
  border:1px solid rgba(209,180,100,.35);
  background:rgba(0,0,0,.30);
  transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
  overflow:hidden;
}

.hall-card::before{
  content:"";
  display:block;
  width:100%;
  height:2px;
  margin:-1.05rem -1rem .9rem;
  background:linear-gradient(90deg, rgba(209,180,100,.55), rgba(252,234,187,.12));
}

.hall-card--keystone{
  text-align:center;
  padding:1rem .95rem 1rem;
}

.hall-card h2{
  margin:.1rem 0 .42rem;
  color:#fceabb;
  font-size:1.05rem;
}

.hall-card p{
  margin:0;
  line-height:1.55;
  opacity:.95;
}

.hall-card:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 18px rgba(0,0,0,.45);
  border-color:rgba(252,234,187,.8);
  background:rgba(0,0,0,.36);
}

.hall-card-link:focus-visible .hall-card{
  outline:2px solid rgba(252,234,187,.85);
  outline-offset:3px;
  border-color:rgba(252,234,187,.85);
}

.keystone-hall-note{
  margin-top:1.4rem;
}

.keystone-hall-note--secondary{
  margin-top:1rem;
}

.keystone-hall-explore{
  margin-top:1.2rem;
}

.keystone-hall-nav{
  margin-top:1rem;
}