/* ==========================================================================
   Variables & Reset
   ========================================================================== */

:root {
  --color-primary: #1ca6ec;
  --color-primary-dark: #0057b2;
  --color-primary-darker: #026eba;
  --color-red: #e95e5b;
  --color-text: #454545;
  --color-text-light: #666;
  --color-bg-light: #e7f6ff;
  --color-white: #fff;
  --font-family: 'Noto Sans TC', sans-serif;
  --nav-height: 75px;
  --nav-height-mobile: 52px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  line-height: 1.5;
  overflow-x: hidden;
  background: var(--color-white);
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* ==========================================================================
   Navigation  —  Figma: 1920×75, logo at x=79, items end ~x=1697
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--color-white);
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.nav__inner {
  width: 100%;
  max-width: 1920px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px 0 79px;
  display: flex;
  align-items: center;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav__logo-img {
  height: 40px;
  object-fit: contain;
}

/* nav items pushed right — Figma: items start at ~x=1073, gap=48px */
.nav__menu {
  display: flex;
  align-items: center;
  gap: 36px;
  margin-left: auto;
  margin-right: 32px;
}

.nav__link {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.nav__link--blue {
  color: var(--color-primary-dark);
}

.nav__link--dark {
  color: var(--color-text);
}

.nav__link:hover {
  opacity: 0.7;
}

.nav__link {
  position: relative;
}

.nav__link--active {
  color: var(--color-primary) !important;
}

.nav__link--active::after {
  content: '';
  position: absolute;
  left: -10px;
  bottom: -25px;
  width: calc(100% + 20px);
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

.nav__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav__social {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #06CAA5;
  border-radius: 20px;
  padding: 6px 12px;
}

.nav__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 28px;
  color: var(--color-white);
  transition: opacity 0.2s;
}

.nav__social-link:hover {
  opacity: 0.7;
}

.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-left: auto;
}

.nav__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav__hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav__hamburger.active span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: var(--nav-height-mobile);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--nav-height-mobile));
  background: var(--color-white);
  z-index: 999;
  padding: 32px 48px;
  display: none;
  flex-direction: column;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu__list {
  display: flex;
  flex-direction: column;
}

.mobile-menu__link {
  display: block;
  font-size: 20px;
  font-weight: 500;
  color: var(--color-text);
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}

.mobile-menu__social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.mobile-menu__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-white);
  background: var(--color-primary);
}

/* ==========================================================================
   Hero  —  Figma: 1920×700
   翰林 title: 710×329 at (129, 84)
   連線未來 title: 853×329 at (315, 351)
   ========================================================================== */

.hero {
  width: 100%;
  margin-top: var(--nav-height);
}

.hero__img--desktop {
  display: block;
  width: 100%;
  height: auto;
}

.hero__img--tablet,
.hero__img--mobile {
  display: none;
}

/* ==========================================================================
   Products  —  Figma: 1920×1863, bg #e7f6ff with cloud image
   Cards: 4 cols × 350px, at x=209,583,959,1335 → total grid width ≈1476px
   Tab bar: 399×78 at center, y=100 relative
   Row 1 at y=267, Row 2 at y=1055
   ========================================================================== */

.products {
  position: relative;
  width: 100%;
  padding: 36px 0 60px;
  min-height: 800px;
  overflow: hidden;
}

.products__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.products__bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.products__inner {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 80px;
}

/* Controls container — wraps tabs + filters for unified positioning */
.products__controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 64px;
}

/* Tabs — Figma: 399×78, border-radius 50px, centered */
.products__tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--color-white);
  border-radius: 50px;
  padding: 8px 20px;
  width: 320px;
  height: 62px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.products__tab {
  width: 80px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  border-radius: 16px;
  transition: background 0.25s, color 0.25s;
  letter-spacing: 8px;
  padding-left: 8px;
}

.products__tab:hover {
  color: var(--color-primary);
}

.products__tab--active {
  background: var(--color-primary);
  color: var(--color-white);
}

.products__tab--active:hover {
  color: var(--color-white);
}

