/* ==========================================================================
   Entry page — the stone circle of portals (index.html / da.html).
   The sky, header and rune language come from assets/world.css.
   ========================================================================== */
/* I5 · the circle remembers: portals you've been through burn a little brighter */
.seen .core{opacity:calc(.85 - .35 * var(--dayk))}
.seen .pa::after{content:'';position:absolute;inset:4%;border-radius:50%;pointer-events:none;
  box-shadow:0 0 0 1px color-mix(in srgb,var(--acc) 45%,transparent),0 0 26px 2px color-mix(in srgb,var(--acc) 22%,transparent)}
.seen .pr{text-shadow:0 0 26px var(--glow),0 0 8px var(--glow)}

/* I4 · the first visit: the sky starts dark, the portals light one by one (the front one
   first, then its neighbours either side), then the runes, the floor and the words wake */
.ritual-dark{position:fixed;inset:0;z-index:3;pointer-events:none;background:#020306;opacity:0}
@keyframes kindle{0%{opacity:0;transform:scale(.6);filter:brightness(.4)}45%{opacity:1;transform:scale(1.07);filter:brightness(2.1)}100%{opacity:1;transform:scale(1);filter:none}}
@keyframes wakefade{from{opacity:0}to{opacity:1}}
@keyframes dark-lift{0%{opacity:.94}55%{opacity:.82}100%{opacity:0}}
@media (prefers-reduced-motion:no-preference){
  .ritual .ritual-dark{animation:dark-lift 4.6s ease both}
  .ritual .item .pa{animation:kindle 1.3s ease both;animation-delay:calc(.5s + var(--ri) * .42s)}
  .ritual .item .beam,.ritual .item .foot,.ritual .item .pl{animation:wakefade .8s ease both;animation-delay:calc(1s + var(--ri) * .42s)}
  .ritual .grid .flow,.ritual .grid .flow circle,.ritual .grid .spokes,.ritual .wv{animation-play-state:paused}
  .ritual .treeline{animation:wakefade 1.6s ease 3.4s both}
  .ritual .floor{animation:wakefade 1.4s ease 3.1s both}
  .ritual .chrome{animation:wakefade 1.2s ease 3.8s both}
}
.ritual .item,.ritual .stage{z-index:4}
.ritual .ring-nav{position:relative;z-index:4}

/* E4 · rack focus: hovering a portal softly blurs what lies behind it */
@media (hover:hover) and (prefers-reduced-motion:no-preference){
  .treeline,.floor,.pd,.disc,.stars{transition:filter .5s ease,opacity .9s ease}
  .stage:has(.pd:hover) .treeline{filter:blur(3px)}
  .stage:has(.pd:hover) .floor{filter:blur(2px)}
  .stage:has(.pd:hover) .pd:not(:hover){filter:blur(2.5px)}
  .world:has(.stage .pd:hover) .disc,.world:has(.stage .pd:hover) .stars{filter:blur(2px)}
}

/* the ring */
.ring-wrap{flex:1;display:flex;flex-direction:column;justify-content:center;min-height:0}
.ring-nav{display:flex;flex-direction:column;align-items:center}
.stage{--r:420px;--d:160px;--lift:40px;--b:290px;--fy:218px;
  --dayk:calc(var(--dl,0) * 1.07); /* 0 at night, about 1 in full daylight (--dl comes from world.js) */
  --sym:#fff; /* the colour a symbol takes when its portal is hovered */
  position:relative;width:100%;height:440px;overflow:hidden;touch-action:none;
  perspective:1900px;perspective-origin:50% 0;transform-origin:50% var(--fy)}
.cam{transition:transform .9s cubic-bezier(.6,0,.9,.4),opacity .35s ease .5s}
.entering .cam{transform:scale(4.2);opacity:0}
/* coming back from a menu page: its rune glows and the circle wakes softly around it */
@keyframes rune-back{0%{text-shadow:0 0 18px var(--acc),0 0 6px var(--acc);transform:scale(1.35)}100%{text-shadow:none;transform:none}}
@keyframes menu-back{0%{opacity:.55}100%{opacity:1}}
@media (prefers-reduced-motion:no-preference){
  .glow-back .mr{display:inline-block;animation:rune-back 2.2s ease-out both}
  .from-menu .stage,.from-menu .hero{animation:menu-back 1.2s ease both}
}
/* coming back from a world: the circle opens zoomed into that world's portal and pulls back out */
.returning .cam{transform:scale(4.2);opacity:0;transition:none}
.returning .chrome{opacity:0;transition:none}
.returned .cam{transition:transform 1.1s cubic-bezier(.2,.7,.2,1),opacity .5s ease}
.returned .chrome{transition:opacity 1.1s ease .35s}
.no-anim .item,.no-anim .floor,.no-anim .pd,.no-anim .pl{transition:none !important}
/* The carved runes stand behind the portals. assets/entry.js adds a soft hole to the
   mask behind each portal (the veil), so the runes fade where a portal stands. */
.treeline{position:absolute;left:0;right:0;top:calc(var(--b) * .02);width:100%;height:calc(var(--b) * .92);pointer-events:none;
  -webkit-mask-image:linear-gradient(to bottom,transparent 0%,#000 30%,#000 68%,transparent 100%);mask-image:linear-gradient(to bottom,transparent 0%,#000 30%,#000 68%,transparent 100%);
  -webkit-mask-composite:source-in;mask-composite:intersect}
/* by day the bark turns dark and its notches light */
.bark-base{fill:color-mix(in srgb,#16222c calc(var(--dayk) * 88%),var(--tree))}
.bark-marks{fill:color-mix(in srgb,var(--sky2) calc(var(--dayk) * 70%),var(--sky3))}
.scene{position:absolute;left:50%;top:0;width:0;height:0;transform-style:preserve-3d}
.floor{position:absolute;left:calc(var(--r) * -1 - 50px);top:calc(var(--b) - var(--r) - 50px);width:calc(var(--r) * 2 + 100px);height:calc(var(--r) * 2 + 100px);
  border-radius:50%;border:1px dashed color-mix(in srgb,var(--floor) 28%,transparent);
  background:radial-gradient(circle,color-mix(in srgb,var(--floor) 8%,transparent),transparent 62%);transform:rotateX(90deg);transition:transform .9s cubic-bezier(.65,0,.25,1)}
.floor-ring1{position:absolute;inset:90px;border-radius:50%;border:1px solid color-mix(in srgb,var(--floor) 9%,transparent)}
.floor-ring2{position:absolute;inset:22px;border-radius:50%;border:1px dotted color-mix(in srgb,var(--floor) 20%,transparent)}
.floor-fx{position:absolute;inset:0;opacity:0;transition:opacity 1.6s ease}
.floor .spark{width:4px;height:4px}
.floor .glow{width:5px;height:5px;animation-name:glowpulse;animation-direction:normal}

.item{position:absolute;left:calc(var(--d) / -2);top:calc(var(--b) - var(--lift) - var(--d));width:var(--d);transition:transform .9s cubic-bezier(.65,0,.25,1)}
.pd{display:flex;flex-direction:column;align-items:center;text-decoration:none;color:#eef2f6;transition:opacity .9s ease}
.pd:focus-visible{outline:none}
.pd:focus-visible .pa{outline:2px solid var(--acc);outline-offset:8px;border-radius:50%}
/* By day each portal gets a dusk lens and dark ink, so it stands out against the light sky. */
.pa{position:relative;display:block;width:var(--d);height:var(--d);
  --pline:color-mix(in srgb,#14202b calc(var(--dayk) * 90%),var(--line));--pdraw:color-mix(in srgb,#14202b calc(var(--dayk) * 90%),var(--draw))}
.pa::before{content:'';position:absolute;inset:3%;border-radius:50%;pointer-events:none;
  background:radial-gradient(circle,rgba(16,26,40,calc(.62 * var(--dayk))) 0%,rgba(16,26,40,calc(.5 * var(--dayk))) 48%,rgba(16,26,40,calc(.22 * var(--dayk))) 62%,transparent 71%)}
.core{position:absolute;inset:-16%;border-radius:50%;opacity:calc(.6 - .35 * var(--dayk));transition:opacity .6s ease;animation:breathe 6s ease-in-out infinite;
  background:radial-gradient(circle,color-mix(in srgb,var(--hot) 42%,transparent) 0%,color-mix(in srgb,var(--core) 26%,transparent) 20%,color-mix(in srgb,var(--core) 14%,transparent) 46%,transparent 70%)}
.lens{position:absolute;inset:6%;border-radius:50%;overflow:hidden;
  -webkit-mask-image:radial-gradient(circle,#000 40%,transparent 71%);mask-image:radial-gradient(circle,#000 40%,transparent 71%)}
.ph{position:absolute;inset:0;width:100%;height:100%;color:var(--pdraw);stroke-width:1.3;opacity:.38;transition:opacity .6s ease,color .5s ease,filter .5s ease}
.on .ph,.pd:hover .ph{opacity:.72}
.ph path{stroke-dasharray:240;stroke-dashoffset:0}
/* hovering a portal: its drawing turns white, glows and flickers like a spell */
.pd:hover .ph,.pd:focus-visible .ph{color:var(--sym);filter:drop-shadow(0 0 3px var(--sym)) drop-shadow(0 0 10px color-mix(in srgb,var(--sym) 55%,transparent))}
.grid{position:absolute;inset:0;width:100%;height:100%;color:var(--pline)}
.grid g{fill:none;stroke:currentColor}
/* the rings flow slowly inwards, and each ring is a dashed band turning its own way, like a spell */
.grid .flow{stroke-width:.7;opacity:.55;transform-box:fill-box;transform-origin:center;animation:flow 8.5s linear infinite}
.grid .spokes{stroke-width:.6;opacity:.4;transform-box:fill-box;transform-origin:center;animation:spin 90s linear infinite}
.on .grid .flow{animation-duration:5.5s}
.grid .flow circle{transform-box:fill-box;transform-origin:center;animation:spin calc(var(--rd) / .4) linear infinite}
.grid .flow circle:nth-child(1){stroke-dasharray:29.7 19.8;--rd:62s;animation-delay:-55s}
.grid .flow circle:nth-child(2){stroke-dasharray:14.5 5 3.3 18.6;--rd:70s;animation-delay:-54s}
.grid .flow circle:nth-child(3){stroke-dasharray:5.3 12.3;--rd:90s;animation-delay:-29s}
.grid .flow circle:nth-child(4){stroke-dasharray:18.5 12.3;--rd:62s;animation-delay:-32s}
.grid .flow circle:nth-child(5){stroke-dasharray:8.8 3 2 11.3;--rd:90s;animation-delay:-37s}
.grid .flow circle:nth-child(6){stroke-dasharray:3.1 7.1;--rd:46s;animation-delay:-11s}
.grid .flow circle:nth-child(7){stroke-dasharray:10.2 6.8;--rd:90s;animation-delay:-32s}
.grid .flow circle:nth-child(8){stroke-dasharray:5.1 1.8 1.2 6.6;--rd:62s;animation-delay:-40s}
.grid .flow circle:nth-child(9){stroke-dasharray:1.9 4.4;--rd:70s;animation-delay:-50s}
.grid .flow circle:nth-child(10){stroke-dasharray:7 4.6;--rd:46s;animation-delay:-6s}
.it1 .grid .flow circle:nth-child(3),.it1 .grid .flow circle:nth-child(5),.it1 .grid .flow circle:nth-child(7),.it1 .grid .flow circle:nth-child(9){animation-direction:reverse}
.it2 .grid .flow circle:nth-child(1),.it2 .grid .flow circle:nth-child(4),.it2 .grid .flow circle:nth-child(6),.it2 .grid .flow circle:nth-child(10){animation-direction:reverse}
.it3 .grid .flow circle:nth-child(3),.it3 .grid .flow circle:nth-child(5),.it3 .grid .flow circle:nth-child(6),.it3 .grid .flow circle:nth-child(7),.it3 .grid .flow circle:nth-child(9),.it3 .grid .flow circle:nth-child(10){animation-direction:reverse}
.it4 .grid .flow circle:nth-child(1),.it4 .grid .flow circle:nth-child(5),.it4 .grid .flow circle:nth-child(6),.it4 .grid .flow circle:nth-child(8),.it4 .grid .flow circle:nth-child(9),.it4 .grid .flow circle:nth-child(10){animation-direction:reverse}
.it5 .grid .flow circle:nth-child(2),.it5 .grid .flow circle:nth-child(3),.it5 .grid .flow circle:nth-child(4),.it5 .grid .flow circle:nth-child(6),.it5 .grid .flow circle:nth-child(7),.it5 .grid .flow circle:nth-child(8){animation-direction:reverse}
.it6 .grid .flow circle:nth-child(1),.it6 .grid .flow circle:nth-child(2),.it6 .grid .flow circle:nth-child(4),.it6 .grid .flow circle:nth-child(5),.it6 .grid .flow circle:nth-child(6),.it6 .grid .flow circle:nth-child(8),.it6 .grid .flow circle:nth-child(10){animation-direction:reverse}
.it7 .grid .flow circle:nth-child(2),.it7 .grid .flow circle:nth-child(3),.it7 .grid .flow circle:nth-child(5),.it7 .grid .flow circle:nth-child(7),.it7 .grid .flow circle:nth-child(9){animation-direction:reverse}
/* the ripples move slowly outwards */
.wv{position:absolute;inset:0;border-radius:50%;border:1px solid color-mix(in srgb,var(--pline) 26%,transparent);pointer-events:none;animation:ripple 12s linear infinite}
.w2{animation-delay:-4s}.w3{animation-delay:-8s}
.on .wv{animation-duration:7.5s;border-color:color-mix(in srgb,var(--pline) 58%,transparent)}
.entering .on .wv{animation-duration:.8s}
/* motes rising from a hovered portal */
.mote{position:absolute;bottom:30%;width:3px;height:3px;border-radius:50%;background:var(--sym);box-shadow:0 0 6px var(--sym);opacity:0;pointer-events:none}
.m1{left:34%;--mdx:-8px}.m2{left:48%;--mdx:6px}.m3{left:58%;--mdx:-4px}.m4{left:68%;--mdx:10px}
.pr{position:absolute;left:50%;top:50%;font-family:'Skurd',serif;font-size:34px;line-height:1;color:var(--acc);text-shadow:0 0 20px var(--glow);
  transform:translate(-50%,-50%);transition:transform .6s ease}
.on .pr,.pd:hover .pr{transform:translate(-50%,-50%) scale(1.1)}
.beam{display:block;width:1px;height:var(--lift);background:linear-gradient(to bottom,color-mix(in srgb,var(--hot) 42%,transparent),transparent)}
.foot{display:block;width:48px;height:6px;margin-top:-3px;border-radius:50%;background:radial-gradient(ellipse,color-mix(in srgb,var(--hot) 42%,transparent),transparent 70%)}
.pl{display:block;width:max-content;min-width:180px;margin-top:8px;text-align:center;white-space:nowrap;font-family:'Cinzel',Georgia,serif;font-weight:500;font-size:17px;line-height:1.2;text-shadow:0 1px 10px rgba(0,0,0,.75);transition:opacity .9s ease}

.controls{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:6px}
.ctl{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:1px solid color-mix(in srgb,var(--muted) 35%,transparent);border-radius:50%;background:transparent;color:var(--muted);cursor:pointer}
.dots{display:flex;align-items:center;gap:2px}
.dot{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:50%;border:1px solid transparent;background:transparent;color:var(--muted);font-family:'Skurd',serif;font-size:20px;line-height:1;cursor:pointer}
.dot.on{color:var(--acc);border-color:color-mix(in srgb,var(--acc) 55%,transparent)}
.dot:hover{opacity:.85}
.ctl:focus-visible,.dot:focus-visible,.sm:focus-visible,.dest-back:focus-visible{outline:2px solid var(--acc);outline-offset:4px}

/* No Latin letters on hover here: the language switch, and the Aa button on touch screens, show them. */
.mode-runes:not(.reveal-all) .circle .rv .rn{opacity:1}
.mode-runes:not(.reveal-all) .circle .rv .lt{opacity:0}

/* small menu */
.small-menu{width:100%;max-width:860px;margin:0 auto;padding:14px 20px 18px;display:flex;flex-direction:column;align-items:center;gap:8px}
.chip{display:block;color:color-mix(in srgb,var(--menu) 22%,transparent)}
.small-menu ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:0 20px}
.sm{display:flex;align-items:center;gap:9px;min-height:44px;padding:0 6px;color:var(--menu);text-decoration:none;font-size:17px;font-weight:500}
.sm:hover{text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--menu) 55%,transparent);text-underline-offset:6px}
.mr{font-family:'Skurd',serif;font-size:18px;color:var(--acc)}
.dia{color:color-mix(in srgb,var(--menu) 40%,transparent);font-size:8px}

/* the world behind a portal that isn't built yet */
.dest{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center;
  background:radial-gradient(circle at 50% 42%,color-mix(in srgb,var(--hot) 14%,transparent),transparent 55%),linear-gradient(180deg,var(--sky1) 0%,var(--sky2) 55%,var(--sky3) 100%);
  animation:arrive .7s ease both}
.dest[hidden]{display:none}
.dest-rune{font-family:'Skurd',serif;font-size:64px;line-height:1;color:var(--acc);text-shadow:0 0 24px var(--glow)}
.dest-name{margin:0;font-family:'Cinzel',Georgia,serif;font-weight:400;font-size:48px;line-height:1.05;color:var(--ink)}
.dest-note{margin:0;font-size:17px;color:var(--ink2)}
.dest-back{display:flex;align-items:center;gap:8px;min-height:44px;margin-top:10px;padding:0 20px;border:1px solid color-mix(in srgb,var(--ink) 25%,transparent);border-radius:999px;background:transparent;color:var(--ink);font-size:16px;font-weight:500;cursor:pointer}

@keyframes ripple{0%{transform:scale(.3);opacity:0;border-radius:50%}12%{opacity:.85}50%{border-radius:47% 53% 52% 48%}100%{transform:scale(1.4);opacity:0;border-radius:50%}}
@keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.05)}}
@keyframes flow{from{transform:scale(1)}to{transform:scale(.73)}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes hyphae-grow{from{stroke-dashoffset:240}to{stroke-dashoffset:0}}
@keyframes hyphae-a{from{stroke-dashoffset:240}to{stroke-dashoffset:0}}
@keyframes hyphae-b{from{stroke-dashoffset:240}to{stroke-dashoffset:0}}
@keyframes symflicker{0%{opacity:.72}7%{opacity:.38}9%{opacity:.9}20%{opacity:.62}22%{opacity:.95}41%{opacity:.7}43%{opacity:.48}45%{opacity:.88}63%{opacity:.78}65%{opacity:.4}67%{opacity:.92}86%{opacity:.66}100%{opacity:.72}}
@keyframes mote-rise{0%{opacity:0;translate:0 0}15%{opacity:.9}100%{opacity:0;translate:var(--mdx) -70px}}
@media (prefers-reduced-motion:no-preference){
  /* the front portal draws its symbol once it has arrived in the centre (the turn takes .9s),
     and again each time it is hovered (entry.js swaps rp0/rp1 to restart it) */
  .on .ph path{animation:hyphae-grow 1.6s ease .9s both}
  .rp0 .ph path{animation:hyphae-a 1.6s ease both}
  .rp1 .ph path{animation:hyphae-b 1.6s ease both}
  .pd:hover .ph,.pd:focus-visible .ph{animation:symflicker 2.6s steps(1,end) infinite}
  .pd:hover .mote{animation:mote-rise 2.2s ease-out infinite}
  .pd:hover .m2{animation-delay:.5s}.pd:hover .m3{animation-delay:1.1s}.pd:hover .m4{animation-delay:1.6s}
}
@media (prefers-reduced-motion:reduce){
  .wv,.core,.grid .flow,.grid .flow circle,.grid .spokes{animation:none !important}
  .wv{opacity:.35}.w1{transform:scale(.85)}.w2{transform:scale(1.1)}.w3{transform:scale(1.3)}
  .cam,.item,.floor,.pd,.pl,.floor-fx,.dest{transition:none !important;animation:none !important}
}
@media (min-width:761px) and (max-width:1100px){
  .stage{--r:300px;--d:130px;--lift:32px;--b:260px;--fy:204px;height:400px;perspective:1500px}
  .pr{font-size:28px}
}
@media (min-width:761px) and (max-height:760px){
  .stage{height:416px}
  .small-menu{padding:8px 20px 12px}
}
@media (max-width:760px){
  .stage{--r:150px;--d:92px;--lift:24px;--b:200px;--fy:160px;height:310px;perspective:800px}
  .controls{gap:6px}
  .dots{gap:0}
  .pr{font-size:22px}
  .pl{width:130px;min-width:0;font-size:14px;white-space:normal}
  .dia{display:none}
  .dest-name{font-size:32px}
}
@media (max-width:760px){
  .dot{width:40px}
}
@media (max-width:380px){
  .dot{width:36px}
}

