:root {
  --ink: #181818;
  --muted: #7c7c7c;
  --paper: rgba(251, 249, 245, 0.98);
  --paper-edge: rgba(24, 24, 24, 0.08);
  --bar-ink: rgba(255, 255, 255, 0.94);
  --bar-dim: rgba(255, 255, 255, 0.66);
  --shadow: 0 28px 72px rgba(7, 10, 28, 0.26);
  --sans: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --mono: "SF Mono", "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: #090c19;
  color: var(--bar-ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font: inherit;
}

.page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 11, 18, 0.2), rgba(6, 11, 18, 0.34)),
    radial-gradient(circle at 16% 18%, rgba(96, 170, 220, 0.14), transparent 30%),
    url("./assets/wallpaper.jpg") center center / cover no-repeat;
  isolation: isolate;
}

.page::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 9, 16, 0.16), transparent 16%, transparent 72%, rgba(5, 9, 16, 0.14)),
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.06), transparent 28%);
  pointer-events: none;
  z-index: -1;
}

.menu-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  padding: max(6px, env(safe-area-inset-top)) 12px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px) saturate(150%);
}

.menu-group {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.menu-group--right {
  margin-left: auto;
  gap: 6px;
}

.status-toggle-wrap {
  position: relative;
}

.menu-slot {
  position: relative;
}

.menu-trigger,
.status-button,
.header-icon,
.calendar-month-nav {
  border: 0;
  cursor: pointer;
}

.menu-trigger,
.status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--bar-ink);
  font-size: 13px;
  line-height: 1;
  transition: background 140ms ease;
}

.menu-slot.is-open > .menu-trigger,
.menu-trigger:hover,
.status-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.menu-trigger--accent {
  font-weight: 600;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 25;
  display: none;
  width: 188px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(17, 18, 28, 0.9);
  box-shadow: 0 18px 48px rgba(4, 6, 18, 0.28);
  backdrop-filter: blur(24px);
}

.menu-slot.is-open > .menu-dropdown {
  display: block;
}

.menu-entry {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  text-align: left;
  text-decoration: none;
  font-size: 13px;
}

.menu-entry:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-entry:disabled,
.menu-entry--disabled {
  opacity: 0.42;
  cursor: default;
}

.menu-entry:disabled:hover,
.menu-entry--disabled:hover {
  background: transparent;
}

.menu-entry__indicator {
  opacity: 0;
  font-size: 11px;
}

.menu-entry.is-checked .menu-entry__indicator {
  opacity: 1;
}

.menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.07);
}

.status-button {
  width: 24px;
  padding: 0;
}

.status-button svg {
  width: 13px;
  height: 13px;
}

.status-logo {
  display: block;
  width: 14px;
  height: 14px;
}

.status-button--daily.is-active .status-logo {
  filter: brightness(0.1);
}

.status-button--daily.is-active {
  background: rgba(255, 255, 255, 0.9);
  color: #171722;
}

.status-tooltip {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #12131b;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow:
    0 12px 28px rgba(5, 6, 18, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(18px);
  pointer-events: none;
  animation: tooltip-bob 1.6s ease-in-out infinite;
}

.status-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% - 1px);
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.96);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

@keyframes tooltip-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(2px);
  }
}

