@import url("./sky-shared.css");

.section {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.section:first-child {
  border-top: 2px solid var(--accent);
  padding-top: 15px;
}
h2 {
  font: 700 29px/1.1 var(--font-sans);
  margin: 0 0 4px;
  letter-spacing: -.02em;
}
.sub {
  font-size: 12px;
  color: var(--ink-soft);
}
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 10px;
  margin: 18px 0 0;
}
.metrics > div + div {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}
.metrics span {
  display: block;
  font-size: 10px;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.metrics strong {
  font: 700 20px var(--font-sans);
  display: block;
  overflow-wrap: anywhere;
}
.metrics .vis {
  font-size: 15px;
  color: var(--accent);
}
h3 {
  font: 700 18px var(--font-sans);
  margin: 0 0 8px;
}
.event-row,
.body-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.event-row:last-child,
.body-row:last-child {
  border-bottom: 0;
}
.event-row > span:first-child {
  color: var(--ink-soft);
}
.event-row > span:last-child {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.body-row {
  background: transparent;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  min-height: 30px;
  padding: 6px 4px;
}
.body-row.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.body-row > span:last-child {
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
}
.body-row .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--planet);
  vertical-align: middle;
}
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 13px;
  font-size: 12px;
}
.options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  font-size: 12px;
}
.slider-row input {
  flex: 1;
  min-width: 60px;
}
.slider-row output {
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  z-index: 10;
  box-shadow: 0 4px 20px #0003;
}
.obj-heading {
  display: flex;
  align-items: center;
  min-height: 62px;
  gap: 12px;
}
.object-icon,
.object-icon.planet {
  position: relative;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  border: 0;
  border-radius: 0;
  background: none;
  display: grid;
  place-items: center;
  overflow: visible;
}
.object-icon svg,
.object-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
  overflow: visible;
}
.object-icon [hidden] {
  display: none!important;
}
.obj-heading-copy {
  min-width: 0;
}
.metrics {
  margin-top: 14px;
}
.body-row .mini-icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  margin-right: 7px;
  vertical-align: middle;
  object-fit: contain;
}
.body-row .mini-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.body-row .mini-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.metrics strong {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.metrics span,
.event-row > span:first-child {
  font-family: var(--font-mono);
  font-size: .65rem;
  text-transform: uppercase;
}
.metrics .vis {
  color: var(--olive-deep);
}
.options,
.slider-row,
.event-row,
.body-row {
  font-size: .88rem;
}
.results button[aria-selected="true"] {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.static-sky-fallback {
  margin-block: 1.5rem;
}
.static-sky-fallback ul {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding-left: 1.25rem;
}
#shareDialog {
  width: min(35rem, calc(100% - 2rem));
  border: 1px solid var(--border-strong);
}
#shareDialog form {
  display: grid;
  gap: .75rem;
}

html:has(.sky-instrument) { scrollbar-gutter: stable; }
body:has(.sky-instrument) :is(#main-content, .site-header__inner, .site-footer__inner) {
  width: min(calc(100% - 56px), 1640px);
  max-width: none;
  margin-inline: auto;
}
.sky-instrument {
  --sidebar: clamp(305px, 25vw, 382px);
  --workspace-top: 154px;
}
.sky-instrument [hidden],
#sky-menu-toggle[hidden] { display: none !important; }

.page-title { padding: 12px 0 4px; }
.page-title .back {
  display: block;
  width: fit-content;
  color: var(--ink-soft);
  margin: 0 0 6px;
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.page-title h1 {
  font-size: clamp(25px, 2.3vw, 35px);
  line-height: 1.1;
  margin: 0;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  gap: clamp(18px, 3vw, 42px);
  padding: 12px 0 24px;
  align-items: stretch;
}
.chart-column { min-width: 0; }
.chart-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 11px;
}
.chart-heading strong { font-size: 12px; letter-spacing: .025em; }
.canvas-wrap {
  width: min(100%, max(340px, calc(100dvh - var(--workspace-top) - 36px)));
  margin-inline: auto;
  position: relative;
}
#sky {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  touch-action: none;
}
#sky[data-zoomed] { cursor: grab; }
#sky[data-dragging] { cursor: grabbing; }
.chartfoot {
  width: min(100%, max(340px, calc(100dvh - var(--workspace-top) - 36px)));
  margin-inline: auto;
  padding-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}
.magkey, .magkey span { display: flex; align-items: center; gap: 5px; }
.magkey { gap: 10px; }
.magkey i { border-radius: 50%; background: var(--ink); display: inline-block; }

.sky-instrument :is(button, input, select), #sky-menu-toggle {
  font: inherit;
  color: inherit;
}
.sky-instrument :is(button, input, select, a):focus-visible,
#sky-menu-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.bare {
  appearance: none;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.bare:hover { background: var(--accent-soft); }
