@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@100..125,300..900&family=Newsreader:opsz,wght@6..72,300..700&display=swap");

:root {
  color-scheme: light;
  --ink: #1c1b19;
  --muted: #5a554f;
  --paper: #f7f1e7;
  --accent: #f6a04d;
  --accent-2: #5aa47a;
  --accent-3: #dc4c4c;
  --accent-4: #6c8cd5;
  --card: #fffaf2;
  --line: #e3d9cc;
  --shadow: 0 20px 60px rgba(28, 27, 25, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #f6d7b3 0%, transparent 45%),
    radial-gradient(circle at 80% 20%, #f0c7c7 0%, transparent 40%),
    linear-gradient(160deg, #fbf3e6 0%, #f1e7d8 100%);
  min-height: 100vh;
}

.page {
  padding: clamp(24px, 4vw, 56px) clamp(16px, 5vw, 72px) 72px;
  max-width: 1200px;
  margin: 0 auto;
}

.planner-mode .page {
  max-width: none;
  padding: clamp(12px, 2vw, 28px) clamp(12px, 2vw, 32px);
}

.hero {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

h1 {
  font-family: "Newsreader", serif;
  font-size: clamp(32px, 4vw, 52px);
  margin: 0 0 12px;
}

.subline {
  font-size: 16px;
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.control {
  display: grid;
  gap: 8px;
}

label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

select,
input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f3e9dc;
  border-radius: 14px;
  padding: 4px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.segmented button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.legend {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  font-size: 14px;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.legend-toggle input {
  accent-color: var(--ink);
}

.legend .dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.dot.holiday {
  background: var(--accent-3);
}

.dot.bridge {
  background: var(--accent);
}

.dot.vacation {
  background: var(--accent-2);
}

.dot.weekend {
  background: var(--accent-4);
}

.status {
  margin: 24px 0;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

.content {
  display: block;
}

.planner-mode .content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
}

.year-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.month-card,
.month-grid {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 16px;
  box-shadow: var(--shadow);
}

.month-title {
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-grid {
  display: none;
}

.month-grid.is-visible {
  display: block;
}

.planner-grid {
  display: none;
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  width: 100%;
  flex: 1 1 auto;
}

.planner-grid.is-visible {
  display: block;
}

.planner-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: clamp(10px, 0.9vw, 12.5px);
  table-layout: fixed;
}

.planner-table th,
.planner-table td {
  border: 1px solid var(--line);
  text-align: center;
  padding: clamp(3px, 0.5vw, 6px) 3px;
  vertical-align: middle;
  min-width: 64px;
  height: clamp(16px, 1.5vh, 22px);
}

.planner-table th {
  background: #f3e9dc;
  font-weight: 600;
}

.planner-table td.empty {
  background: #fbf6ee;
}

.planner-table td.weekend {
  background: rgba(108, 140, 213, 0.12);
}

.planner-table .cell-line {
  font-weight: 600;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.planner-table .cell-markers {
  display: inline-flex;
  justify-content: center;
  gap: 3px;
  margin-left: 4px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-header,
.day-cell {
  padding: 8px;
  border-radius: 10px;
  text-align: center;
  font-size: 12px;
  min-width: 0;
}

.day-header {
  font-weight: 600;
  color: var(--muted);
}

.day-cell {
  background: #fff;
  border: 1px solid transparent;
  min-height: 56px;
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: center;
}

.day-cell.compact {
  gap: 4px;
}

.markers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.day-cell.weekend {
  border-color: rgba(108, 140, 213, 0.3);
  background: rgba(108, 140, 213, 0.08);
}

.day-cell.empty {
  background: transparent;
  border: none;
}

.pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
}

.marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.marker.holiday {
  background: var(--accent-3);
}

.marker.bridge {
  background: var(--accent);
}

.marker.vacation {
  background: var(--accent-2);
}

.pill.holiday {
  background: var(--accent-3);
}

.pill.bridge {
  background: var(--accent);
}

.pill.vacation {
  background: var(--accent-2);
}

.month-grid .calendar {
  gap: clamp(6px, 1.4vw, 12px);
}

.month-grid .day-cell {
  min-height: clamp(72px, 10vw, 120px);
  font-size: clamp(12px, 1.6vw, 16px);
}

.control-month {
  display: none;
}

.control-month.is-visible {
  display: grid;
}

@media (max-width: 720px) {
  .page {
    padding: 32px 20px 48px;
  }

  .hero-card {
    position: static;
  }

  .month-card,
  .month-grid {
    padding: 12px;
  }

  .calendar {
    gap: 4px;
  }

  .day-header,
  .day-cell {
    padding: 6px;
    font-size: 11px;
  }

  .day-cell {
    min-height: 48px;
  }

  .pill {
    font-size: 9px;
  }

  .marker {
    width: 8px;
    height: 8px;
  }

  .planner-grid {
    padding: 12px;
  }

  .planner-table {
    font-size: 11px;
    min-width: 960px;
  }
}

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

  .hero-card {
    position: sticky;
    top: 16px;
    z-index: 2;
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .planner-grid {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .planner-mode .planner-grid {
    height: auto;
  }
}

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

  .month-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .calendar {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
  }
}
