/* Spherefolio: Foundry VTT-style dark UI. Shared by the site (docs/) and the GM dashboard (admin/). */
:root {
  --accent: #ff6400;
  --bg: #08070d;
  --panel: rgba(13, 12, 20, .93);
  --raise: rgba(255, 255, 255, .045);
  --line: rgba(239, 230, 216, .14);
  --accent2: #b79cff;
  --text: #efe6d8;
  --muted: #9c9282;
  --glow: color-mix(in srgb, var(--accent) 55%, transparent);
  --font: "Signika", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box }
[hidden] { display: none !important }
html, body { margin: 0; height: 100% }
body {
  overflow: hidden; color: var(--text); font: 15px/1.5 var(--font);
  background:
    radial-gradient(ellipse at 20% 20%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 55%),
    radial-gradient(ellipse at 85% 90%, color-mix(in srgb, var(--accent2) 8%, transparent), transparent 60%), var(--bg);
}
a { color: var(--accent) }
button, input, textarea { font: inherit; color: inherit }
button { cursor: pointer }
button:disabled { opacity: .4; cursor: default }
input, textarea { width: 100%; padding: 6px 8px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 3px }
textarea { resize: vertical; line-height: 1.45 }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 6px var(--glow) }
input[type=range], input[type=color] { padding: 0; accent-color: var(--accent) }
input[type=color] { height: 34px; cursor: pointer }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px }
.muted, .dim { color: var(--muted) }
.hl { color: var(--accent) }
.kicker { color: var(--accent); font: 11px var(--mono); letter-spacing: .22em; text-transform: uppercase }
h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.15 }
h3 { margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--accent2); font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--raise); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font-size: 13px; text-decoration: none }
.btn:hover:not(:disabled), .btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 8px var(--glow); outline: none }
.btn.danger:hover:not(:disabled) { border-color: #e0413a; box-shadow: 0 0 8px #e0413a88 }

/* Layout: sphere top-left, About me top-right, terminal across the bottom. */
/* Sphere top-left (~30% of the screen, click → fullscreen), terminal below it, About me down the whole right side. */
.site { display: grid; grid-template: "sphere about" minmax(0, 43fr) "term about" minmax(0, 57fr) / minmax(0, 1fr) minmax(340px, 30%); gap: 10px; height: 100dvh; padding: 10px }
#sphere-panel { grid-area: sphere }
#about { grid-area: about }
#term { grid-area: term }
.panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 30px #0009 }
.panel > header, .win > header { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 8px 6px 12px; background: rgba(0, 0, 0, .45); border-bottom: 1px solid var(--line); user-select: none }
.panel > header b, .win > header b { flex: 1; overflow: hidden; color: var(--accent2); font-size: 13px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis }
.panel > header .btn { padding: 1px 8px; font-size: 11px }
.panel > .body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 16px }
#status { font: 11px var(--mono); letter-spacing: .06em; white-space: nowrap }

/* Sphere: perspective on the stage, preserve-3d on the rotating wrapper, tiles placed once. */
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  background:
    radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 48px 48px,
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 48px 48px }
#stage:active { cursor: grabbing }
#sphere { position: relative; width: 0; height: 0; transform-style: preserve-3d; will-change: transform }

