/* Floating UI for the sphere page: the Archives panel (top left) and the navbar
   (top right), plus the sphere's own project page layout.
   Figma: portfolio / Frame 440 (407:229 closed, 410:240 open), Frame 453 (412:376). */

/* Paper Mono (paper-design/paper-mono, SIL OFL) — the panel's typeface, as in the Figma */
@font-face {
  font-family: "Paper Mono";
  src: url("assets/fonts/PaperMono-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Paper Mono";
  src: url("assets/fonts/PaperMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Paper Mono";
  src: url("assets/fonts/PaperMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

/* ---------- Day / night ---------- */
html.sphere-page {
  background: var(--bg);
  --bg: #ffffff;
  --ink: #515151;
  --muted: #515151;
  --line: rgba(21, 21, 21, 0.1);
  --plate: #ededed;
  --chrome-ink: #515151;
  --chrome-muted: #515151;
  /* glass: almost clear; the blur and a bright sheen do the work, barely any shadow */
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-sheen: linear-gradient(140deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 45%);
  --glass-rim: rgba(255, 255, 255, 0.9);
  --glass-edge: rgba(0, 0, 0, 0.05);
  --glass-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 10px 28px rgba(0, 0, 0, 0.08);
  --chip-bg: rgba(0, 0, 0, 0.04);
  --toggle-bg: rgba(0, 0, 0, 0.04);
  --toggle-knob: rgba(255, 255, 255, 0.95);
  --pv-veil: rgba(255, 255, 255, 0.86);
  color-scheme: light;
  transition: background-color 0.5s var(--ease);
}
html.sphere-page[data-theme="dark"] {
  --bg: #000000;
  --ink: #ededed;
  --muted: #8f8f8f;
  --line: rgba(255, 255, 255, 0.12);
  --plate: #222222;
  --chrome-ink: #ececec;
  --chrome-muted: #a8a8a8;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-sheen: linear-gradient(140deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 45%);
  --glass-rim: rgba(255, 255, 255, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.4);
  --chip-bg: rgba(255, 255, 255, 0.07);
  --toggle-bg: rgba(255, 255, 255, 0.07);
  --toggle-knob: rgba(255, 255, 255, 0.16);
  --pv-veil: rgba(0, 0, 0, 0.86);
  color-scheme: dark;
}
html.sphere-page body { background: var(--bg); transition: background-color 0.5s var(--ease); }

/* the hint pill follows the theme too */
html.sphere-page[data-theme="dark"] .hint {
  color: var(--chrome-ink);
  background: rgba(40, 40, 40, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ---------- Navbar (right part only) ---------- */
html.sphere-page site-navbar { justify-content: flex-end; }
html.sphere-page site-navbar .nav-logo { display: none; }
html.sphere-page site-navbar[dark] {
  --nav-pill-bg: #1e1e1e;
  --nav-panel-bg: #ffffff;
  --nav-panel-fg: #111111;
  --nav-btn-bg: #ffffff;
  --nav-btn-open-bg: #111111;
}
html.sphere-page site-navbar[dark] .nav-hover { background: rgba(0, 0, 0, 0.06); }
html.sphere-page site-navbar[dark] .nav-ext { filter: invert(1); }
html.sphere-page site-navbar .nav-bg { transition: background-color 0.5s var(--ease); }

/* ---------- Archives panel ---------- */
.arc {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 40;
  width: min(380px, calc(100vw - 40px));
  font-family: "Paper Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 400;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: -0.02em;
  color: var(--chrome-ink);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}
/* steps aside while a project is open */
html.sphere-page body:has(.pv.is-open) .arc {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.arc__glass {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--glass-sheen), var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(2) brightness(1.04);
  backdrop-filter: blur(24px) saturate(2) brightness(1.04);
  box-shadow:
    inset 0 1px 0 var(--glass-rim),
    inset 0 0 0 0.5px var(--glass-edge),
    var(--glass-shadow);
  transition: background 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
/* while the liquid shape is moving it is clipped to a path: corners come from the path */
.arc.is-moving .arc__glass { border-radius: 0; box-shadow: inset 0 1px 0 var(--glass-rim); }

.arc__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 16px;
}

.arc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.arc__title {
  margin: 0;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* day / night switch: two icons, a knob slides under the active one */
.mode {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 2px;
  border-radius: 12px;
  background: var(--toggle-bg);
}
.mode__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 10px;
  background: var(--toggle-knob);
  transition: transform 0.45s var(--ease), background-color 0.5s var(--ease);
}
html.sphere-page[data-theme="dark"] .mode__knob { transform: translateX(28px); }
.mode button {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 10px;
  color: var(--chrome-ink);
  opacity: 0.5;
  transition: opacity 0.3s var(--ease);
}
.mode button[aria-pressed="true"],
.mode button:hover { opacity: 1; }
.mode button:focus-visible,
.arc__toggle:focus-visible { outline: 2px solid #7c5cff; outline-offset: 2px; }
/* the Figma icons, tinted to the text colour */
.mode__icon {
  display: block;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.mode__icon--day { width: 22px; height: 21.1625px; --icon: url("assets/day.svg"); }
.mode__icon--night { width: 12px; height: 12px; --icon: url("assets/night.svg"); }

/* body text: one line always there, the rest folds out under it */
.arc__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 312px;
  color: var(--chrome-muted);
}
.arc__body p,
.arc__more p { margin: 0; }
.arc__more { display: none; flex-direction: column; gap: 10px; }
.arc__tools-wrap { display: none; flex-direction: column; gap: 8px; max-width: 312px; }
.arc[data-open="true"] .arc__more,
.arc[data-open="true"] .arc__tools-wrap { display: flex; }

/* More / Less sits at the end of the text, bottom right (Figma "...more") */
.arc__toggle {
  align-self: flex-end;
  margin-top: -4px;
  padding: 0;
  font: inherit;
  font-weight: 400;
  color: var(--chrome-ink);
  border-radius: 4px;
  cursor: pointer;
}
.arc__toggle::before { content: "..."; }
.arc[data-open="true"] .arc__toggle::before { content: ""; }
.arc__toggle:hover { text-decoration: underline; text-underline-offset: 3px; }

.arc__label {
  margin: 0;
  font-weight: 400;
  color: var(--chrome-muted);
}
.arc__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.arc__tools li {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chrome-ink);
  white-space: nowrap;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

/* ---------- Project page (sphere only): one 600px column, essesi-quiet ---------- */
/* the grid stays faintly visible behind it */
html.sphere-page .pv__bg {
  background: var(--pv-veil);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
html.sphere-page .pv,
html.sphere-page .pv button {
  font-family: "Paper Mono", ui-monospace, monospace;
  color: var(--ink);
}
html.sphere-page .pv__bar { padding: 20px; }
html.sphere-page .pv__close {
  margin-left: 0;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
html.sphere-page .pv__count { display: none; } /* the navbar sits top right */
html.sphere-page .pv__inner {
  max-width: 780px; /* 120 label + 20 gap + 600 column + 2 x 20 padding */
  padding: 120px 20px 96px;
}
/* label column + one 600px text/image column, like an about page */
html.sphere-page .pv__head {
  display: grid;
  grid-template-columns: 120px minmax(0, 600px);
  column-gap: 20px;
  row-gap: 0;
  align-items: start;
  justify-content: center;
}
html.sphere-page .pv__info { display: contents; }
html.sphere-page .pv__title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}
html.sphere-page .pv__kicker {
  grid-column: 1;
  grid-row: 2;
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--muted);
}
html.sphere-page .pv__text {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  max-width: none;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
}
html.sphere-page .pv__meta {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}
html.sphere-page .pv__meta div { display: flex; gap: 6px; align-items: baseline; }
html.sphere-page .pv__meta dt,
html.sphere-page .pv__meta dd {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
html.sphere-page .pv__meta dt { color: var(--muted); font-weight: 400; }
html.sphere-page .pv__hero {
  grid-column: 2;
  grid-row: 4;
  width: 100%;
  margin-top: 28px;
}
html.sphere-page .pv__gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  margin: 10px 0 0 140px;
}
html.sphere-page .pv__gallery figure:nth-child(n) { margin: 0; }
html.sphere-page .pv__next {
  max-width: 600px;
  margin: 64px 0 0 140px;
  padding: 14px 0 0;
  gap: 4px;
}
html.sphere-page .pv__next span { font-size: 11px; letter-spacing: 0; text-transform: none; }
html.sphere-page .pv__next-title { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; }

@media (max-width: 760px) {
  html.sphere-page .pv__head { grid-template-columns: minmax(0, 1fr); }
  html.sphere-page .pv__title,
  html.sphere-page .pv__kicker,
  html.sphere-page .pv__text,
  html.sphere-page .pv__meta,
  html.sphere-page .pv__hero { grid-column: 1; grid-row: auto; }
  html.sphere-page .pv__text { margin-top: 16px; }
  html.sphere-page .pv__gallery,
  html.sphere-page .pv__next { margin-left: 0; }
}

/* phones: navbar spans the top, the panel sits under it, the grid starts below both */
@media (max-width: 767px) {
  .arc { top: 70px; left: 16px; width: calc(100vw - 32px); }
  html.sphere-page.is-phone .dgrid { padding-top: calc(var(--chrome-bottom, 0px) + 20px); }
}

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

/* ---------- Paper Mono everywhere on the sphere page ---------- */
html.sphere-page,
html.sphere-page .caps,
html.sphere-page .hint,
html.sphere-page .cell__cap,
html.sphere-page .pv__close {
  font-family: "Paper Mono", ui-monospace, monospace;
}
html.sphere-page site-navbar { --nav-font: "Paper Mono", ui-monospace, monospace; }
html.sphere-page .pv__close { font-size: 11px; letter-spacing: 0; text-transform: none; }
html.sphere-page .pv__kicker { text-transform: none; letter-spacing: 0; }
/* the project page closes on any click that isn't a control */
html.sphere-page .pv.is-open .pv__scroll { cursor: pointer; }
html.sphere-page .pv.is-open :is(button, a) { cursor: pointer; }
/* one weight (regular) and one size (11px) for all small text */
html.sphere-page .caps,
html.sphere-page .hint,
html.sphere-page .cell__cap,
html.sphere-page .pv__meta dt,
html.sphere-page .pv__meta dd { font-weight: 400; font-size: 11px; color: var(--ink); }
html.sphere-page .arc__tools li { color: var(--chrome-ink); }
/* image captions: light */
html.sphere-page .cell__cap,
html.sphere-page .cell__cap.caps { font-weight: 300; }

/* ---------- the liquid shape while More / Less animates ---------- */
/* Drawn behind the glass with the same path the glass is clipped to, so the
   fill, the bright rim and the drop shadow pour and wobble with it. */
.arc__shape {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% + 60px);
  overflow: visible;
  pointer-events: none;
  opacity: 0;
}
.arc.is-moving .arc__shape { opacity: 1; }
.arc__shape path {
  fill: var(--glass-fill);
  stroke: var(--glass-stroke);
  stroke-width: 1;
  filter: drop-shadow(0 2px 6px var(--glass-drop-1)) drop-shadow(0 10px 28px var(--glass-drop-2));
}
html.sphere-page {
  --glass-fill: rgba(255, 255, 255, 0.35);
  --glass-stroke: rgba(0, 0, 0, 0.05);
  --glass-drop-1: rgba(0, 0, 0, 0.05);
  --glass-drop-2: rgba(0, 0, 0, 0.08);
}
html.sphere-page[data-theme="dark"] {
  --glass-fill: rgba(255, 255, 255, 0.04);
  --glass-stroke: rgba(255, 255, 255, 0.08);
  --glass-drop-1: rgba(0, 0, 0, 0.3);
  --glass-drop-2: rgba(0, 0, 0, 0.4);
}
/* keep the glass's own rim visible while clipped */
.arc.is-moving .arc__glass { box-shadow: inset 0 1px 0 var(--glass-rim); }

/* More / Less: bottom-right corner of the panel, closed or open */
.arc__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: -24px; /* sits close under the last line instead of a full section gap */
}
.arc__foot .arc__toggle { align-self: auto; margin-top: 0; }

/* image captions (cell__cap, caps): 12px light */
html.sphere-page .cell__cap,
html.sphere-page .cell__cap.caps { font-size: 11px; font-weight: 300; text-transform: none; letter-spacing: 0; }