.bare:disabled { opacity: .45; cursor: default; }
.bare svg, .transport svg { width: 20px; height: 20px; flex: none; }
.zoom-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  right: 0;
  bottom: 3%;
}
.zoom-tools output { font-size: 11px; color: var(--ink-soft); }

.workbench > .side {
  min-width: 0;
  min-height: 0;
  contain: size;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  padding-left: clamp(14px, 2vw, 24px);
}
#desktop-time, .toolstrip { flex: none; }
#desktop-panel { min-height: 0; flex: 1; }
#desktop-panel .panel-host {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  padding: 16px 5px 0 0;
}
.panel-host > h2 {
  margin: 0 0 8px;
  font: 400 11px/1.4 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-soft);
}
.panel-host .section:first-child { border-top: 0; padding-top: 0; }
.panel-host h3, .body-list-disclosure summary { font-size: 15px; font-weight: 700; }
.body-list-disclosure summary { padding-block: 10px; cursor: pointer; }
#objName { font-size: 23px; }
#panel-object .metrics { gap: 8px; }
#panel-object .metrics strong { font-size: 18px; }
#panel-object .metrics .vis { font-size: 13px; }

.time-readout { min-width: 0; padding-bottom: 14px; }
.readout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font: 400 11px var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
#clock-mode.is-live { color: var(--olive-deep); }
#clock-mode.is-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}
.location-line, .date-line, .clock-line, .playback-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.location-line {
  padding: 5px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.location-line svg, .date-edit svg { width: 17px; height: 17px; flex: none; color: var(--ink-soft); }
#site, #step, #offset {
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}
#site { width: 100%; font-size: 17px; font-weight: 700; }
#site option, #step option, #offset option { background: var(--surface); color: var(--ink); }
.date-line, .clock-line, .playback-line { justify-content: space-between; }
.date-edit, .clock-edit {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}
.date-edit { font-weight: 700; }
.clock-edit {
  font-size: clamp(35px, 3.25vw, 49px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  min-height: 58px;
}
.date-edit input, .clock-edit input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.date-edit:focus-within, .clock-edit:focus-within { outline: 2px solid var(--focus); }
:is(.date-edit, .clock-edit) input:focus-visible {
  opacity: 1;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.clock-edit input:focus-visible { font-size: clamp(21px, 3vw, 35px); }
.date-edit:hover, .clock-edit:hover { background: var(--accent-soft); }
#time-zone, .step-line, #offsetField { color: var(--ink-soft); font-size: 12px; }
#time-zone { font: 10px var(--font-mono); }
#now { color: var(--olive-deep); font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.transport, .step-line { display: flex; align-items: center; }
#play[aria-pressed="true"] .play-mark,
#play[aria-pressed="false"] .pause-mark { display: none; }
.toolstrip {
  display: flex;
  gap: 2px;
  padding: 6px 0;
  border-block: 1px solid var(--border);
}
.toolstrip .tool {
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-height: 50px;
  padding: 5px 0;
  color: var(--ink-soft);
  font-size: 11px;
}
.tool[aria-expanded="true"] { color: var(--ink); box-shadow: inset 0 -2px var(--olive-deep); }
.tool[data-panel="time"], .mobile-context, #mobileObject { display: none; }
.searchbox { display: flex; border-bottom: 1px solid var(--border-strong); }
.searchbox input {
  width: 100%;
  min-width: 0;
  padding: 0 4px;
  min-height: 44px;
  border: 0;
  color: var(--ink);
  background: transparent;
}
.results { margin-top: 6px; }
.results button {
  display: block;
  width: 100%;
  min-height: 38px;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--border);
}
.results button:hover, .results button[aria-selected="true"] { background: var(--accent-soft); }
.action-list { display: grid; justify-items: start; }
.action-list button { justify-content: flex-start; }
#shareDialog, #tool-sheet {
  background: var(--paper);
  color: var(--ink);
}
#sourcesLink { text-decoration: underline; }
.printonly { display: none; }
#instrument:fullscreen, .sky-expanded #instrument {
  --workspace-top: 0px;
  padding: 12px 24px;
  background: var(--paper);
  overflow: auto;
}
.sky-expanded { overflow: hidden; }
.sky-expanded #instrument { position: fixed; inset: 0; z-index: 20; }
#instrument:fullscreen .workbench { max-width: 1640px; margin: auto; }

