/* colours lifted from the mockup pdfs */
:root {
  --navy: #3f4a6b;
  --tan: #bcbaaf;          /* the exact tan from the logo and mockup pdfs, so the mark blends in */
  --btn: #e6e6e6;
  --ink: #000;
  --ink-past: #777;
  --blue: #0068ff;
  --popup: #d8d8d8;
  --pink: #dd9e9e;
  --white: #fff;

  --sidebar-w: 24vw;       /* mobile: about a quarter of the screen, like the mockup */
  --half-pitch: 80px;      /* half the vertical distance between two events on the same side */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--tan);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

html.modal-open {
  overflow: hidden;
}

button, input, textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  z-index: 10;
}

/* proportions taken from the mockup: 156 x 73 units in a 272 unit sidebar */
.menu-btn {
  width: 57%;
  aspect-ratio: 2.14 / 1;
  border: 0;
  border-radius: 5px;
  background: var(--btn);
  color: var(--ink);
  font-size: clamp(11px, 3.6vw, 14px);   /* shrinks on very narrow phones so "settings" fits */
  line-height: 1;
  text-transform: lowercase;
  cursor: pointer;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn.blank {
  cursor: default;
}

.menu-btn:not(.blank):active,
.menu-btn[aria-expanded="true"] {
  filter: brightness(0.92);
}

/* ---------- artist dropdown ---------- */

.dropdown {
  position: fixed;
  z-index: 15;
  min-width: 160px;
  max-width: calc(100vw - var(--sidebar-w) - 24px);
  background: var(--btn);
  border-radius: 8px;
  padding: 6px 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.dropdown button {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 10px 16px;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.dropdown button:hover,
.dropdown button:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

.dropdown button.current {
  font-weight: bold;
}

.dropdown button.add-artist {
  margin-top: 4px;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  padding-top: 12px;
  color: var(--blue);
}

/* ---------- timeline ---------- */

.timeline {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.timeline-inner {
  position: relative;
}

/* the artist's name stays pinned above the timeline while you scroll */
.artist-name {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0;
  padding: 16px 10px 12px;
  background: var(--tan);
  text-align: center;
  font-size: 18px;
  font-weight: normal;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #000;
  transform: translateX(-0.5px);
}

/* a grid of half-slot rows. event n sits at row n and spans two rows, so events on
   one side are exactly one slot apart and the other side is offset by half a slot.
   --half-pitch is raised by app.js if the tallest event would not fit a slot. */
.events {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: var(--half-pitch);
  align-items: start;
}

.event {
  padding: 0 16%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.event.left  { grid-column: 1; }
.event.right { grid-column: 2; }

.details-link {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 3px 1px;
  color: var(--blue);
  font-size: 13px;
  cursor: pointer;
}

.thumb {
  width: 100%;
  aspect-ratio: 5 / 3;
  background: var(--white);
  border: 1px solid #000;
  border-radius: 10px;
  overflow: hidden;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-title {
  font-size: 17px;
  line-height: 1.15;
  margin: 7px 0 2px;
  overflow-wrap: anywhere;
}

.event-date {
  font-size: 12px;
  line-height: 1.3;
}

/* past events: grey instead of black */
.event.past { color: var(--ink-past); }
.event.past .thumb { border-color: var(--ink-past); opacity: 0.8; }
.event.past .details-link { opacity: 0.8; }

/* room at the bottom so the upcoming event can always sit at the top of the screen */
.tail {
  height: 100vh;
}

.empty {
  grid-column: 1 / -1;
  padding: 30vh 24px 0;
  text-align: center;
  color: var(--ink-past);
  font-size: 15px;
  background: var(--tan);   /* hides the spine behind the message */
  position: relative;
}

/* ---------- popups ---------- */

.overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-w);           /* centred over the timeline, like the mockup */
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 20;
  overscroll-behavior: contain;
}

.popup {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--popup);
  border-radius: 18px;
  padding: 30px 22px 20px;
  margin: 0;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.popup.small {
  max-width: 320px;
}

/* the x: the exact shape and colour from the mockup pdf */
.popup .close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  padding: 5px;
  cursor: pointer;
}

.popup .close svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--pink);
}

.popup-title {
  font-size: 22px;
  font-weight: normal;
  line-height: 1.2;
  margin: 0 36px 10px;
  overflow-wrap: anywhere;
}

.popup-thumb {
  width: 58%;
  margin: 0 auto;
}

.popup-date {
  font-size: 14px;
  margin: 10px 0 18px;
}

.notes {
  background: var(--white);
  border-radius: 22px;
  min-height: 190px;
  padding: 16px 18px;
  text-align: left;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notes.empty-notes {
  color: #999;
}

.popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.pill-btn {
  border: 0;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  padding: 9px 20px;
  cursor: pointer;
  text-transform: lowercase;
}

.pill-btn:active {
  filter: brightness(0.94);
}

.meta {
  font-size: 12px;
  line-height: 1.4;
  color: #555;
  text-align: right;
}

/* form bits (add artist now, add / edit event in phase 2) */
.text-input {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--white);
  font-size: 16px;            /* 16px stops ios zooming in on focus */
  padding: 12px 14px;
  margin: 6px 0 0;
  outline: none;
}

.text-input:focus {
  box-shadow: 0 0 0 2px var(--navy);
}

.form-error {
  min-height: 18px;
  margin: 8px 0 6px;
  font-size: 13px;
  color: #a33;
}

/* ---------- login ---------- */

.login {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--tan);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.login-mark {
  display: block;
  width: 168px;
  height: 168px;
  margin: 0 auto 2px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: normal;
  margin: 0 0 18px;
}

/* ---------- viewers ---------- */

/* visitors get no add or settings button and no edit controls */
body[data-role="viewer"] .editor-only,
body[data-role="viewer"] #btn-add,
body[data-role="viewer"] #btn-settings {
  display: none !important;
}

