/* ============================================================================
   darrensweeney.net — PS3 XMB styles
   All geometry lives in the custom properties below; xmb.js reads them and
   writes per-element --x / --y / --s / --o / --ts / --cx transforms.
   ========================================================================== */

:root {
  /* centre of the SELECTED category icon */
  --anchor-x: 28vw;
  --anchor-y: 27vh;
  /* category bar */
  --cat-w: 128px;  --cat-gap: 36px;  --cat-icon: 80px;
  --cat-scale-off: .6;  --cat-opacity-off: .5;
  /* item column */
  --item-icon-sel: 72px;  --item-icon: 48px;  --sel-h: 88px;  --sel-gap: 10px;
  --row-h: 58px;  --row-h-above: 46px;  --col-top: 118px;  --above-start: 70px;
  --title-size: 22px;  --sub-size: 14px;
  /* motion */
  --t-col: 230ms;  --t-row: 150ms;  --ease: cubic-bezier(.22, .61, .36, 1);
  /* colour (Wave overrides these from the month table) */
  --accent: hsl(215 75% 65%);
  --accent-glow: hsla(215 75% 70% / .55);
  --bg-top: hsl(215 45% 22%);
  --bg-bottom: hsl(215 52% 6%);
  --fg: #fff;
  --muted: rgba(255, 255, 255, .55);
  --font: "Roboto", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg-bottom); color: var(--fg);
  font: 300 16px/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
}
body { background: linear-gradient(var(--bg-top), var(--bg-bottom)) fixed; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- background */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* --------------------------------------------------------------------- stage */
.stage {
  position: fixed; inset: 0; height: 100vh; height: 100dvh; overflow: hidden; z-index: 1;
  touch-action: none; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.stage.no-anim * { transition: none !important; }
/* Legibility scrim for the bright daytime month presets (root.theme-light is set by Wave.applyVars) */
.stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 30%),
    linear-gradient(100deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .45) 42%, rgba(0, 0, 0, 0) 75%);
}
.theme-light .stage::before { opacity: 1; }
.theme-light {
  --muted: rgba(255, 255, 255, .8);
  --shadow: 0 1px 3px rgba(0, 0, 0, .8), 0 0 14px rgba(0, 0, 0, .4);
  --cat-opacity-off: .7;
}
.theme-light .item { opacity: .85; }
.theme-light .item.is-above { opacity: .5; }
.theme-light .item.is-selected { opacity: 1; }
.anchor { position: absolute; left: var(--anchor-x); top: var(--anchor-y); width: 0; height: 0; }