.status-time {
  color: var(--bar-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.photo-credit {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 16;
}

.photo-credit-toggle {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(11, 17, 27, 0.5);
  color: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 10px 22px rgba(4, 7, 12, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
  cursor: pointer;
  transition:
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.photo-credit-toggle:hover,
.photo-credit-toggle[aria-expanded="true"] {
  background: rgba(11, 17, 27, 0.68);
  color: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
}

.photo-credit-toggle svg {
  width: 12px;
  height: 12px;
}

.photo-credit-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(280px, calc(100vw - 28px));
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(9, 14, 22, 0.86);
  color: rgba(255, 255, 255, 0.86);
  box-shadow:
    0 18px 42px rgba(3, 5, 9, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
}

.photo-credit-popover::after {
  content: "";
  position: absolute;
  left: 8px;
  top: calc(100% - 1px);
  width: 10px;
  height: 10px;
  background: rgba(9, 14, 22, 0.86);
  transform: rotate(45deg);
  border-radius: 2px;
}

.photo-credit-popover p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.photo-credit-popover a {
  color: rgba(255, 255, 255, 0.96);
  text-decoration-color: rgba(255, 255, 255, 0.38);
  text-underline-offset: 0.14em;
}

.photo-credit-popover a:hover {
  text-decoration-color: currentColor;
}

.desktop-stage {
  position: relative;
  min-height: calc(100vh - 38px);
}

.daily-panel {
  position: absolute;
  top: 16px;
  right: clamp(20px, 4vw, 52px);
  width: min(520px, calc(100vw - 36px));
  min-height: 640px;
  box-shadow: var(--shadow);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.daily-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.panel-frame {
  height: 100%;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
}

.panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 96px 1fr 64px;
  align-items: center;
  min-height: 40px;
  padding: 2px 4px 0;
  border-bottom: 1px solid var(--paper-edge);
  background: rgba(251, 249, 245, 0.98);
  backdrop-filter: blur(12px);
}

.header-side {
  display: inline-flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.header-side-right {
  justify-content: flex-end;
}

.header-title {
  margin: 0;
  justify-self: center;
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.header-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  transition: background 140ms ease;
}

.header-icon:hover,
.header-icon.active,
.calendar-month-nav:hover {
  background: rgba(33, 33, 33, 0.05);
}

.header-icon svg,
.calendar-month-nav svg {
  width: 15px;
  height: 15px;
}

.header-date-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 6;
  width: 224px;
  padding: 8px;
  border: 1px solid rgba(24, 24, 24, 0.08);
  background: rgba(251, 249, 245, 0.98);
  box-shadow: 0 16px 36px rgba(24, 24, 24, 0.12);
  backdrop-filter: blur(18px);
}

.calendar-popover-header {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-month-label {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-month-nav {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays {
  margin-bottom: 4px;
}

.calendar-weekday {
  display: flex;
  justify-content: center;
  padding: 4px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-day {
  width: 100%;
  aspect-ratio: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
}

.calendar-day:hover {
  background: rgba(24, 24, 24, 0.06);
}

.calendar-day.is-outside-month {
  color: color-mix(in srgb, var(--muted) 72%, white);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(24, 24, 24, 0.16);
}

.calendar-day.is-selected {
  background: rgba(24, 24, 24, 0.92);
  color: rgba(251, 249, 245, 0.98);
}

.calendar-day-note-indicator {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.44);
}

.calendar-day.is-selected .calendar-day-note-indicator {
  background: rgba(251, 249, 245, 0.72);
}

.panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.note-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.ink-editor-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.note-editor {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 40px 44px;
  color: var(--ink);
  outline: none;
  white-space: normal;
}

.note-editor.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.note-editor h1,
.note-editor h2,
.note-editor h3 {
  margin: 0 0 0.8em;
  font-family: var(--display);
  font-weight: 520;
  letter-spacing: -0.04em;
  line-height: 1.06;
}

.note-editor h1 {
  font-size: clamp(2.2rem, 4vw, 3.1rem);
  letter-spacing: -0.06em;
}

.note-editor h2 {
  font-size: 1.8rem;
}

.note-editor p,
.note-editor li {
  margin: 0 0 1em;
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: -0.03em;
}

.note-editor ul,
.note-editor ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

.note-editor a {
  color: inherit;
}

@media (max-width: 860px) {
  .desktop-stage {
    display: flex;
    flex-direction: column;
    padding: 16px 18px 32px;
    min-height: auto;
  }

  .daily-panel {
    position: relative;
    inset: auto;
    width: min(100%, 560px);
    margin: 0 auto;
  }

  .daily-panel {
    min-height: 0;
  }

  .daily-panel.is-hidden {
    display: none;
    transform: none;
  }

  .panel-frame {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .menu-bar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .menu-trigger {
    padding: 0 6px;
    font-size: 12px;
  }

  .menu-dropdown {
    width: 170px;
  }

  .status-time {
    font-size: 11px;
  }

  .status-tooltip {
    top: calc(100% + 7px);
    min-height: 30px;
    padding: 0 11px;
    font-size: 12px;
  }

  .photo-credit {
    left: max(10px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .photo-credit-popover {
    width: min(240px, calc(100vw - 20px));
  }

  .panel-header {
    grid-template-columns: 92px 1fr 62px;
  }

  .note-editor {
    padding: 24px 22px 30px;
  }

  .note-editor h1 {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .note-editor p,
  .note-editor li {
    font-size: 1rem;
  }
}
