@import url("/partials/ui-tokens.css?v=a779b3e");

:root {
  color-scheme: light;
  --ink: #111118;
  --paper: #f7f1e6;
  --sand: #efe3d2;
  --terra: #d88f6a;
  --sage: #5e7c73;
  --charcoal: #1d232b;
  --fog: rgba(255, 255, 255, 0.6);
  --shadow: 0 24px 60px rgba(15, 20, 28, 0.16);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #fff1d6 0%, #f2e6d5 40%, #e3d6c5 80%);
  color: var(--ink);
  font-family: "Avenir Next", "Gill Sans", "Segoe UI", sans-serif;
}

.page {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem clamp(0.8rem, 2.5vw, 1.6rem);
}

.calendar-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.calendar-header h2 {
  margin: 0;
  font-size: 1.5rem;
  min-width: 5ch;
  text-align: center;
}

.calendar-header button {
  border: none;
  background: #f1e3cf;
  color: #5a4c40;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.calendar-header button:hover {
  background: #e6d4bc;
  color: #3f342b;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.month-card {
  background: #fff8ef;
  border-radius: var(--radius-lg);
  padding: 1rem;
  border: 1px solid #ecdcc7;
  box-shadow: 0 6px 18px rgba(15, 20, 28, 0.08);
}

.month-name {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--charcoal);
  text-align: center;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.day-header {
  font-size: 0.65rem;
  font-weight: 600;
  color: #9b8d7e;
  padding: 0.15rem 0;
}

.day-cell {
  position: relative;
  font-size: 0.75rem;
  padding: 0.25rem 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s ease;
}

.day-cell.blank {
  cursor: default;
}

.day-cell:not(.blank):hover {
  background: #f1e3cf;
}

.day-cell.today {
  background: var(--terra);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
}

.day-cell.today:hover {
  background: #c4785e;
}

.day-cell.has-event::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage);
}

.day-cell.today.has-event::after {
  background: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #fff8ef;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 90%;
  max-width: 420px;
  border: 1px solid #ecdcc7;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid #e6d4bc;
  border-radius: var(--radius-md);
  padding: 0.55rem 0.7rem;
  background: #fff;
  font-size: 0.9rem;
  font-family: inherit;
}

.modal-card input:focus,
.modal-card textarea:focus {
  outline: none;
  border-color: var(--terra);
}

.modal-card textarea {
  resize: vertical;
  min-height: 80px;
}

.color-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.color-dot:hover {
  border-color: #bbb;
}

.color-dot.selected {
  border-color: var(--charcoal);
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.primary-button {
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff8ef;
  cursor: pointer;
  font-size: 0.85rem;
  transition: box-shadow 0.2s ease;
}

.primary-button:hover {
  box-shadow: 0 10px 20px rgba(24, 33, 44, 0.2);
}

.ghost-button {
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #f1e3cf;
  color: #5a4c40;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.ghost-button:hover {
  background: #e6d4bc;
  color: #3f342b;
}

.danger-button {
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #c94a3a;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: box-shadow 0.2s ease;
}

.danger-button:hover {
  box-shadow: 0 10px 20px rgba(180, 50, 40, 0.2);
}

.day-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
}

.day-panel-overlay.open {
  display: flex;
}

.day-panel-card {
  background: #fff8ef;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 90%;
  max-width: 380px;
  border: 1px solid #ecdcc7;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.day-panel-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.day-panel-empty {
  margin: 0;
  color: #9b8d7e;
  font-size: 0.9rem;
}

.day-event-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.event-label {
  flex: 1;
  font-size: 0.9rem;
}

.event-edit-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

.day-panel-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1200px) {
  .year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .year-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .year-grid {
    grid-template-columns: 1fr;
  }

  .page {
    min-height: 100dvh;
    gap: 0.7rem;
    padding: 0.9rem clamp(0.8rem, 3vw, 1.2rem);
  }
}
