/* Paired Line Drift
   Layout: full-bleed line canvas; page menu top-left; each page is one glass card
   bottom-left; admin settings panel top-right. Single dark look by design. */
:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #fff;
  --fg-dim: rgba(255, 255, 255, 0.62);
  --fg-faint: rgba(255, 255, 255, 0.38);
  --rule: rgba(255, 255, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --rim-hi: rgba(255, 255, 255, 0.75);
  --rim-lo: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.55);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sound-hint.glass {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Liquid glass: blurred, brightened backdrop, a soft inner sheen, and a
   specular rim that is brightest on the top-left edge. */
.glass {
  position: relative;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 38%, rgba(255, 255, 255, 0.02) 62%, rgba(255, 255, 255, 0.09)),
    var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%) brightness(1.15);
  backdrop-filter: blur(22px) saturate(170%) brightness(1.15);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -8px 24px rgba(255, 255, 255, 0.04),
    0 18px 50px var(--shadow);
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--rim-hi), var(--rim-lo) 32%, var(--rim-lo) 68%, rgba(255, 255, 255, 0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.pld-page {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-inline: clamp(16px, 5vw, 64px);
  /* top clears the page menu, bottom clears the sound switch */
  padding-block: calc(84px + env(safe-area-inset-top, 0px)) calc(clamp(68px, 9vh, 96px) + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  will-change: transform;
}
.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: min(66.667vw, 100%);   /* about two thirds of the window */
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: clamp(22px, 3vw, 34px) clamp(22px, 3.4vw, 40px);
  border-radius: 36px;
  pointer-events: auto;
}
/* Narrow screens: the card uses the full width instead of two thirds */
@media (max-width: 760px) {
  .card { width: 100%; }
}

/* Page cards: glass frame fixed, inner area scrolls */
.page-card { padding: 0; gap: 0; overflow: hidden; }
.page-card > .card-scroll {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: clamp(22px, 3vw, 34px) clamp(22px, 3.4vw, 40px);
}
.back-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-dim);
  text-decoration: none;
}
.back-link:hover { color: var(--fg); }

/* Sub-pages listed under their parent: picture (featured image) and title */
.child-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 18px;
  width: 100%;
  margin-top: 8px;
}
.child-link { display: flex; flex-direction: column; gap: 8px; color: var(--fg); text-decoration: none; min-width: 0; }
.child-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease, filter 0.25s ease;
}
.child-link:hover .child-thumb { transform: scale(1.02); filter: brightness(1.1); }
.child-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.page-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(36px, 6.5vw, 88px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* Page content from the WordPress editor: text, images, video, embeds. */
.content {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.86);
}
.content > * { margin-block: 0; max-width: 65ch; }
.content > * + * { margin-top: 1.1em; }
.content > figure, .content > .wp-block-image, .content > .wp-block-video,
.content > .wp-block-embed, .content > .wp-block-gallery, .content > .wp-block-columns,
.content > .wp-block-table, .content > .wp-block-group { max-width: none; }

/* Tables (Table block): thin light rules on the glass, no boxes */
.content .wp-block-table { overflow-x: auto; }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.content .wp-block-table th,
.content .wp-block-table td,
.content th, .content td {
  padding: 11px 14px 11px 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
  vertical-align: top;
}
.content .wp-block-table thead,
.content .wp-block-table tfoot { border: 0; }
.content .wp-block-table thead th,
.content thead th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom-color: rgba(255, 255, 255, 0.45);
}
.content .wp-block-table tbody tr:last-child td { border-bottom: 0; }
/* Two-column tables (label | text, such as years | job): keep the left column on
   one line, so long text on the right can't squeeze "2014-2020" into a stack. */
.content .wp-block-table tr:has(> td:nth-child(2):last-child) > td:first-child {
  width: 1%;
  white-space: nowrap;
  padding-right: 24px;
}
/* "Stripes" table style, in glass tints instead of light grey */
.content .wp-block-table.is-style-stripes { border-bottom: 0; }
.content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: rgba(255, 255, 255, 0.05); }
.content .wp-block-table.is-style-stripes td,
.content .wp-block-table.is-style-stripes th { border: 0; padding-left: 12px; }

/* Columns and grids */
.content .wp-block-columns { gap: 24px; margin-bottom: 0; }
.content .wp-block-column > * { margin-block: 0; }
.content .wp-block-column > * + * { margin-top: 0.8em; }
.content .wp-block-column h3 { font-size: 1.1em; }
.content h2, .content h3, .content h4 {
  font-family: var(--display);
  color: var(--fg);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.content h2 { font-size: 1.6em; font-weight: 600; }
.content h3 { font-size: 1.25em; font-weight: 600; }
.content a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.45); }
.content a:hover { text-decoration-color: var(--fg); }
.content img, .content video, .content iframe { display: block; max-width: 100%; height: auto; border-radius: 20px; }
/* Images and videos always keep their proportions and are shown whole: at most
   as wide as the card and as tall as the card's visible area. A fixed size set in the editor is ignored, because
   on a narrower card it would squash the picture. */
