:root{
  --bg: #ffffff;
  --fg: #111111;
  --muted: rgba(17,17,17,0.62);
  --line: rgba(17,17,17,0.12);
  --shadow: 0 18px 50px rgba(0,0,0,0.08);
  --radius: 18px;
  --panelW: 420px;
}

[data-theme="dark"]{
  --bg: #0b0c0f;
  --fg: #f0f0f3;
  --muted: rgba(240,240,243,0.62);
  --line: rgba(240,240,243,0.14);
  --shadow: 0 18px 55px rgba(0,0,0,0.35);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  transition: background 160ms ease, color 160ms ease;
}

.topbar{
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.brand{
  text-decoration: none;
  color: var(--fg);
  letter-spacing: 0.4px;
  font-weight: 600;
  font-size: 15px;
}

.topbar-right{
  display: flex;
  align-items: center;
  gap: 12px;
}

.dot{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--fg); /* appears opposite because fg changes */
  cursor: pointer;
  padding: 0;
}

.icon-link{
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--fg);
  text-decoration: none;
}
.icon-link:hover{ border-color: var(--line); }

.stage{
  height: calc(100vh - 56px - 42px);
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: 0 12px;
}

.arrow{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  user-select: none;
}
.arrow:disabled{ opacity: 0.25; cursor: not-allowed; }

.viewer{
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
  height: 100%;
}

.frame{
  width: min(92vw, 1100px);
  max-height: 78vh;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  background: transparent;
  transition: transform 240ms ease, width 240ms ease;
}

.frame img{
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Panel hidden by default */
.panel{
  position: absolute;
  top: 50%;
  right: 10px;
  width: var(--panelW);
  max-width: 88vw;
  transform: translate(110%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms ease, opacity 180ms ease;
}

.panel-inner{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 16px 18px 16px;
  background: color-mix(in oklab, var(--bg) 92%, var(--fg) 8%);
}

.title{ font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.sub{ color: var(--muted); font-size: 13px; margin: 2px 0; }
.text{ margin-top: 12px; font-size: 14px; line-height: 1.45; }
.muted{ color: var(--muted); }

/* Open state: image shifts left, panel slides in */
.viewer.open .frame{
  transform: translateX(-80px);
  width: min(70vw, 900px);
}

.viewer.open .panel{
  transform: translate(0, -50%);
  opacity: 1;
  pointer-events: auto;
}

.footer{
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
