:root {
  --brand-green: #1d4133;
  --bg: #ffffff;
  --grid: #cfcfcf;
  --text: #1a1a1a;
  --muted: #6a6a6a;
  --beginner: #ff1515;
  --intermediate: #f2e814;
  --advanced: #06f31e;
  --label-col: 252px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: #ffffff;
  color: var(--text);
}

.calendar-app {
  max-width: 1260px;
  margin: 12px auto;
  padding: 12px;
  background: #efefef;
  border: 1px solid #d4d4d4;
}

.calendar-header {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr 112px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.legend {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 0.96rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.dot.beginner { background: var(--beginner); }
.dot.intermediate { background: var(--intermediate); }
.dot.advanced { background: var(--advanced); }

.branding {
  text-align: center;
}

.wordmark {
  max-width: 460px;
  width: min(460px, 100%);
  height: auto;
}

.branding h1 {
  margin: 0;
  margin-top: -6px;
  font-family: "Barlow", sans-serif;
  font-size: clamp(1.64rem, 2.9vw, 3.02rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--brand-green);
}

.brand-mark-wrap {
  display: flex;
  justify-content: center;
}

.brand-mark {
  width: 100px;
  height: 100px;
  opacity: 0.34;
  filter: saturate(0.7) contrast(1.05);
}

.controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 8px 0 10px;
}

.pill {
  border: 1px solid #c6c6c6;
  background: #e7e7e7;
  color: #5b5b5b;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Active level pills: transparent-ish versions of legend colors */
.pill.is-active[data-level="beginner"] {
  background: color-mix(in srgb, var(--beginner) 22%, white);
  border-color: color-mix(in srgb, var(--beginner) 55%, white);
  color: #1a1a1a;
}
.pill.is-active[data-level="intermediate"] {
  background: color-mix(in srgb, var(--intermediate) 22%, white);
  border-color: color-mix(in srgb, var(--intermediate) 55%, white);
  color: #1a1a1a;
}
.pill.is-active[data-level="advanced"] {
  background: color-mix(in srgb, var(--advanced) 22%, white);
  border-color: color-mix(in srgb, var(--advanced) 55%, white);
  color: #1a1a1a;
}

/* Print button: royal blue w/ white text */
.print-pill {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1e40af;
}

.calendar-board {
  border: 1px solid var(--grid);
  background: #f2f2f2;
  overflow-x: hidden;
  overflow-y: hidden;
}

.temp-row {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  min-width: 0;
}

.treatment-head {
  padding: 8px 10px;
  color: #fff;
  background: var(--brand-green);
  border-right: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
  font-weight: 700;
  font-size: 1rem;
}

.timeline-head {
  border-bottom: 1px solid var(--grid);
  min-width: 0;
  overflow: hidden;
  background: var(--brand-green);
}

.temp-label {
  text-align: center;
  background: var(--brand-green);
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  font-size: 0.92rem;
}

.months {
  display: grid;
  grid-template-columns: repeat(12, minmax(58px, 1fr));
  min-height: 34px;
  min-width: 0;
  overflow: hidden;
  border-right: 0 !important;
}

.month-cell {
  text-align: center;
  border-left: 1px solid #b7b7b7;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.month-cell:first-child {
  border-left: 0;
}

.month-cell:last-child {
  border-right: 0 !important;
}

.month-cell:last-child .temp,
.month-cell:last-child .name {
  border-right: 0 !important;
}

.month-cell .temp {
  padding: 3px 0 2px;
  font-size: 0.78rem;
  line-height: 1;
}

.month-cell .name {
  background: var(--brand-green);
  padding: 4px 0;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.rows {
  display: grid;
}

.row {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  min-height: 40px;
  min-width: 0;
}

.row + .row .label-cell,
.row + .row .track {
  border-top: 1px solid var(--grid);
}

.label-cell {
  background: #82958e;
  color: #000;
  border-right: 1px solid var(--grid);
  padding: 10px 10px;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.label-cell.treatment-head {
  background: var(--brand-green);
  color: #fff;
}

.treatment-link {
  color: inherit;
  text-decoration: none;
  font: inherit;
  display: inline-flex;
  align-items: baseline;
}

.treatment-resources {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.treatment-link:hover,
.treatment-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.video-badge {
  width: 10px;
  height: 10px;
  margin-left: 4px;
  transform: translateY(-0.33em);
  opacity: 0.95;
}

.treatment-cart-link {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
}

.treatment-cart-link:hover,
.treatment-cart-link:focus-visible {
  opacity: 0.85;
}

.cart-badge {
  width: 10px;
  height: 10px;
  transform: translateY(-0.33em);
  filter: brightness(0) saturate(100%);
  opacity: 0.98;
}

.track {
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(58px, 1fr));
}

.track-guide {
  border-left: 1px solid #c0c0c0;
  pointer-events: none;
}

.track-guide:first-child {
  border-left: 0;
}

.event {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  border-radius: 100px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  font-size: 0.88rem;
}

.event.beginner { background: var(--beginner); color: #fff; }
.event.intermediate { background: var(--intermediate); }
.event.advanced { background: var(--advanced); }

.event[data-hidden="true"] {
  display: none;
}

.dot-event {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.dot-event.beginner { background: var(--beginner); }
.dot-event.intermediate { background: var(--intermediate); }
.dot-event.advanced { background: var(--advanced); }

.dot-event[data-hidden="true"] {
  display: none;
}

.calendar-notes {
  margin-top: 10px;
}

.note-strong {
  margin: 0;
  color: #d91f1f;
  font-weight: 800;
  font-size: 0.98rem;
}

.note-video-link {
  color: inherit;
  text-decoration: none;
  font: inherit;
}

.note-video-link:hover,
.note-video-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.note-video-badge {
  width: 10px;
  height: 10px;
  margin-left: 4px;
  transform: translateY(-0.33em);
  filter: brightness(0) saturate(100%) invert(18%) sepia(95%) saturate(3350%) hue-rotate(347deg) brightness(92%) contrast(95%);
  opacity: 0.95;
}

.note-regular {
  margin: 2px 0 0;
  font-size: 0.93rem;
  font-weight: 600;
}

.note-products {
  margin: 4px 0 0;
  font-size: 0.80rem;
  font-weight: 700;
  color: #FF9900;
}

.note-products-link {
  color: inherit;
  text-decoration: none;
}

.note-products-link:hover,
.note-products-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.note-cart-badge {
  width: 10px;
  height: 10px;
  margin-left: 4px;
  transform: translateY(-0.33em);
  filter: brightness(0) saturate(100%) invert(62%) sepia(83%) saturate(1589%) hue-rotate(358deg) brightness(101%) contrast(106%);
  opacity: 0.98;
}

@media (max-width: 1060px) {
  .calendar-header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }

  .legend {
    justify-content: center;
    font-size: 0.9rem;
  }

  .legend-item {
    justify-content: center;
  }

  .brand-mark-wrap {
    display: none;
  }

  .controls {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  :root {
    --label-col: 200px;
  }

  .label-cell {
    font-size: 0.8rem;
    padding: 8px;
  }

  .month-cell .name {
    font-size: 0.68rem;
  }

  .month-cell .temp {
    font-size: 0.72rem;
  }

  .event {
    font-size: 0.78rem;
    height: 26px;
    padding: 0 8px;
  }

  .dot-event {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 700px) {
  :root {
    --label-col: 176px;
  }

  .calendar-app {
    padding: 8px;
    margin: 0;
    border: 0;
  }

  .label-cell {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .month-cell .name {
    font-size: 0.62rem;
  }

  .month-cell .temp {
    font-size: 0.64rem;
  }

  .event {
    font-size: 0.7rem;
    padding: 0 6px;
  }

  .controls {
    margin-top: 6px;
    margin-bottom: 8px;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 8mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .controls {
    display: none !important;
  }

  /* Force desktop header layout in print */
  .calendar-header {
    display: grid !important;
    grid-template-columns: minmax(240px, 280px) 1fr 112px !important;
    gap: 8px !important;
    align-items: center !important;
    text-align: initial !important;
  }

  .legend {
    justify-content: start !important;
    font-size: 0.96rem !important;
  }

  .legend-item {
    justify-content: flex-start !important;
  }

  .brand-mark-wrap {
    display: flex !important;
    justify-content: center !important;
  }

  /* Keep web look and scale to fit one page */
  .calendar-app {
    transform: scale(0.78);
    transform-origin: top left;
    width: 128%;
    margin: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .calendar-board {
    overflow: visible !important;
  }

  .temp-row,
  .row {
    min-width: 1060px !important;
  }
}

@media (max-width: 1060px) {
  .temp-row,
  .row {
    min-width: 0;
  }

  .calendar-board {
    overflow-x: hidden;
  }
}

/* =========================================================
   FORCE DESKTOP LAYOUT (for proportional iframe scaling)
   ========================================================= */
html.force-desktop {
  --label-col: 252px; /* restore desktop variable */

  /* These two control where the "branding centerline" is.
     Match your header grid side columns: minmax(240px, 280px) and 112px.
     Tweak --legend-col between 240–280 if you want perfect alignment. */
  --legend-col: 285px;
  --logo-col: 112px;
}

html.force-desktop .brand-mark-wrap {
  display: flex !important; /* prevent hide on small screens */
}

html.force-desktop .calendar-header {
  grid-template-columns: minmax(240px, 280px) 1fr 112px !important;
  text-align: initial !important;
  gap: 8px !important;
}

html.force-desktop .legend {
  justify-content: flex-start !important;
  font-size: 0.96rem !important;
}

html.force-desktop .legend-item {
  justify-content: flex-start !important;
}

/* Controls centered to the same centerline as .branding (middle column),
   not the full tool width */
html.force-desktop .controls {
  justify-content: center !important;
  flex-wrap: nowrap !important;
  margin: 8px 0 10px !important;

  /* create the same "middle column" as header */
  margin-left: var(--legend-col) !important;
  margin-right: var(--logo-col) !important;
}

html.force-desktop .calendar-app {
  padding: 12px !important;
  margin: 12px auto !important;
  border: 1px solid #d4d4d4 !important;
}

/* Restore desktop sizing that your media queries shrink */
html.force-desktop .label-cell {
  font-size: 0.9rem !important;
  padding: 10px 10px !important;
  line-height: normal !important;
}

html.force-desktop .month-cell .name {
  font-size: 0.72rem !important;
}

html.force-desktop .month-cell .temp {
  font-size: 0.78rem !important;
}

html.force-desktop .event {
  font-size: 0.88rem !important;
  height: 30px !important;
  padding: 0 12px !important;
}

html.force-desktop .dot-event {
  width: 30px !important;
  height: 30px !important;
}