.content img, .content video {
  width: auto !important;
  height: auto !important;
    /* --fit is measured by the page script: the room in the card under the title */
  max-height: var(--fit, calc(100vh - 220px));
  object-fit: contain;
}
.content iframe { width: 100%; border: 0; }
.content figure { margin-inline: 0; }
.content figcaption { margin-top: 8px; font-size: 13px; color: var(--fg-dim); text-align: left; }
.content blockquote { margin-inline: 0; padding-left: 16px; border-left: 2px solid rgba(255, 255, 255, 0.5); }
.content ul, .content ol { padding-left: 1.3em; }
.content hr { border: 0; border-top: 1px solid var(--rule); }
.edit-link { font-size: 12px; color: var(--fg-dim); }

/* Page menu, top left */
.site-nav.glass {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 1;
  display: flex;
  gap: 2px;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 5px;
  border-radius: 999px;
}
.site-nav a {
  flex: none;
  padding: 8px 15px;
  border-radius: 999px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.site-nav a:hover { background: rgba(255, 255, 255, 0.12); }
.site-nav a[aria-current="page"] { background: var(--fg); color: var(--bg); }

/* Sound switch: speaker icon at the end of the page menu */
.site-nav .nav-sep { flex: none; width: 1px; margin: 7px 3px; background: rgba(255, 255, 255, 0.18); }
.site-nav .sound-toggle,
.site-nav .sound-toggle[aria-pressed] {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  box-shadow: none;
}
.site-nav .sound-toggle:hover { background: rgba(255, 255, 255, 0.12); }
.site-nav .sound-toggle[aria-pressed="false"] { color: var(--fg-dim); }
.sound-toggle svg { width: 18px; height: 18px; }
.sound-toggle[aria-pressed="true"] .i-off,
.sound-toggle[aria-pressed="false"] .i-on { display: none; }

/* On phones the settings panel sits under the page menu instead of beside it */
@media (max-width: 600px) {
  .panel { top: calc(72px + env(safe-area-inset-top, 0px)); max-height: calc(100% - 88px); }
}

/* Leave room for the WordPress toolbar when logged in (32px, or 46px on small screens) */
.admin-bar .site-nav.glass, .admin-bar .panel { top: calc(48px + env(safe-area-inset-top, 0px)); }
.admin-bar .pld-page { padding-top: calc(116px + env(safe-area-inset-top, 0px)); }
.admin-bar .panel { max-height: calc(100% - 64px); }
.admin-bar .panel.expanded { top: 48px; }
@media (max-width: 782px) {
  .admin-bar .site-nav.glass, .admin-bar .panel, .admin-bar .panel.expanded { top: 62px; }
  .admin-bar .pld-page { padding-top: 130px; }
}
@media (max-width: 600px) {
  .admin-bar .panel { top: 118px; max-height: calc(100% - 134px); }
}

.panel {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: min(312px, calc(100% - 32px));
  max-height: calc(100% - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 12px 18px;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--rule);
  scrollbar-width: thin;
}
.group { display: flex; flex-direction: column; gap: 11px; }
.group + .group { padding-top: 16px; border-top: 1px solid var(--rule); }
.group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.row { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: baseline; }
.row label { min-width: 0; color: var(--fg); }
.row output { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.row input[type="range"] { grid-column: 1 / -1; }

input[type="range"] {
  --pct: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.85) var(--pct), rgba(255, 255, 255, 0.16) var(--pct));
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 18px;
  margin-top: -6.5px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #fff, rgba(232, 236, 244, 0.95));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 -1px 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}
input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 18px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #fff, rgba(232, 236, 244, 0.95));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }

button, .file-btn {
  font: inherit;
  font-weight: 500;
  color: var(--fg);
  background: var(--glass-strong);
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
button:hover, .file-btn:hover { background: rgba(255, 255, 255, 0.22); }
button:active, .file-btn:active { transform: scale(0.96); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }
button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.file-btn { display: inline-block; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn:focus-within { outline: 2px solid var(--fg); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.track { color: var(--fg-dim); line-height: 1.4; overflow-wrap: anywhere; }
.transport { display: flex; flex-direction: column; gap: 5px; }
.timeline {
  position: relative;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.timeline canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tl-region {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  --xf: 0%;
  /* ramps at both ends show the crossfade */
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.14) var(--xf),
    rgba(255, 255, 255, 0.14) calc(100% - var(--xf)), rgba(255, 255, 255, 0.02));
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.8), inset -2px 0 0 rgba(255, 255, 255, 0.8);
  pointer-events: none;
}
.timeline { touch-action: none; }
.range-edit {
  grid-column: 1 / -1;
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--fg-faint);
  font-size: 12px;
}
.panel.editing-ranges .range-edit { display: flex; }
.range-edit label { display: flex; align-items: center; gap: 5px; min-width: 0; }
.range-edit input {
  width: 78px;
  min-width: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 8px;
  padding: 4px 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.range-edit input:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.segmented { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); align-self: flex-start; }
.segmented button { background: transparent; box-shadow: none; padding: 5px 12px; }
.segmented button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.2); color: var(--fg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28); }