@media (max-width: 950px) {
  html.js body:has(.sky-instrument) .site-header__inner {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    position: relative;
    min-height: 55px;
    gap: 0;
  }
  html.js body:has(.sky-instrument) .site-header .identity {
    flex-direction: row;
    align-items: center;
    min-width: 0;
    gap: 8px;
  }
  html.js body:has(.sky-instrument) .site-header .identity__translation {
    display: grid;
    gap: 0;
    padding-left: 8px;
    white-space: nowrap;
    border-left: 1px solid var(--border-strong);
  }
  html.js body:has(.sky-instrument) .site-header .identity__sanskrit { font-size: .56rem; }
  html.js body:has(.sky-instrument) .site-header__inner > :is([data-theme-toggle], #sky-menu-toggle) {
    flex: 0 0 44px;
  }
  html.js body:has(.sky-instrument) .site-header__inner > [data-theme-toggle] { margin-left: auto; }
  html.js body:has(.sky-instrument) .site-nav {
    display: none;
    position: absolute;
    z-index: 30;
    inset: 100% 0 auto;
    width: 100%;
    margin: 0;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  html.js body:has(.sky-instrument) .site-nav[data-sky-open] { display: flex; }
  html.js body:has(.sky-instrument) .site-nav a { min-height: 42px; padding-block: 8px; }
}

@media screen and (max-width: 800px) and (orientation: portrait), screen and (max-width: 700px) and (orientation: landscape) {
  html:has(.sky-instrument) { scrollbar-gutter: auto; }
  body:has(.sky-instrument) :is(#main-content, .site-header__inner, .site-footer__inner) { width: calc(100% - 28px); }
  body:has(.sky-instrument) .site-footer { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
  .page-title { padding-top: 8px; }
  .page-title h1 { font-size: 22px; }
  .page-title .back { display: none; }
  .mobile-context { display: block; border-bottom: 1px solid var(--border); }
  .mobile-context button { width: 100%; min-height: 40px; justify-content: flex-start; font-size: 15px; }
  .mobile-context .context-date {
    justify-content: space-between;
    color: var(--ink-soft);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }
  .context-place svg:last-child { margin-left: auto; }
  .workbench { display: block; padding: 7px 0 18px; }
  .canvas-wrap { width: 100%; }
  .zoom-tools { position: static; flex-direction: row; justify-content: flex-end; }
  .zoom-tools output { min-width: 36px; text-align: center; }
  .chartfoot { margin: -33px 0 0; min-height: 33px; width: 53%; pointer-events: none; }
  .workbench > .side { display: block; contain: none; padding: 0; border: 0; }
  #desktop-time, #desktop-panel { display: none; }
  .toolstrip {
    position: fixed;
    z-index: 12;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: var(--paper);
    border-bottom: 0;
  }
  .toolstrip .tool[data-panel="time"] { display: inline-flex; }
  .toolstrip .tool[data-panel="object"] { display: none; }
  #mobileObject {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    width: 100%;
    text-align: left;
    min-height: 60px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }
  #mobileObject :is(strong, small) { display: block; }
  #mobileObject small { font-size: 12px; color: var(--ink-soft); }
  #mobile-thumbnail :is(img, svg) { width: 44px; height: 38px; object-fit: contain; display: block; }
  #tool-sheet {
    position: fixed;
    inset: auto 0 0;
    margin: 0;
    width: 100%;
    max-width: none;
    max-height: min(75dvh, 620px);
    padding: 18px 20px max(20px, env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--border-strong);
    overflow: auto;
    overscroll-behavior: contain;
  }
  #tool-sheet::backdrop { background: rgb(0 0 0 / 35%); }
  #close-panel { position: absolute; right: 9px; top: 2px; }
  #tool-sheet #panel-title { min-height: 27px; }
  #instrument:fullscreen, .sky-expanded #instrument { padding: 8px 14px 76px; }
}

@media (max-width: 360px) {
  html.js body:has(.sky-instrument) .site-header .identity__translation { display: none; }
}

@media screen and (orientation: landscape) and (max-height: 520px) and (min-width: 701px) {
  body:has(.sky-instrument) #main-content { width: calc(100% - 24px); }
  .sky-instrument { --sidebar: clamp(245px, 35vw, 310px); }
  .page-title { padding-top: 4px; }
  .page-title h1 { font-size: 21px; }
  .page-title .back { display: none; }
  .workbench { padding: 4px 0 12px; gap: 12px; min-height: 300px; }
  .canvas-wrap { width: min(100%, max(195px, calc(100dvh - var(--workspace-top) - 30px))); }
  .chartfoot { display: none; }
  .zoom-tools { right: -36px; bottom: 0; }
  .time-readout { padding-bottom: 4px; }
  .location-line { padding: 0; margin: 0; }
  .date-edit, .clock-edit, #site { min-height: 35px; }
  .clock-edit { font-size: 34px; }
  .toolstrip { padding: 0; }
  .toolstrip .tool { min-height: 44px; }
  #desktop-panel .panel-host { padding-top: 8px; }
}

@media print {
  .site-header, .site-footer, .skip-link, .page-title, .side, .mobile-context,
  .mobile-object, .chart-heading, .zoom-tools, .chartfoot, dialog, .toast { display: none !important; }
  .workbench { display: block; padding: 0; }
  .canvas-wrap { width: min(100%, 180mm); }
  .printonly { display: block; margin-bottom: .5rem; font-weight: 700; }
  body { background: #fff !important; color: #000 !important; }
}