/* Sub-category filters */
.products__filters {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.products__filter {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-light);
  background: var(--color-white);
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 6px 20px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.products__filter:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.products__filter--active,
.products__filter--active:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

/* 教務行政 filter button — distinct color */
.products__filter--admin {
  color: #e07c24;
  border-color: #f0a050;
}

.products__filter--admin:hover {
  color: #e07c24;
  border-color: #e07c24;
}

.products__filter--admin.products__filter--active,
.products__filter--admin.products__filter--active:hover {
  background: #e07c24;
  color: var(--color-white);
  border-color: #e07c24;
}

/* Card grid — 4 cols, gap ≈ 26px, card width 350px */
.products__grid {
  display: grid;
  grid-template-columns: repeat(4, 280px);
  gap: 40px;
  justify-content: center;
  align-items: stretch;
}

.product-card {
  width: 280px;
  background: var(--color-white);
  border-radius: 20px;
  overflow: visible;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}

.product-card__img {
  width: 100%;
  aspect-ratio: 280 / 260;
  overflow: visible;
  flex-shrink: 0;
  margin-top: -30px;
}

.product-card__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top;
}

/* Card body — Figma: 350×384, white, bottom rounded */
.product-card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Figma: 18px, #454545, line-height 1.5, letter-spacing 0.36 */
.product-card__desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.45;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.product-card__features {
  margin-bottom: 14px;
  flex: 1;
}

/* Figma: 16px, black, line-height 2, letter-spacing 0.32, left padding for bullet */
.product-card__features li {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: #000;
  line-height: 1.8;
  padding-left: 18px;
  letter-spacing: 0.3px;
}

/* Figma: 11×11 blue dot */
.product-card__features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
}

/* Figma: btns at x=91 and x=220, each 100×50 */
.product-card__actions {
  display: flex;
  gap: 29px;
  justify-content: center;
}

/* Figma: 100×50, border-radius 4px, letter-spacing 18px */
.product-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 40px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 400;
  color: var(--color-white);
  letter-spacing: 14px;
  padding-left: 14px;
  transition: opacity 0.2s;
}

.product-card__btn:hover {
  opacity: 0.85;
}

.product-card__btn--video {
  background: var(--color-primary);
}

.product-card__btn--demo {
  background: var(--color-red);
}

/* ==========================================================================
   AI Concept (AI說明) — Figma: 1920×1080
   背景圖: 1944×1111
   文字圖: 1370×230 at (287, 108)
   書本圖: 1454×818 at (245, 223)
   ========================================================================== */

.ai-concept {
  width: 100%;
}

.ai-concept__img--desktop {
  display: block;
  width: 100%;
  height: auto;
}

