/* CSS Reset/Normalize */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang TC",
    "Noto Sans CJK TC",
    "Microsoft JhengHei",
    sans-serif,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  line-height: 1.5;
  font-size: 20px;
  color: #333;
  overflow-x: hidden;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Safari safe area inset */
body {
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

/* CSS variables */
:root {
  --blue: #50aadf;
  --water: #e2eaf7;
  --neutral: #f2f2f2;
  --mascot-red: #ea3822;
  --gray: #666666;
  --slate: #44546a;
  --gold: #f4d236;
  --white: #f2f2f2;
  --teal-blue: #033852;
  --azure: #336799;
  --stiletto: #9a3334;
  --silver: #cbc8c8;
}

/* Utility styles */
.sr-only,
.hidden {
  display: none;
}
.text-gold {
  color: var(--gold);
}
.text-white {
  color: var(--white);
}
.font-arial {
  font-family: Arial;
}
.text-xs {
  font-size: 0.75rem;
}
.text-base {
  font-size: 1rem;
}
.font-bold {
  font-weight: 800;
}
.tracking-widest {
  letter-spacing: 0.1em;
}
.leading-sm {
  line-height: 0.75;
}
.leading-md {
  line-height: 1.25;
}
.m-0 {
  margin: 0;
}
.relative {
  position: relative;
}

/* Main styles */
body {
  min-height: 100vh;
  background-color: var(--silver);
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
  padding: 1rem 0;
}
.container {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
header {
  background-color: var(--blue);
  background-image: url("images/bg.webp");
  background-repeat: no-repeat;
  background-size: cover;
  display: grid;
  grid-template-columns: 60% 1fr 34px;
  grid-template-areas:
    "logo medal menu"
    "date-range medal menu";
  align-items: center;
  justify-items: center;
  column-gap: 2px;
  position: sticky;
  z-index: 100;
  top: 0;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.logo {
  grid-area: logo;
}
.logo img {
  object-fit: contain;
  height: 100%;
}
.date-range {
  grid-area: date-range;
  font-family: Arial;
  color: var(--gray);
  font-size: 0.75rem;
  font-weight: 800;
}
.day {
  font-size: 0.5rem;
  display: inline-block;
  transform: rotate(-90deg);
  vertical-align: super;
  margin: 0 -10px;
}
.medal {
  cursor: pointer;
  background-image: url("images/medal.webp");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  grid-area: medal;
  display: grid;
  align-self: stretch;
  justify-self: stretch;
  grid-template-columns: repeat(3, 1fr);
  /* align-content: stretch; */
  justify-items: center;
  align-items: center;
  gap: 10px;
}
.medal:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}
.medallists-dialog {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  margin: auto;
  width: calc(100% - 1rem);
  height: calc(100vh - 1rem);
  height: calc(100dvh - 1rem);
  max-width: calc(100% - 1rem);
  max-height: calc(100dvh - 1rem);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f17e29;
  color: #000;
  font-size: 18px;
  overflow: hidden;
}
.medallists-dialog[open] {
  display: flex;
  flex-direction: column;
}
.medallists-dialog::backdrop {
  background: rgb(0 0 0 / 20%);
}
.medallists-header {
  position: relative;
  flex-shrink: 0;
  padding: 10px 52px 16px;
  text-align: center;
}
.medallists-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.5;
}
.medallists-close {
  position: absolute;
  top: 5px;
  right: 8px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.medallists-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 9px 18px 20px;
  padding-right: 12px;
  scrollbar-width: thin;
  scrollbar-color: #a64c0c #ffc38d;
}
.medallists-content section + section {
  margin-top: 32px;
}
.medallists-content h3 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 22px;
}
.medallists-content table {
  width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  line-height: 1.3;
}
.medallists-content th {
  padding: 8px 3px;
  background: #000;
  color: #fff;
  text-align: center;
}
.medallists-content th:first-child {
  border-radius: 6px 0 0 6px;
}
.medallists-content th:last-child {
  border-radius: 0 6px 6px 0;
}
.medallists-content td {
  padding: 14px 5px;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.medallists-content tbody tr + tr td {
  border-top: 1px solid #713809;
}
.medallists-content td span {
  display: block;
}
.medallists-content .medallists-empty {
  font-size: 16px;
}
@media (min-width: 768px) {
  .medallists-dialog {
    width: 360px;
    height: 720px;
  }
}
.medal-count {
  transform: translateY(10px);
  color: #123952;
  font-family: Arial;
  font-weight: 800;
  color: var(--teal-blue);
}

nav {
  grid-area: menu;
}
.nav {
  list-style: none;
}
.scroll-margin {
  scroll-margin-top: 150px;
}
.schedule-container {
  border-radius: 0.75rem;
  background-color: var(--gray);
  padding: 0.25rem 0.5rem;
  color: var(--white);
  display: flex;
  align-items: center;
  font-size: 0.8rem;
}
.schedule-expanded {
  position: relative;
  z-index: 10;
}
.schedule-expanded > .channel-badge,
.schedule-expanded > .schedule-toggle {
  position: relative;
  z-index: 2;
}
.schedule-expanded.is-open {
  border-radius: 0.75rem 0.75rem 0 0;
}
.schedule {
  display: flex;
  flex-wrap: wrap;
  overflow-y: hidden;
  /* height: 1.5rem; */
  flex: 1;
  min-width: 0;
}
.required {
  flex-shrink: 0;
  white-space: nowrap;
}
.optional {
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  flex-shrink: 0;
  margin-left: 0.5rem;
  display: none;
}
.schedule-upcoming {
  display: none;
  position: absolute;
  z-index: 1;
  top: 100%;
  right: 0;
  left: 0;
  padding: 0.2rem 0.5rem 0.4rem var(--schedule-text-offset, 0.5rem);
  border-radius: 0 0 0.75rem 0.75rem;
  background-color: var(--gray);
  box-shadow: 0 0.35rem 0.5rem rgb(0 0 0 / 20%);
  white-space: nowrap;
}
.schedule-expanded.is-open .schedule-upcoming {
  display: grid;
  column-gap: 0.5rem;
  row-gap: 0.1rem;
}
.schedule-upcoming > div {
  display: contents;
}
.schedule-upcoming .optional {
  margin-left: 0;
}
.schedule-upcoming > .schedule-empty {
  display: block;
  grid-column: 1 / -1;
}
.schedule-toggle {
  width: 1.5rem;
  height: 1.5rem;
  margin-left: auto;
  /* align-self: center; */
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex: 0 0 1.5rem;
  display: grid;
  place-items: center;
}
.schedule-toggle.hidden {
  display: none;
}
.schedule-toggle span {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 0.12rem solid currentColor;
  border-bottom: 0.12rem solid currentColor;
  transform: translateY(-0.15rem) rotate(45deg);
  transition: transform 0.2s ease;
}
.schedule-expanded.is-open .schedule {
  overflow: visible;
}
.schedule-expanded.is-open .schedule-toggle span {
  transform: translateY(0.15rem) rotate(225deg);
}
.schedule-mobile {
  position: fixed;
  right: 0;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  z-index: 20;
  width: 100%;
  border-radius: 0;
}
.channel-badge {
  border-radius: 0.75rem;
  background-color: var(--stiletto);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  align-self: flex-start;
}
.channel-badge span:first-child {
  display: inline-block;
  white-space: nowrap;
}
.broadcast {
  display: flex;
  justify-content: space-around;
}
/* hamburger */
.hamburger {
  display: flex;
  align-items: center;
  width: 30px;
  height: 30px;
  right: 10px;
  position: absolute;
  z-index: 100;
  cursor: pointer;
}

.hamburger > span {
  display: block;
  width: 100%;
  height: 2px;
  background: #000;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.hamburger:before {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: #000;
  position: absolute;
  top: 3px;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.hamburger:after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: #000;
  position: absolute;
  bottom: 3px;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.hamburger.active > span {
  opacity: 0;
}

.hamburger.active:before {
  transform: rotate(45deg) translateY(-50%);
  top: 50%;
}

.hamburger.active:after {
  transform: rotate(-45deg) translateY(50%);
  bottom: 50%;
}
.nav {
  display: flex;
  flex-direction: column;
  background: var(--gray);
  position: fixed;
  width: 100vw;
  right: 0;
  top: -100vh;
  overflow: auto;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 10;
  padding: 66px 30px 20px 30px;
  row-gap: 1rem;
  color: var(--white);
}
.nav.active {
  top: 0px;
}
.nav li {
  list-style: none;
}
.nav a {
  text-decoration: none;
  font-size: 1.2rem;
}
.nav a span {
  display: block;
}
.backdrop.active {
  background: rgba(0, 0, 0, 0.6);
  z-index: 20;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

.hero {
  margin: 2rem 0;
}
.youtube {
  grid-area: youtube;
}
.youtube iframe {
  aspect-ratio: 16/9;
  width: 100% !important;
}
.hero-ads-wrapper {
  grid-area: hero-ads-wrapper;
}
.hero-ad-vertical {
  margin-top: 0.5rem;
}
.hero-ad-horizontal {
  grid-area: hero-ad-horizontal;
}
.mascot-container,
.hero-ads-wrapper,
.hero-ad-horizontal,
.ad-long {
  display: none;
}

.news {
  margin: 2rem 0;
  position: relative;
  width: 300px;
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
}
.news-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}
.news-heading h2 {
  color: var(--teal-blue);
  font-size: 1.35rem;
}
.news-controls {
  display: flex;
  position: absolute;
  top: 50%;
  right: -44px;
  left: -44px;
  z-index: 1;
  justify-content: space-between;
  pointer-events: none;
  transform: translateY(-50%);
}
.news-controls button {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(128, 128, 128, 0.8);
  border-radius: 50%;
  color: rgba(128, 128, 128, 0.8);
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  pointer-events: auto;
}
.news-controls button:disabled {
  cursor: default;
  opacity: 0.35;
}
.news-viewport {
  overflow: hidden;
  overflow: clip;
}
.news-container {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 100%);
  grid-template-rows: minmax(0, 1fr);
  touch-action: pan-y pinch-zoom;
}
.news-card {
  position: relative;
  min-width: 0;
  align-self: start;
}
.news-card > a {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  background: var(--white);
  border: 1px solid #d9e0e8;
  border-radius: 0.4rem;
  text-decoration: none;
}
.news-card-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--water);
}
.news-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.news-card-content {
  padding: 0.55rem 0.65rem 0.7rem;
}
.news-card time {
  color: var(--gray);
  font-size: 0.65rem;
}
.news-card h3 {
  display: -webkit-box;
  margin: 0.2rem 0;
  overflow: hidden;
  /* font-size: 0.9rem; */
  line-height: 1.35;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.news-card p {
  display: none;
  /* display: -webkit-box; */
  overflow: hidden;
  color: var(--gray);
  font-size: 0.7rem;
  line-height: 1.45;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.news-card .news-more-overlay {
  position: absolute;
  inset: 0 0 0 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--white);
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.news-state {
  padding: 2rem 0;
  color: var(--gray);
  text-align: center;
}

footer {
  color: var(--white);
  background-color: var(--slate);
  font-size: 0.75rem;
}

@media (max-width: 1023px) {
  footer {
    padding-bottom: var(--schedule-mobile-height, 2.5rem);
  }
}
.image-copyright {
  padding: 0.5rem;
  text-align: center;
}
.company-info {
  padding: 0.5rem;
  background-color: var(--gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.company-info a {
  text-decoration: none;
  color: var(--white);
}
address {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  gap: 0.5rem;
  font-style: normal;
  justify-content: center;
}
.ad-slot .adsbygoogle {
  display: block;
  line-height: 0;
}
#div-gpt-ad-samll-0 {
  text-align: center;
}
.ad-note,
.news-ad .note {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}
.ad-small {
  display: block;
  margin: 2rem auto;
}
.ad-small .adsbygoogle {
  width: 320px;
  height: 100px;
  display: block;
  line-height: 0;
}
.ad-m {
  display: block;
  width: 300px;
  height: 250px;
  padding: 0;
  margin: 2rem auto;
  /*overflow: hidden;*/
}
.ad-m .adsbygoogle {
  width: 300px;
  height: 250px;
  display: block;
  line-height: 0;
}

.mascot-m-container {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}
.mascot {
  height: 300px;
  object-fit: contain;
}
.note {
  font-size: 0.75rem;
}
#schedule .note {
  text-align: end;
  font-size: 0.6rem;
}

/* Resopnsive styles */
@media (min-width: 768px) {
  .header {
    grid-template-columns: 30% 30% 15% 25%;
    grid-template-areas: "logo date-range medal menu";
  }
  .date-range {
    justify-self: start;
  }
  .hamburger {
    display: none;
  }
  .nav {
    column-gap: 0.25rem;
    align-items: center;
    height: 100%;
    padding: 0.25rem 0.5rem;
    flex-direction: row;
    background-color: var(--azure);
    position: static;
    width: auto;
    overflow: auto;
    transition: none;
    border-radius: 0.5rem;
  }

  .nav li:not(:last-child) {
    border-right: 2px solid var(--white);
    padding-right: 0.25rem;
  }
  .nav a {
    font-size: 0.75rem;
  }
  .broadcast {
    display: inline;
  }
  .backdrop {
    display: none !important;
    position: static !important;
  }
  address {
    flex-direction: row;
  }
  .news-container {
    grid-auto-columns: calc((100% - 0.5rem) / 2);
    column-gap: 0.5rem;
  }
  .news {
    width: 600px;
  }
  .news-card {
    padding-bottom: 0.75rem;
  }
  .news-card .news-more-overlay {
    inset: 0 0 0.75rem 0;
  }
  .news-card h3 {
    font-size: 0.78rem;
  }
  .news-card p {
    font-size: 0.62rem;
  }

  .optional {
    display: inline-block;
  }
  .schedule-expanded.is-open .schedule-upcoming {
    grid-template-columns: max-content minmax(0, 1fr);
  }
}

@media (min-width: 1024px) {
  .schedule-mobile {
    display: none;
  }
  .container {
    padding-left: calc(50% - 1024px / 2 + 0.5rem);
    padding-right: calc(50% - 1024px / 2 + 0.5rem);
  }
  .nav a {
    font-size: 1rem;
  }

  .date-range {
    font-size: 1.25rem;
  }
  .medal-count {
    transform: translateY(14px);
  }
  #schedule {
    display: flex;
    flex-direction: column;
    justify-content: end;
    align-items: end;
  }
  .schedule-container {
    min-width: 80%;
    width: fit-content;
    font-size: 1.1rem;
  }
  .channel-badge {
    font-size: 1rem;
  }
  .hero-wrapper {
    display: flex;
  }
  .hero {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-areas:
      "youtube hero-ads-wrapper"
      "hero-ad-horizontal hero-ads-wrapper";
    gap: 1rem;
  }
  .news {
    padding: 0 0.5rem;
    width: auto;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
  }

  .news-container {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, auto);
  }

  .news-card {
    padding-bottom: 0.75rem;
  }
  .news-card h3 {
    font-size: 0.78rem;
  }
  .news-card p {
    font-size: 0.62rem;
  }
  .news-controls {
    display: none;
  }
  .mascot-container {
    display: flex;
    flex-basis: 200px;
    justify-content: right;
  }
  .mascot-container img {
    transform: translateY(-50%);
    align-self: center;
    margin-right: 0.5rem;
  }
  .mascot-m-container {
    display: none;
  }
  .hero-ads-wrapper,
  .hero-ad-horizontal,
  .ad-long {
    display: block;
  }
  .ad-m,
  .ad-small {
    display: none;
  }
  .ad-long {
    /* display: block; */
    margin: 2rem 0;
    text-align: center;
  }
  /* .ad-landscape {
    display: block;
    width: 970px;
    height: 250px;
    padding: 0;
    margin: 0 auto;
  }

  .ad-landscape .adsbygoogle {
    width: 970px;
    height: 250px;
    display: block;
    line-height: 0;
  }

  .ad-portrait {
    display: block;
    width: 300px;
    padding: 0;
    margin: 1.5rem auto 0;
  }

  .ad-portrait .adsbygoogle {
    width: 300px;
    height: 600px;
    display: block;
    line-height: 0;
  }

  .ad-square {
    display: block;
    width: 300px;
    height: 250px;
    padding: 0;
    margin: 0 auto;
  }
  .ad-square .adsbygoogle {
    width: 300px;
    height: 250px;
    display: block;
    line-height: 0;
  } */
}
@media (min-width: 1280px) {
  .container {
    padding-left: calc(50% - 1280px / 2 + 0.5rem);
    padding-right: calc(50% - 1280px / 2 + 0.5rem);
  }
  .medal {
    gap: 1rem;
  }
  .medal-count {
    transform: translateY(17px);
    font-size: 1.25rem;
  }
  .scroll-margin {
    scroll-margin-top: 190px;
  }
}