/* Cards: gradient card when empty; an uploaded image/video replaces it, with the text on a scrim. Big title, details below. */
.tile { position: absolute; left: 0; top: 0; width: var(--w); height: var(--h); margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2); padding: 0; overflow: hidden; background: #14111d; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: calc(var(--w) * .085); cursor: pointer }
.tile:hover, .tile:focus-visible { border-color: var(--accent); box-shadow: 0 0 18px var(--glow); outline: none }
.card { display: flex; flex-direction: column; gap: .3em; width: 100%; height: 100%; padding: .6em .7em; text-align: left;
  background: radial-gradient(circle at 85% 10%, hsl(var(--hue) 85% 50% / .5), transparent 60%), linear-gradient(160deg, hsl(var(--hue) 40% 17%), #0a0911 85%) }
.label { position: absolute; inset: 0 0 auto; display: flex; flex-direction: column; gap: .3em; padding: .55em .65em 1.6em; text-align: left; pointer-events: none;
  background: linear-gradient(rgba(6, 5, 11, .92), rgba(6, 5, 11, .68) 60%, transparent) }
.card b, .label b { font-size: 1.3em; font-weight: 600; line-height: 1.08; text-shadow: 0 1px 3px #000 }
.card span, .label span { display: -webkit-box; overflow: hidden; color: #ddd3c4; font-size: .72em; line-height: 1.25; -webkit-line-clamp: 2; -webkit-box-orient: vertical }
.card small, .label small { color: var(--accent2); font: .6em var(--mono); letter-spacing: .08em; text-transform: uppercase }
.media { position: absolute; inset: 0 }
.media > *, .portrait > img, .portrait > video, .mini > * { display: block; width: 100%; height: 100%; object-fit: cover }
.tile .media > * { pointer-events: none }
.mini { display: block; width: 100%; height: 100% }
.sphere-body { display: flex; flex: 1; min-height: 0 }
#projects { flex: 0 0 clamp(210px, 34%, 320px); margin: 0; padding: 6px; overflow-y: auto; list-style: none; background: rgba(0, 0, 0, .22); border-left: 1px solid var(--line) }
.pl { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; width: 100%; padding: 6px; background: none; border: 1px solid transparent; border-radius: 5px; text-align: left }
.pl:hover, .pl:focus-visible { background: var(--raise); border-color: var(--accent); outline: none }
.pl .mini { height: 48px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px }
.pl b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2 }
.pl > span:last-child { min-width: 0 }
.pl small { display: block; overflow: hidden; color: var(--accent2); font: 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis }
.pl.no-img { grid-template-columns: 1fr; padding: 9px 8px }
.pl.no-img b { font-size: 16px }
.tile.lit { border-color: var(--accent); box-shadow: 0 0 18px var(--glow) }
/* Hover zoom: `scale` composes after the inline placement transform, so the card grows and lifts out of the sphere. */
.tile { transition: scale .2s ease, box-shadow .2s ease }
.tile:hover, .tile.lit { scale: 1.15 }
.full #sphere-panel { position: fixed; inset: 0; z-index: 15; height: auto; background: var(--bg); border: 0; border-radius: 0 }
body:not(.full) #stage { cursor: zoom-in }

/* About me */
#about h2 { font-size: 24px }
#about .links { margin: 10px 0 14px }
#about details { border-top: 1px solid var(--line) }
#about details[open] { padding-bottom: 8px }
#about summary { display: flex; align-items: center; gap: 10px; padding: 11px 2px; color: var(--accent2); font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; list-style: none; cursor: pointer; user-select: none }
#about summary::-webkit-details-marker { display: none }
#about summary::after { content: "▸"; margin-left: auto; font-size: 13px; transition: transform .15s }
#about details[open] > summary::after { transform: rotate(90deg) }
#about summary:hover, #about summary:focus-visible { color: var(--text); outline: none }
#about .entry > b { font-size: 14px }

/* Windows (project sheets) */
.win { position: fixed; z-index: 20; display: flex; flex-direction: column; width: min(820px, calc(100vw - 16px)); height: min(760px, calc(100dvh - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 48px #000c; backdrop-filter: blur(8px) }
.win > header { border-radius: 6px 6px 0 0; cursor: move; touch-action: none }
.hero { margin-bottom: 14px; overflow: hidden; background: #000; border: 1px solid var(--line); border-radius: 4px }
.hero > img, .hero > video { display: block; width: 100%; height: min(420px, 45dvh, 75vw); object-fit: contain }
.x { padding: 0 6px; background: none; border: 0; color: var(--muted); font-size: 15px }
.x:hover { color: var(--accent) }
.win .body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 16px }
.sheet-top { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start }
.portrait { aspect-ratio: 4 / 3; overflow: hidden; background: #000; border: 1px solid var(--line); border-radius: 4px }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin: 10px 0 0 }
.stats div { padding: 4px 8px; background: var(--raise); border: 1px solid var(--line); border-radius: 4px }
.stats dt { overflow: hidden; color: var(--accent2); font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis }
.stats dd { margin: 0; font-weight: 600 }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 }
.chips span { padding: 1px 9px; border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent); border-radius: 99px; color: color-mix(in srgb, var(--accent2) 70%, var(--text)); font-size: 12px }
.body p { margin: 8px 0 }
.body ul { margin: 8px 0; padding-left: 18px }
.body li { margin: 5px 0 }
.body li::marker { color: var(--accent) }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 12px 0 }
.gallery button { position: relative; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; background: #000; border: 1px solid var(--line); border-radius: 3px; cursor: zoom-in }
.gallery button:hover { border-color: var(--accent) }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover }
.badge { position: absolute; left: 5px; top: 3px; font-size: 12px; font-style: normal; text-shadow: 0 0 3px #000, 0 0 3px #000 }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px }
.entry { padding: 10px 0; border-bottom: 1px dashed var(--line) }
.entry:last-child { border: 0 }
.entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px }
.entry-head span { color: var(--accent2); font: 12px var(--mono) }
.comp { margin: 10px 0 0; padding: 0; list-style: none }
.comp button { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 5px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left }
.comp button:hover, .comp button.on { background: var(--raise); box-shadow: inset 2px 0 var(--accent) }
.comp .mini { width: 48px; height: 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px }
.comp b { overflow: hidden; font-weight: 400; white-space: nowrap; text-overflow: ellipsis }
.comp small { color: var(--muted); font: 11px var(--mono) }

/* Terminal */
#term .body { color: #d9d0c1; font: 14px/1.6 var(--mono); cursor: text;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px), #050409 }
#term-out > div { white-space: pre-wrap; overflow-wrap: anywhere }
#term-out > .pre { white-space: pre; overflow-x: auto }
#term a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted; cursor: pointer }
#term img { height: 72px; margin: 6px 6px 0 0; border: 1px solid var(--line); border-radius: 3px; vertical-align: top }
#term-form { display: flex; gap: 10px; align-items: baseline }
#term-in { flex: 1; padding: 0; background: none; border: 0; caret-color: var(--accent) }
#term-in:focus { box-shadow: none; outline: none }
#term-in::placeholder { color: #5d5566 }
#suggest { margin: 6px 0 2px; padding: 6px 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 4px }
.sg-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 3px 0 }
.sg-row > span { flex: 0 0 72px; color: var(--accent2); font-size: 11px; letter-spacing: .12em; text-transform: uppercase }
.sg { padding: 1px 8px; background: none; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font: 12px/1.6 var(--mono) }
.sg b { color: var(--accent); font-weight: 400 }
.sg:hover, .sg:focus-visible { border-color: var(--accent); color: var(--text); outline: none }

@media (max-width: 800px) {
  .site { display: flex; flex-direction: column; height: auto; min-height: 100dvh; overflow: auto }
  .site .panel { flex: none }
  #sphere-panel { height: 58vh }
  #projects { flex-basis: 48%; padding: 4px }
  .pl { grid-template-columns: 44px 1fr; gap: 7px; padding: 5px }
  .pl .mini { height: 33px }
  .pl b { font-size: 12px }
  .pl.no-img b { font-size: 14px }
  .pl small { font-size: 9px }
  #term { height: 75vh }
  #stage { touch-action: pan-y }
  .sheet-top { grid-template-columns: 1fr }
  #term .body { font-size: 13px }
  .sg-row > span { flex-basis: 100% }
}