.ai-concept__mobile {
  display: none;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.ai-concept__mobile-bg {
  display: block;
  width: 100%;
  height: auto;
}

.ai-concept__mobile-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   Digital (數位文宣) — Figma: 1920×953
   Title: "數位文宣" 300×80 at (810, 133) — centered
   Cards: 350×573, at x=394, 785, 1178, y=280
   Gap between cards: ~41px
   Background: gradient with overlaid images
   ========================================================================== */

.digital {
  position: relative;
  width: 100%;
  padding: 40px 0 50px;
  overflow: hidden;
  background: url('../images/digital-bg.png') center / cover no-repeat;
}

.digital__inner {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 80px;
}

/* Section title — Figma: 300×80, border-radius 8px, centered */
.section-title-wrap {
  text-align: center;
  margin-bottom: 40px;
}

.section-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  height: 64px;
  font-size: 26px;
  font-weight: 700;
  color: var(--color-white);
  background: linear-gradient(103.27deg, #09F1C5 1.56%, #00B9D7 63.97%, #17A2D3 99.87%);
  padding: 0 40px;
  border-radius: 40px;
  box-shadow: 0px 4px 4px 0px #00000040;
  letter-spacing: 5px;
  padding-left: calc(40px + 2.5px);
}

.digital__nav,
.resources__nav {
  display: none;
}

/* Cards — 3 × 350px, gap 41px, centered in 1920 */
.digital__grid {
  display: grid;
  grid-template-columns: repeat(3, 280px);
  gap: 56px;
  justify-content: center;
}

.digital__card {
  width: 280px;
  text-align: center;
}


/* Digital Card (dcard) — poster-style card */
.dcard {
  display: block;
  background: #f8c4c0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0px 4px 4px 0px #00000040;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dcard:hover {
  transform: translateY(-4px);
  box-shadow: 0px 8px 16px 0px #00000030;
}

.dcard__placeholder {
  width: 100%;
  aspect-ratio: 350 / 489;
  background: #f0f0f0;
}

.dcard__info {
  background: #fff;
  padding: 10px 12px 12px;
  margin: 0;
  text-align: left;
}

.dcard__image {
  width: 100%;
  aspect-ratio: 350 / 489;
  object-fit: cover;
}

.dcard__info-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

/* ==========================================================================
   Resources (資源連結) — Figma: 1920×531
   Title: 300×80 at (810, 100)
   Cards: 350×149 at x=394, 785, 1178, y=282
   Each card: icon area 110×110 + text
   ========================================================================== */

.resources {
  position: relative;
  width: 100%;
  padding: 36px 0 48px;
  overflow: hidden;
  background: linear-gradient(180deg, #dce9f5 0%, #c8daf0 100%);
}

.resources__inner {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 80px;
}

/* Cards — same 3-col grid as digital */
.resources__grid {
  display: grid;
  grid-template-columns: repeat(3, 200px);
  gap: 40px;
  justify-content: center;
}

/* Figma: 350×149, white bg, rounded corners */
.resources__card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-white);
  border-radius: 12px;
  padding: 14px;
  width: 200px;
  height: 90px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}

.resources__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

/* Figma: icon area 110×110 */
.resources__card-icon {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
}

.resources__card-icon img {
  width: 100%;
  height: 100%;
}

/* Figma: large bold text */
.resources__card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary-dark);
  letter-spacing: 2px;
}

/* ==========================================================================
   Back to Top — Figma: 44×44 at bottom-right
   ========================================================================== */

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(28, 166, 236, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, bottom 0.15s ease-out;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   Footer — Figma: 1920×100, dark bg
   Logo at (32, 39), copyright at (101, 43)
   Social icons at (1762, 30) 136×40
   ========================================================================== */

.footer {
  background: #31578F;
  height: 100px;
}

.footer__inner {
  width: 100%;
  max-width: 1920px;
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.footer__logo-img {
  height: 30px;
  object-fit: contain;
}

.footer__copyright {
  font-size: 13px;
  color: var(--color-white);
  letter-spacing: 0.5px;
}

.footer__social {
  display: flex;
  gap: 8px;
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #999;
  transition: color 0.2s;
}

.footer__social-link:hover {
  color: var(--color-white);
}

/* ==========================================================================
   Responsive — Tablet (≤1280)
   ========================================================================== */

@media (max-width: 1540px) {
  .products__grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1476px;
    margin-left: auto;
    margin-right: auto;
  }

  .product-card {
    width: 100%;
  }

  .digital__grid {
    grid-template-columns: repeat(3, 280px);
    gap: 56px;
  }

  .digital__card {
    width: 280px;
  }

  .resources__grid {
    grid-template-columns: repeat(3, 200px);
    gap: 40px;
  }

  .resources__card {
    width: 200px;
  }
}

@media (max-width: 1024px) {
  .nav__inner {
    padding: 0 32px;
  }

  .nav__menu {
    gap: 28px;
  }

  .nav__link {
    font-size: 16px;
  }

  /* Hero — tablet */
  .hero__img--desktop {
    display: none;
  }

  .hero__img--tablet {
    display: block;
    width: 100%;
    height: auto;
  }

  .products__grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 740px;
    gap: 20px;
  }

  .product-card__img {
    height: auto;
    aspect-ratio: 350 / 324;
  }

  .digital__grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 740px;
    margin: 0 auto;
  }

  .resources__grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 740px;
    margin: 0 auto;
  }

  .resources__card-name {
    font-size: 24px;
  }
}

