/* ==========================================================================
   What's up with Kanta? -- styles.css
   Design system: "subtle Indian flair" -- warm, calm, color only, no ornament.
   Mobile-first. Palette lives in :root as CSS custom properties.
   ========================================================================== */

:root {
  --cream:      #FBF6EC;   /* page background */
  --paper:      #FFFFFF;   /* cards */
  --ink:        #2B2118;   /* body text, warm near-black */
  --ink-muted:  #7A6B5D;
  --saffron:    #E8862A;   /* primary action, current-location marker */
  --saffron-dk: #C46A15;   /* hover */
  --marigold:   #F2B633;   /* highlights, today cell */
  --peacock:    #1E6F74;   /* secondary, links, "travel" events */
  --henna:      #8C2F2F;   /* headings accent, "project" events */
  --indigo:     #2C3E6B;   /* "other" events, map trail */
  --leaf:       #3E7A4A;   /* success */
  --line:       #E9DECB;   /* borders */

  --radius: 10px;
  --shadow: 0 1px 3px rgba(43, 33, 24, 0.08), 0 1px 2px rgba(43, 33, 24, 0.06);
  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  /* the only decorative flourish: a thin gradient top border on the page */
  border-top: 3px solid;
  border-image: linear-gradient(90deg, var(--saffron), var(--marigold), var(--peacock)) 1;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 0.5em;
}

a {
  color: var(--peacock);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 2px;
}

/* ---- layout ---- */

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---- header + nav ---- */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem 0.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.25rem;
  margin: 0;
}

.site-user {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.tab-bar {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  padding: 0 0.5rem;
}

.tab-bar__link {
  flex: 1 1 0;
  text-align: center;
  white-space: nowrap;
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  color: var(--ink-muted);
  border-bottom: 3px solid transparent;
  font-size: 0.95rem;
}

.tab-bar__link:hover {
  color: var(--ink);
}

.tab-bar__link.is-active {
  color: var(--henna);
  border-bottom-color: var(--saffron);
  font-weight: 600;
}

/* ---- cards ---- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card h3 {
  font-size: 1.05rem;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.section-title {
  font-size: 1.1rem;
  border-left: 4px solid var(--henna);
  padding-left: 0.5rem;
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: var(--saffron);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: var(--saffron-dk);
}

.btn:disabled {
  background: var(--line);
  color: var(--ink-muted);
  cursor: not-allowed;
}

.btn--secondary {
  background: transparent;
  color: var(--peacock);
  border-color: var(--peacock);
}

.btn--secondary:hover {
  background: var(--peacock);
  color: #fff;
}

.btn--danger {
  background: transparent;
  color: var(--henna);
  border-color: var(--henna);
}

.btn--danger:hover {
  background: var(--henna);
  color: #fff;
}

.btn--small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- forms ---- */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-row--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form label {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.form input[type="text"],
.form input[type="date"],
.form input[type="number"],
.form select,
.form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}

.form textarea {
  min-height: 5rem;
  resize: vertical;
  font-family: var(--sans);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .form-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- place search ---- */

.place-search {
  position: relative;
}

.place-search__results {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.place-search__result {
  text-align: left;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.place-search__result:hover {
  border-color: var(--peacock);
}

.place-search__picked {
  font-size: 0.85rem;
  color: var(--leaf);
}

/* ---- Now view ---- */

#map {
  height: 320px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 0;
}

/* Current-location marker: a saffron teardrop drawn with CSS, no image
   assets needed (avoids Leaflet's default-icon-path pitfall on CDN setups). */
.map-pin-wrap {
  background: transparent !important;
  border: none !important;
}

.map-pin {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--saffron);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(43, 33, 24, 0.4);
}

.now-status {
  font-size: 1.1rem;
}

.now-status strong {
  color: var(--henna);
}

.now-note {
  color: var(--ink-muted);
}

/* ---- Calendar view ---- */

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calendar-toolbar__month {
  font-family: var(--serif);
  font-size: 1.2rem;
  min-width: 10ch;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-weekday {
  background: var(--paper);
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-muted);
  padding: 0.3rem 0;
  font-weight: 600;
}

.calendar-day {
  background: var(--paper);
  min-height: 5.5rem;
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  overflow: hidden;
}

.calendar-day:hover {
  background: var(--cream);
}

.calendar-day.is-outside {
  background: #FAF8F3;
  color: var(--ink-muted);
}

.calendar-day.is-today .calendar-day__num {
  background: var(--marigold);
  color: var(--ink);
  border-radius: 50%;
}

.calendar-day__num {
  font-size: 0.8rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day__chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  line-height: 1.4;
  font-size: 0.68rem;
  padding: 1px 5px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 0;
}

.chip--start {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  margin-left: 2px;
}

.chip--end {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  margin-right: 2px;
}

.chip--travel { background: var(--peacock); }
.chip--project { background: var(--henna); }
.chip--other { background: var(--indigo); }

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

.legend__swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upcoming-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upcoming-item__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex: none;
}

.upcoming-item__date {
  color: var(--ink-muted);
  font-size: 0.85rem;
  flex: none;
}

/* ---- Projects view ---- */

.project-card__meta {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: 0.25rem 0 0.5rem;
}

.project-card__details {
  white-space: pre-wrap;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  color: var(--ink);
}

/* ---- Archive view ---- */

.archive-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-wrap: wrap;
}

.archive-row__main {
  display: flex;
  flex-direction: column;
}

.archive-row__title {
  font-weight: 600;
}

.archive-row__meta {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

/* ---- misc ---- */

.muted {
  color: var(--ink-muted);
}

.empty-note {
  color: var(--ink-muted);
  font-style: italic;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  z-index: 30;
}

.modal {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
}

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

.icon-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-muted);
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

.icon-btn:hover {
  color: var(--ink);
}

/* ---- toast ---- */

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 90vw;
  font-size: 0.9rem;
}

.toast--error {
  background: var(--henna);
}

/* ---- sign-in-again full page message ---- */

.signout-screen {
  max-width: 480px;
  margin: 4rem auto;
  padding: 1.5rem;
  text-align: center;
}

/* ---- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
