/* TI 셸 — grid·좌 GNB·스케줄·우측 패널 */
@import url("components/shell-gnb.css");

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

html,
body {
  height: 100%;
  margin: 0;
}

body.ti {
  font-family: "Spoqa Han Sans Neo", system-ui, sans-serif;
  background: #e8e8e8;
  color: #111;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* flex 대신 grid 기본: PC에서 grid 미적용 시 푸터가 flex-shrink로 좁아지는 문제 방지 */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: auto;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  /* GNB HOME 하단 구분선 Y — 우측 패널 헤더 구분선과 맞춤 (24+40+24+16+14+16) */
  --ti-snb-home-rule-y: calc(24px + 40px + 24px + 16px + 14px + 16px);
}

/* PC: 좌·우 2열만 (사이트 푸터는 ti-left 안 ti-footer--slot-pc 에서 표시, shell 직계 푸터는 hidden) */
@media (min-width: 821px) {
  .shell {
    grid-template-columns: clamp(300px, 38vw, 384px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "ti-s-left ti-s-right";
  }

  .shell > .left {
    grid-area: ti-s-left;
    flex: unset;
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 0;
    align-self: stretch;
  }

  .shell > .right {
    grid-area: ti-s-right;
    align-self: stretch;
    min-width: 0;
    min-height: 0;
  }
}

.left {
  flex: 0 0 clamp(300px, 38vw, 384px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* data-ti-left-gnb 마운트: display:contents 는 일부 브라우저·플렉스 조합에서 ti-left-bottom 높이가 0에 가까워질 수 있어 래퍼로 둠 */
.left-gnb-mount {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  align-self: stretch;
  width: 100%;
}

.left-bottom {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px 24px;
  overflow: hidden;
}

.sched-title {
  margin: 0 0 16px;
  padding: 16px 0;
  border-bottom: 1px solid #e2e2e2;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #808080;
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* PC·모바일 공통 4열 — figma date btn (76.5×37, 13px) */
.day-tab,
.week-nav-btn {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 37px;
  padding: 12px 8px;
  border: 1px solid #595959;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  color: #111111;
  cursor: pointer;
  border-radius: 0;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.week-nav-btn {
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-nav-btn:hover {
  background: #f7f7f7;
  border-color: #111111;
}

.day-tab[aria-selected="true"] {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
  font-weight: 700;
}

.sched-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0;
  box-sizing: border-box;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #c8c8c8;
  font-size: 0.78rem;
}

.row:last-child {
  border-bottom: none;
}

.slot {
  flex: 0 0 1.5rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #666;
  font-variant-numeric: tabular-nums;
}

.poster {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 0px solid #999; /* 시간표 포스터 테두리 제거 */
  /* filter: grayscale(1); */
}

.poster--placeholder {
  object-fit: cover;
  background: #e6e6e6;
}

.sched-empty {
  margin: 0;
  padding: 12px 0;
  font-size: 0.78rem;
  color: #666;
}

.title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  color: #222;
}

.title-main {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  vertical-align: middle;
}

.title-text {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badges {
  display: inline-flex;
  flex-direction: row;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
}

.title a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.title a:hover {
  border-bottom-color: #111;
}

.badge {
  box-sizing: border-box;
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  min-width: 24px;
  height: 18px;
  padding: 2px 4px;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.badge--open {
  background: #d9f6e3;
  color: #00c049;
}

.badge--end {
  background: #e2e2e2;
  color: #808080;
}

.badge--gv {
  background: #d8edff;
  color: #0978ff;
}

.badge--ct {
  background: #ffe8e2;
  color: #ff7328;
}

.time {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #333;
}

.book {
  flex-shrink: 0;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  border: 1px solid #111;
  background: transparent;
  color: #111;
  cursor: pointer;
  border-radius: 0;
}

.book:hover {
  background: #111;
  color: #f2f2f2;
}

a.book {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

@media (max-width: 820px) {
  body.ti {
    /* 10 + 48(hamburger) + 10 + 1(border) */
    --ti-mobile-menu-bar-offset: calc(
      69px + env(safe-area-inset-top, 0px)
    );
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }

  .left {
    min-height: 0;
  }

  .shell > .left {
    grid-column: 1;
    grid-row: auto;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding-top: var(--ti-mobile-menu-bar-offset);
    border-right: none;
    border-bottom: 1px solid #bdbdbd;
  }

  .shell > .right {
    grid-column: 1;
    grid-row: auto;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    border-bottom: 1px solid #bdbdbd;
  }

  .shell > .footer.footer--slot-mobile {
    grid-column: 1;
    grid-row: auto;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .left-bottom {
    max-height: none;
    flex: 0 0 auto;
    overflow: visible;
  }

  .sched-scroll {
    flex: 0 0 auto;
    overflow-y: visible;
    max-height: none;
    -webkit-overflow-scrolling: auto;
  }

  .sched-scroll.sched-scroll--swipe {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    padding-right: 0;
  }

  .sched-scroll.sched-scroll--swipe::-webkit-scrollbar {
    display: none;
  }

  .sched-scroll.sched-scroll--swipe .panel {
    display: block;
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    box-sizing: border-box;
    padding-right: 4px;
  }

  .sched-scroll.sched-scroll--swipe .panel[hidden] {
    display: block;
  }
}