/* ==========================================================================
   Responsive — Mobile (≤768)
   ========================================================================== */

@media (max-width: 768px) {
  :root {
    --nav-height: var(--nav-height-mobile);
  }

  .nav__inner {
    padding: 0 16px;
  }

  .nav__menu,
  .nav__actions {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  /* AI Concept — mobile swap */
  .ai-concept__img--desktop {
    display: none;
  }

  .ai-concept__mobile {
    display: block;
  }

  /* Hero — mobile */
  .hero {
    margin-top: var(--nav-height-mobile);
  }

  .hero__img--tablet {
    display: none;
  }

  .hero__img--mobile {
    display: block;
    width: 100%;
    height: auto;
  }

  /* Products */
  .products {
    padding: 32px 0 48px;
  }

  .products__inner {
    padding: 0 32px;
  }

  .products__controls {
    gap: 12px;
    margin-bottom: 48px;
  }

  .products__tabs {
    width: auto;
    min-width: 0;
    height: 60px;
    padding: 6px 16px;
  }

  .products__tab {
    width: auto;
    height: 44px;
    font-size: 16px;
    padding: 6px 16px;
    letter-spacing: 4px;
    padding-left: calc(16px + 2px);
  }

  .products__filters {
    gap: 8px;
    flex-wrap: wrap;
  }

  .products__filter {
    font-size: 13px;
    padding: 5px 14px;
  }

  .products__grid {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 40px;
  }

  .product-card {
    width: 100%;
  }

  .product-card__img {
    height: auto;
    aspect-ratio: 350 / 324;
  }

  .product-card__body {
    padding: 20px 20px 24px;
  }

  .product-card__desc {
    font-size: 16px;
  }

  .product-card__features li {
    font-size: 16px;
  }

  .product-card__btn {
    width: 80px;
    height: 42px;
    font-size: 16px;
    letter-spacing: 10px;
    padding-left: 10px;
  }

  /* Digital */
  .digital {
    padding: 48px 0 60px;
  }

  .digital__inner {
    padding: 0 16px;
  }

  .digital__grid {
    display: block;
    position: relative;
    max-width: 280px;
    margin: 0 auto;
  }

  .digital__card {
    display: none;
    width: 100%;
  }

  .digital__card.digital__card--active {
    display: block;
  }

  .digital__nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
  }

  .digital__nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--color-primary);
    cursor: pointer;
  }

  .digital__nav-dots {
    display: flex;
    gap: 8px;
  }

  .digital__nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.2s;
  }

  .digital__nav-dot--active {
    background: var(--color-white);
  }

  .section-title {
    font-size: 24px;
    min-width: auto;
    height: 60px;
    padding: 0 32px;
    padding-left: calc(32px + 2px);
    letter-spacing: 4px;
  }

  /* Resources — carousel */
  .resources {
    padding: 20px 0 24px;
  }

  .resources__inner {
    padding: 0 32px;
  }

  .resources__grid {
    display: block;
    position: relative;
    max-width: 260px;
    margin: 0 auto;
  }

  .resources__card {
    display: none;
    width: 100%;
    height: auto;
    padding: 16px;
  }

  .resources__card.resources__card--active {
    display: flex;
    align-items: center;
  }

  .resources__card-icon {
    width: 80px;
    height: 80px;
  }

  .resources__card-name {
    font-size: 24px;
  }

  .resources__nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
  }

  .resources__nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--color-primary);
    cursor: pointer;
  }

  .resources__nav-dots {
    display: flex;
    gap: 8px;
  }

  .resources__nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.2s;
  }

  .resources__nav-dot--active {
    background: var(--color-white);
  }

  /* Footer */
  .footer {
    height: auto;
    padding: 20px 0;
  }

  .footer__inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 0 16px;
  }

  .footer__left {
    flex-direction: column;
    gap: 8px;
  }

  .footer__copyright {
    font-size: 11px;
  }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation applied dynamically via JS for correct delay per card count */
