:root {
  --row-height: 2.6rem;
  --rows: 14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #000;
  background: #fff;
}

#header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 2px solid #000;
  margin-bottom: 1.5rem;
}

#month-label {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
}

#header-controls button {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #000;
  padding: 0.25rem 0.5rem;
}

#week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 1.5rem;
}

.day-column {
  min-width: 0;
}

.day-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  height: var(--row-height);
  border-bottom: 1px solid #000;
}

.day-header .date {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.day-header .weekday {
  text-transform: capitalize;
  opacity: 0.35;
  font-size: 0.9rem;
}

.day-header.today {
  border-bottom-color: #4c6ef5;
}

.day-header.today .date,
.day-header.today .weekday {
  color: #4c6ef5;
  opacity: 1;
}

/* The ruled-paper look: a horizontal line every row-height, continuing
   for a fixed number of rows regardless of how many tasks that day has
   — not just borders between actual task items. */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: calc(var(--row-height) * var(--rows));
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(var(--row-height) - 1px),
    #ddd calc(var(--row-height) - 1px),
    #ddd var(--row-height)
  );
}

.task-row,
.add-task-row {
  height: var(--row-height);
  line-height: var(--row-height);
  padding: 0 0.1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.add-task-row {
  display: flex;
  align-items: center;
  color: #ccc;
}

.add-task-row .icon {
  width: 1.1em;
  height: 1.1em;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  /* Long-press-to-drag (see enableReorder in app.js) only takes over the
     gesture once it fires, so plain vertical scrolling stays untouched
     right up until then. */
  touch-action: pan-y;
}

.task-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

.task-check {
  flex-shrink: 0;
  min-width: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ccc;
}

.task-check .icon {
  width: 1.3em;
  height: 1.3em;
}

.task-row.completed .task-check {
  color: #2f9e44;
}

.task-row.completed .task-label {
  text-decoration: line-through;
  color: #999;
}

.task-row.dragging {
  position: relative;
  z-index: 10;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  border-radius: 6px;
}

.add-task-row:hover {
  color: #888;
}

.add-task-input {
  width: 100%;
  height: var(--row-height);
  border: none;
  background: none;
  font-size: 0.9rem;
  padding: 0 0.1rem;
  font-family: inherit;
}

.add-task-input:focus {
  outline: none;
}

#someday-section {
  max-width: 28rem;
  margin: 3rem 0 0;
}

#someday-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #000;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 100;
}

.modal {
  background: #e4e3fb;
  border-radius: 20px;
  padding: 1.5rem;
  width: min(90vw, 30rem);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.modal-date {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.modal-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.repeat-panel {
  margin-bottom: 0.75rem;
}

.repeat-panel select {
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: none;
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #b9b8e8;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.modal-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #999;
}

.modal-check.is-complete {
  color: #2f9e44;
}

/* Below this width, 7 columns has no room to breathe — dates wrap,
   titles get chopped to nothing. Stack days full-width instead of
   cramming them horizontally. Fewer ruled rows per day too, so a full
   week isn't an absurdly long scroll of mostly-empty lines. */
@media (max-width: 700px) {
  :root {
    --rows: 5;
  }

  body {
    padding: 1rem;
  }

  #month-label {
    font-size: 1.75rem;
  }

  #week-grid {
    grid-template-columns: 1fr;
    row-gap: 2rem;
  }

  #someday-section {
    margin-top: 2rem;
  }

  .day-header .date {
    font-size: 1.3rem;
  }

  .modal-overlay {
    padding-top: 0;
    align-items: center;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