/* --------------------------------------------------------------- category bar */
.bar { position: absolute; left: 0; top: 0; margin: 0; padding: 0; list-style: none; z-index: 2; }
.cat {
  position: absolute; left: 0; top: 0; width: var(--cat-w);
  margin-left: calc(var(--cat-w) / -2); margin-top: calc(var(--cat-icon) / -2);
  transform: translate3d(var(--x, 0px), 0, 0) scale(var(--s, 1));
  transform-origin: 50% calc(var(--cat-icon) / 2);
  opacity: var(--o, 1);
  transition: transform var(--t-col) var(--ease), opacity var(--t-col) var(--ease);
  will-change: transform;
}
.cat button {
  appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer; width: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.cat .ico { width: var(--cat-icon); height: var(--cat-icon); display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.cat .ico img { width: 100%; height: 100%; display: block; object-fit: contain; }
.cat-label {
  margin-top: 6px; font-size: 13px; letter-spacing: .06em; white-space: nowrap;
  text-shadow: var(--shadow); opacity: 0; transition: opacity var(--t-col) var(--ease);
}
.cat.is-selected .cat-label { opacity: 1; }

/* ------------------------------------------------------------------- columns */
.cols { position: absolute; left: 0; top: 0; z-index: 1; }
.col {
  position: absolute; left: 0; top: 0; margin: 0; padding: 0; list-style: none; outline: none;
  transform: translate3d(var(--cx, 0px), 0, 0);
  opacity: 0; visibility: hidden;
  transition: transform var(--t-col) var(--ease), opacity var(--t-col) var(--ease), visibility 0s linear var(--t-col);
}
.col.is-active { opacity: 1; visibility: visible; transition-delay: 0s; }

.item {
  position: absolute; left: calc(var(--item-icon-sel) / -2); top: calc(var(--sel-h) / -2);
  height: var(--sel-h); display: flex; align-items: center; gap: 18px;
  transform: translate3d(0, var(--y, 0px), 0);
  transition: transform var(--t-row) var(--ease), opacity var(--t-row) var(--ease);
  opacity: .75; color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer;
  will-change: transform;
}
.item.is-above { opacity: .35; }
.item.is-selected { opacity: 1; }
.item .ico {
  position: relative; flex: none; display: block;
  width: var(--item-icon-sel); height: var(--item-icon-sel);
  transform: scale(var(--s, 1)); transform-origin: 50% 50%;
  transition: transform var(--t-row) var(--ease), filter var(--t-row) var(--ease);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5));
}
.item .ico img { width: 100%; height: 100%; display: block; }
/* .glyph is a PS3 XMB icon PNG; .thumb / .avatar are content images and get a frame. */
.item .ico img.glyph { object-fit: contain; }
.item .ico img.thumb { object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.item .ico img.avatar { object-fit: cover; border-radius: 50%; }
.item.is-selected .ico { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)) drop-shadow(0 0 14px var(--accent-glow)); }
.item.is-selected .ico::before {
  content: ""; position: absolute; inset: -30%; z-index: -1; opacity: .6;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
}
.txt {
  display: flex; flex-direction: column; text-shadow: var(--shadow);
  transform: scale(var(--ts, 1)); transform-origin: 0 50%;
  transition: transform var(--t-row) var(--ease);
}
.title { font-size: var(--title-size); letter-spacing: .06em; line-height: 1.2; }
.sub { font-size: var(--sub-size); color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.badge { font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.badge::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
  background: #3fb950; box-shadow: 0 0 6px #3fb950; vertical-align: 0;
}
.tag {
  display: inline-block; font-size: 10px; letter-spacing: .12em; padding: 1px 6px; margin-left: 8px;
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 3px; vertical-align: middle; opacity: .8;
}
/* focus ring only once the keyboard has been used (body.kb is set by xmb.js) — avoids a ring on programmatic focus at load */
body.kb .col:focus-visible .item.is-selected .ico { outline: 2px solid #fff; outline-offset: 5px; border-radius: 10px; }

/* --------------------------------------------------------------------- clock */
.clock {
  position: fixed; top: 22px; right: 28px; z-index: 3;
  font-size: 14px; letter-spacing: .06em; text-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------- pills */
.pill {
  appearance: none; -webkit-appearance: none; background: rgba(0, 0, 0, .25); color: #fff;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 5px 14px;
  font: inherit; font-size: 13px; letter-spacing: .04em; cursor: pointer;
}
.pill:hover, .pill:focus-visible { background: rgba(255, 255, 255, .18); outline: none; }

/* --------------------------------------------------------------------- panel */
.panel {
  position: fixed; right: 4vw; top: var(--anchor-y); width: min(420px, 40vw); max-height: 60vh; z-index: 4;
  display: flex; flex-direction: column; overflow: hidden; outline: none;
  background: rgba(10, 16, 28, .45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .15); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .03);
  transform: translateX(24px); opacity: 0;
  transition: transform 200ms var(--ease), opacity 200ms var(--ease), border-color 200ms;
}
.panel.is-open { transform: none; opacity: 1; }
.panel.is-modal { border-color: var(--accent-glow); }
.panel[hidden] { display: none; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.panel-head h2 { margin: 0; font-size: 18px; font-weight: 300; letter-spacing: .06em; }
.panel-close { display: none; flex: none; }
.panel.is-modal .panel-close { display: inline-block; }
.panel-body { padding: 14px 18px; overflow: auto; font-weight: 400; font-size: 14px; line-height: 1.55; touch-action: pan-y; }
.panel-body p { margin: 0 0 10px; }
.panel-body p:last-child { margin-bottom: 0; }
.panel-body a { color: var(--accent); }
.panel-body .avatar-lg { width: 72px; height: 72px; border-radius: 50%; display: block; margin: 0 0 12px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.links a { text-decoration: none; }
.opts { list-style: none; margin: 0; padding: 0; }
.opts li { padding: 8px 12px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; }
.opts li.is-cursor { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.opts li[aria-selected="true"]::after { content: "✓"; color: var(--accent); }
.controls { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 12px; }
.controls td { padding: 3px 0; vertical-align: top; }
.controls td:first-child { color: var(--muted); padding-right: 12px; white-space: nowrap; }

/* -------------------------------------------------------------------- viewer */
.viewer {
  position: fixed; inset: 0; z-index: 5; background: #000; outline: none;
  display: flex; align-items: center; justify-content: center; touch-action: none;
  opacity: 0; transition: opacity 200ms var(--ease);
}
.viewer.is-open { opacity: 1; }
.viewer[hidden] { display: none; }
.viewer img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  transform: scale(.96); opacity: 0; transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}
.viewer.is-open img { transform: none; opacity: 1; }
.viewer-chrome { position: absolute; inset: 0; pointer-events: none; transition: opacity 300ms var(--ease); }
.viewer.chrome-hidden .viewer-chrome { opacity: 0; }
.viewer-close { position: absolute; top: 20px; right: 24px; pointer-events: auto; }
.viewer.chrome-hidden .viewer-close { pointer-events: none; }
.viewer-caption { position: absolute; left: 24px; bottom: 20px; font-size: 15px; letter-spacing: .04em; text-shadow: var(--shadow); }
.viewer-counter { position: absolute; right: 24px; bottom: 20px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------- toast */
.toast {
  position: fixed; top: 56px; right: 24px; z-index: 6; min-width: 240px; max-width: min(360px, 90vw);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px;
  background: rgba(8, 12, 20, .8); border: 1px solid var(--accent-glow); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  transform: translateX(calc(100% + 32px)); transition: transform 350ms var(--ease);
}
.toast.is-in { transform: none; }
.toast[hidden] { display: none; }
.toast-icon { width: 32px; height: 32px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.toast-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.toast-body { font-size: 14px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 640px) and (orientation: portrait) {
  :root {
    --anchor-x: 18vw; --anchor-y: 16vh;
    --cat-w: 84px; --cat-gap: 16px; --cat-icon: 56px;
    --item-icon-sel: 56px; --item-icon: 40px; --sel-h: 72px;
    --row-h: 50px; --row-h-above: 40px; --col-top: 96px; --above-start: 56px;
    --title-size: 16px; --sub-size: 12px;
  }
  .item { gap: 12px; }
  .txt { max-width: calc(100vw - var(--anchor-x) - 20px); }
  .title, .sub, .badge { white-space: normal; }
  .cat-label { font-size: 12px; }
  .clock { top: 14px; right: 16px; font-size: 13px; }
  .panel {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 55vh;
    border-radius: 16px 16px 0 0; border-bottom: 0;
    transform: translateY(24px);
  }
  .panel.is-open { transform: none; }
  .toast { top: 44px; right: 12px; left: 12px; min-width: 0; max-width: none; }
}
@media (max-height: 480px) {
  :root { --anchor-y: 22vh; --cat-icon: 60px; --item-icon-sel: 56px; --sel-h: 72px; --col-top: 96px; --above-start: 56px; --row-h: 50px; --row-h-above: 40px; }
  .panel { max-height: 70vh; }
}
@media (hover: none) {
  .panel .panel-close { display: inline-block; }
}

/* ------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root { --t-col: 0ms; --t-row: 0ms; }
  .panel, .viewer, .viewer img, .cat-label, .item .ico, .txt { transition: none; }
  .toast { transform: none; opacity: 0; transition: opacity 200ms; }
  .toast.is-in { opacity: 1; }
}