/* Fullscreen editor: the panel fills the window, the waveform gets tall,
   and the settings flow into columns. */
.panel.expanded {
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  width: auto;
  max-height: none;
  border-radius: 34px;
}
.panel.expanded .panel-head { padding: 16px 16px 16px 24px; }
.panel.expanded .panel-head h2 { font-size: 17px; }
.panel.expanded .panel-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  align-content: start;
  gap: 24px 32px;
  padding: 20px 24px 24px;
}
.panel.expanded .group + .group { border-top: 0; padding-top: 0; }
.panel.expanded .group-audio { grid-column: 1 / -1; }
.panel.expanded .timeline { height: clamp(120px, 32vh, 340px); border-radius: 18px; }
.panel.expanded .group-audio .row { max-width: 720px; }
.tl-head {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--fg);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  pointer-events: none;
}
input[type="range"]:disabled { opacity: 0.35; cursor: default; }
.meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, 0.55); border-radius: inherit; }
.meter-thr { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg); }
.meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .site-nav a, button, .file-btn, .child-thumb, input[type="range"]::-webkit-slider-thumb { transition: none; }
}

/* Enter screen: centred card, page menu and sound controls wait until it is gone */
.pld-page.pld-enter { align-items: center; justify-content: center; }
.enter-card { align-items: center; text-align: center; width: auto; max-width: min(640px, 100%); gap: 22px; }
.enter-text { margin: 0; max-width: 46ch; font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, 0.78); }
.enter-btn {
  padding: 13px 34px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.18);
}
.enter-btn:hover { background: rgba(255, 255, 255, 0.88); }
body.pld-entering .site-nav,
body.pld-entering .sound-toggle,
body.pld-entering .sound-hint { visibility: hidden; }

/* Diagnostics overlay (#debug) */
.pld-debug {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  max-height: 45vh;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: #9f9;
  font: 11px/1.4 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Table style "Timeline": years | glitched line pair | text.
   --pld-glitch (0..1) is set by the page from the music's glitch band, so the
   divider splits wider and tears with it. */
.content .wp-block-table.is-style-pld-timeline { --o: calc(1px + var(--pld-glitch, 0) * 4px); overflow: visible; }
.content .wp-block-table.is-style-pld-timeline table { table-layout: auto; width: auto; border: 0; }
.content .wp-block-table.is-style-pld-timeline td,
.content .wp-block-table.is-style-pld-timeline th {
  border: 0;
  padding: 9px 0 9px 26px;
  background: none;
  vertical-align: baseline;
}
.content .wp-block-table.is-style-pld-timeline tr td:first-child {
  position: relative;
  width: 1%;
  white-space: nowrap;
  padding: 9px 28px 9px 0;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.62);
}
.content .wp-block-table.is-style-pld-timeline tr td:first-child::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 4px;
  width: 1px;
  background: #fff;
  /* second line of the pair 4px to the right, each with a red and a blue fringe */
  box-shadow:
    4px 0 0 #fff,
    calc(-1 * var(--o)) 0 0 rgba(255, 40, 60, 0.85),
    var(--o) 0 0 rgba(40, 130, 255, 0.85),
    calc(4px - var(--o)) 0 0 rgba(255, 40, 60, 0.85),
    calc(4px + var(--o)) 0 0 rgba(40, 130, 255, 0.85);
}
/* a few rows tear sideways when the glitch hits */
.content .wp-block-table.is-style-pld-timeline tr:nth-child(3n+2) td:first-child::after { transform: translateX(calc(var(--pld-glitch, 0) * 7px)); }
.content .wp-block-table.is-style-pld-timeline tr:nth-child(4n+3) td:first-child::after { transform: translateX(calc(var(--pld-glitch, 0) * -5px)); }
.content .wp-block-table.is-style-pld-timeline tr:first-child td:first-child::after { top: 7px; }
.content .wp-block-table.is-style-pld-timeline tr:last-child td:first-child::after { bottom: 7px; }
