/* Night Room — Desktop layout overrides */
/* Active on hover-capable devices wider than 768px */

/* ── Side nav (768px+) ── */
@media (hover: hover) and (min-width: 768px) {
  body nav.nr-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 160px;
    height: 100dvh;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
    padding: 0 16px;
    border-top: none;
    border-right: 1px solid rgba(212,184,149,0.08);
    box-shadow: none;
    backdrop-filter: blur(20px);
    z-index: 50;
  }

  body nav.nr-nav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s;
  }

  body nav.nr-nav a:hover {
    background: rgba(212,184,149,0.06);
  }

  /* Focus-visible — rounded to match link shape */
  body nav.nr-nav a:focus-visible {
    outline: 2px solid rgba(212,184,149,0.4);
    outline-offset: -2px;
    border-radius: 8px;
  }

  /* Active nav item — the active link contains a .nav-dot child */
  body nav.nr-nav a:has(.nav-dot) {
    background: rgba(212,184,149,0.08);
  }

  body nav.nr-nav .nav-label {
    display: block !important;
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 13px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  body nav.nr-nav .nav-dot {
    display: none !important;
  }

  /* Content offset for side nav — headers + main + wrappers */
  body > header,
  body main,
  body .nr-main {
    margin-left: 160px;
    padding-bottom: 2rem;
  }

  /* Settings nav link — visible on desktop */
  body .nav-settings {
    display: flex !important;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(212,184,149,0.06);
  }

  /* Responsive type — tighter on desktop */
  body .text-base {
    font-size: 14px;
  }

  /* Settings page offset */
  body .nr-settings-wrap {
    margin-left: 160px;
  }

  /* Loops page */
  body .nr-loops-main {
    margin-left: 160px;
  }

  /* Loops detail view — above side nav (mobile overlay, hidden on desktop when panel is used) */
  body #view-log-detail {
    z-index: 60;
  }

  /* Clock page */
  body .nr-clock-wrap {
    margin-left: 160px;
  }

  /* Clock nav-wrapper — offset for side nav */
  body #nav-wrapper {
    left: 160px;
    width: calc(100vw - 160px);
  }

  /* Loops glow — clip to content area */
  body #glow-wrapper {
    margin-left: 160px;
    width: calc(100vw - 160px);
    left: 0;
    transform: none;
  }

  /* Non-grid pages cap width (exclude loops — it uses its own master-detail grid) */
  body main:not(.nr-sections):not(.nr-loops-main) {
    max-width: 1000px;
  }
}

/* ── 2-column grid (1024px+ only) ── */
/* Between 768-1024px: side nav + single column content */
@media (hover: hover) and (min-width: 1024px) {
  body main.nr-sections {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 48px;
    max-width: 960px;
    /* Center in available space: at least 192px from left (160 nav + 32 gap) */
    margin-left: max(192px, calc((100vw - 960px) / 2));
    margin-right: auto;
  }

  body .nr-sections > section,
  body .nr-sections > .section-divider {
    break-inside: avoid;
  }

  /* Hide section dividers in grid */
  body .nr-sections > .section-divider {
    display: none;
  }

  /* Full-width sections that span both columns */
  body .nr-sections > .nr-full-width {
    grid-column: 1 / -1;
  }

  /* ── Records master-detail layout ── */
  body .nr-loops-main {
    display: grid;
    grid-template-columns: 1fr 6px minmax(280px, 45%);
    gap: 0;
    max-width: none;
    align-items: start;
  }

  /* Resize handle */
  body .nr-resize-handle {
    display: block !important;
    width: 6px;
    cursor: col-resize;
    position: relative;
    align-self: stretch;
  }

  body .nr-resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 1px;
    background: rgba(212,184,149,0.08);
    transition: background 0.15s, width 0.15s;
  }

  body .nr-resize-handle:hover::after,
  body .nr-resize-handle.dragging::after {
    background: rgba(212,184,149,0.25);
    width: 2px;
    left: 2px;
  }

  body .nr-loops-detail {
    display: block !important;
    position: sticky;
    top: 24px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding-left: 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,184,149,0.15) transparent;
  }

  body .nr-loops-detail::-webkit-scrollbar {
    width: 5px;
  }

  body .nr-loops-detail::-webkit-scrollbar-track {
    background: transparent;
  }

  body .nr-loops-detail::-webkit-scrollbar-thumb {
    background: rgba(212,184,149,0.15);
    border-radius: 4px;
  }

  body .nr-loops-detail::-webkit-scrollbar-thumb:hover {
    background: rgba(212,184,149,0.3);
  }

  body .nr-loops-detail .nr-detail-inner {
    min-height: 200px;
  }

  /* Selected card indicator */
  body .loop-item.nr-selected > div {
    border-left: 2px solid rgba(212,184,149,0.5);
    padding-left: 12px;
  }

  /* Selected log card */
  body section.nr-selected {
    border-left: 2px solid rgba(212,184,149,0.5);
  }
}

/* ── Skip-to-content link (accessibility) ── */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 16px;
  background: rgba(212,184,149,0.15);
  color: rgba(212,184,149,0.8);
  font-family: 'Alegreya Sans', sans-serif;
  font-size: 13px;
  border-radius: 6px;
  text-decoration: none;
}

.skip-to-content:focus {
  left: 176px;
}

/* ── Nav labels hidden by default (mobile) ── */
.nav-label {
  display: none;
}

/* Settings nav link — hidden on mobile */
.nav-settings {
  display: none !important;
}

/* ── Settings select dropdown arrow ── */
select#zodiac-select {
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(212,184,149,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 12px;
}