.menu-note {
  padding: 10px 16px;
  font-size: 14px;
  color: #666;
}

/* ---------- add / edit event form ---------- */

.popup.form {
  text-align: left;
}

.popup.form .popup-title {
  text-align: center;
}

.popup.form .text-input + .text-input,
.popup.form .text-input + .field-row,
.popup.form .check + .text-input {
  margin-top: 10px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.field-row .text-input {
  margin: 0;
  flex: 1 1 150px;
  min-width: 0;
}

.field-row #event-time {
  flex: 1 1 110px;
}

.text-input[type="date"],
.text-input[type="time"] {
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}

textarea.text-input {
  resize: vertical;
  line-height: 1.4;
  min-height: 110px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 4px 0;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--navy);
}

.thumb-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.form-thumb {
  width: 42%;
  flex: 0 0 auto;
}

.thumb-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.file-btn {
  display: inline-block;
}

.link-btn {
  background: none;
  border: 0;
  padding: 4px 0;
  font-size: 14px;
  color: var(--blue);
  cursor: pointer;
}

.link-btn.danger {
  color: #a33;
}

.link-btn.armed {
  font-weight: bold;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-actions .pill-btn {
  margin-left: auto;
}

.pill-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.muted {
  color: #555;
  font-size: 14px;
  margin: 0 0 16px;
}

/* ---------- who are you / settings ---------- */

.who-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
}

.who-list .pill-btn {
  padding: 8px 14px;
  font-size: 15px;
  text-transform: none;
}

.who-list:empty {
  margin: 0;
}

.field-label {
  display: block;
  text-align: left;
  font-size: 13px;
  color: #555;
  margin: 4px 2px 0;
}

.settings-form {
  text-align: left;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.settings-form .form-actions {
  margin-top: 2px;
}

/* ---------- bigger screens ---------- */

@media (min-width: 700px) {
  :root {
    --sidebar-w: 180px;
    --half-pitch: 120px;
  }

  .sidebar {
    gap: 20px;
  }

  .menu-btn {
    width: 62%;
    border-radius: 8px;
    font-size: 22px;
  }

  .timeline-inner {
    max-width: 720px;
    margin: 0 auto;
  }

  .artist-name {
    font-size: 24px;
    padding: 22px 10px 14px;
  }

  .events {
    padding-top: 16px;
  }

  .event {
    padding: 0 11%;
  }

  .details-link { font-size: 16px; }
  .event-title  { font-size: 26px; }
  .event-date   { font-size: 15px; }

  .popup {
    max-width: 440px;
    padding: 34px 28px 24px;
  }
}
