:root {
  --ink: #1c2733;
  --muted: #5c6b7a;
  --paper: #f2f5f9;
  --card: #ffffff;
  --line: #dee6ee;
  --night: #212c47;
  --night-ink: #93a3c6;
  --day: #e9eef5;
  --day-ink: #7c8b9b;
  --biz: #ffd166;
  --biz-edge: #f0b429;
  --biz-ink: #5f4200;
  --scrub: #0c8599;
  --overlap: #2f9e44;
  --now: #e03131;
  --white: #ffffff;
  --base-label-bg: #eef7f9;
  --grad-stripe-1: #f6f8fb;
  --grad-stripe-2: #eef2f7;
  --black-alpha-5: #0000000d;
  --black-alpha-8: #00000014;
  --white-alpha-6: #ffffff0f;
  --scrub-alpha-40: #0c859966;
  --shadow-color: #1020302e;
  --label-w: 210px;
  --track-min: 720px;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  display: flex;
  flex-direction: column;
}

.display-font {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.app-header {
  text-align: center;

  h1 {
    font-weight: 700;
  }
  .mainLogo {
    max-height: 44px;
    width: auto;
  }
  .tagline {
    color: var(--muted);
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);

  .sw {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 0.35rem;
    vertical-align: -2px;
    border: 1px solid var(--black-alpha-8);
  }
}

.sw-biz {
  background: var(--biz);
}
.sw-day {
  background: var(--day);
}
.sw-night {
  background: var(--night);
}
.sw-overlap {
  background: var(--overlap);
}

/* City search dropdown */
.city-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 290px;
  overflow-y: auto;
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);

  &.open {
    display: block;
  }

  .list-group-item {
    border-left: 0;
    border-right: 0;
    cursor: pointer;

    &:first-child {
      border-top: 0;
    }
    &:last-child {
      border-bottom: 0;
    }
  }

  .city-place {
    font-weight: 600;
    font-size: 0.9rem;
  }
  .city-detail {
    font-size: 0.74rem;
    color: var(--muted);
  }
  .city-tz {
    font-size: 0.72rem;
  }
  .status {
    padding: 0.7rem 0.9rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
}

/* Board */
.board {
  overflow-x: auto;
  border-radius: 0 0 14px 14px;
  outline: none;

  &:focus-visible {
    box-shadow: inset 0 0 0 3px var(--scrub-alpha-40);
  }
}

.board-inner {
  position: relative;
  min-width: calc(var(--label-w) + var(--track-min));
  cursor: crosshair;
}

.tz-row {
  display: flex;
  border-top: 1px solid var(--line);

  &:first-child {
    border-top: 0;
  }

  &.is-base .row-label {
    background: var(--base-label-bg);
    box-shadow: inset 3px 0 0 var(--scrub);
  }
}

.row-label {
  flex: 0 0 var(--label-w);
  max-width: var(--label-w);
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 0.5rem 0.75rem;

  .tz-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tz-meta {
    font-size: 0.72rem;
    color: var(--muted);
  }

  .btn {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.3rem;
    --bs-btn-font-size: 0.7rem;
  }
}

.row-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 56px;
}

.cell {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--black-alpha-5);
  display: flex;
  align-items: flex-end;
  overflow: hidden;

  &:last-child {
    border-right: 0;
  }

  .hr {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.62rem;
    padding: 0 0 2px 3px;
    color: var(--day-ink);
    white-space: nowrap;
  }

  &.night {
    background: var(--night);
    border-right-color: var(--white-alpha-6);
    .hr {
      color: var(--night-ink);
    }
  }

  &.day {
    background: var(--day);
  }

  &.biz {
    background: var(--biz);
    box-shadow: inset 0 -3px 0 var(--biz-edge);
    .hr {
      color: var(--biz-ink);
    }
  }
}

/* Axis */
.axis-row {
  display: flex;
  background: var(--card);

  .row-label {
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: flex-end;
  }
}

.axis-track {
  flex: 1;
  position: relative;
  height: 30px;
  border-bottom: 1px solid var(--line);
}

.axis-tick {
  position: absolute;
  bottom: 2px;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  color: var(--muted);

  &::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -3px;
    width: 1px;
    height: 4px;
    background: var(--line);
  }
}

/* Overlap row */
.overlap-row {
  border-top: 2px solid var(--line);
}

.overlap-track {
  flex: 1;
  position: relative;
  min-height: 38px;
  background: repeating-linear-gradient(
    -45deg,
    var(--grad-stripe-1) 0 8px,
    var(--grad-stripe-2) 8px 16px
  );
}

.overlap-band {
  position: absolute;
  top: 6px;
  bottom: 6px;
  background: var(--overlap);
  border-radius: 6px;
  opacity: 0.9;

  .lbl {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    overflow: hidden;
    white-space: nowrap;
  }
}

/* Scrubber */
.scrub-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--scrub);
  z-index: 4;
  pointer-events: none;
  transform: translateX(-1px);
}

.scrub-head {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  background: var(--scrub);
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.now-line {
  position: absolute;
  top: 30px;
  bottom: 0;
  width: 0;
  border-left: 2px dotted var(--now);
  z-index: 3;
  pointer-events: none;
  opacity: 0.7;
}

.chip {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--card);
  border: 1.5px solid var(--muted);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 4px var(--shadow-color);

  &.in-biz {
    border-color: var(--overlap);
    color: var(--overlap);
  }

  .dshift {
    font-size: 0.6rem;
    vertical-align: super;
    color: var(--muted);
  }
}

.board-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Footer */
.app-footer {
  background: var(--night);

  .h1,
  h5 {
    color: var(--white);
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.02em;
  }

  p {
    color: var(--night-ink);
  }

  a {
    color: var(--white);
    text-decoration: underline;
    text-decoration-color: var(--night-ink);
    text-underline-offset: 3px;

    &:hover {
      color: var(--biz);
      text-decoration-color: var(--biz);
    }
  }

  .othersProjects {
    ul li {
      margin-bottom: 0.35rem;
    }

    a {
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }
  }
}

@media (max-width: 576px) {
  :root {
    --label-w: 150px;
  }
  .row-label .tz-meta .offset-badge {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .scrub-line,
  .scrub-head,
  .chip {
    transition: left 60ms linear;
  }
}
