/* ==========================================================================
   香港奶蛙科技大學 · The Hong Kong Naiwa University of Science and Technology
   An HKUST-style gateway. Design language borrowed from HKUST: deep blue
   #003366, Roboto, Playfair Display, generous white space.
   ========================================================================== */

@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/assets/fonts/PlayfairDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/assets/fonts/PlayfairDisplay-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #003366;
  --brand-dark: #00234d;
  --ink: #231f20;
  --gray: #58595b;
  --muted: #6f6f6f;
  --line: #e4e4e4;
  --line-soft: #f0f0f0;
  --paper: #ffffff;
  --wash: #f7f7f7;
  --cream: #f7f1e3;
  --gold: #a87b3d;
  --sans: "Roboto", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --serif: "Playfair Display", "Times New Roman", Georgia, serif;
  --song: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC",
    "Source Han Serif SC", "SimSun", serif;
  --container: 1240px;
  --pad: clamp(20px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html[data-lang="zh-hant"] body {
  font-family: "Roboto", "PingFang HK", "PingFang TC", "Microsoft JhengHei",
    "Noto Sans CJK TC", "Noto Sans TC", system-ui, sans-serif;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.container {
  width: min(calc(100% - var(--pad) * 2), var(--container));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: -70px;
  left: 16px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

/* Hide untranslated fallback copy for one frame (JS off keeps it visible). */
html[data-lang] [data-i18n],
html[data-lang] [data-i18n-html] { visibility: hidden; }
html.i18n-ready [data-i18n],
html.i18n-ready [data-i18n-html] { visibility: visible; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.utility {
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
}
.utility__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 40px;
}
.utility__note {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6f6f6f;
}
.lang {
  display: flex;
  align-items: center;
  gap: 2px;
}
.lang__btn {
  position: relative;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--gray);
  font-size: 12.5px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.2s ease;
}
.lang__btn:hover { color: var(--brand); }
.lang__btn[aria-pressed="true"] { color: var(--brand); font-weight: 500; }
.lang__btn[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 1px;
  height: 2px;
  background: var(--brand);
}
.lang__sep {
  width: 1px;
  height: 10px;
  background: #dcdcdc;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 20px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
  text-decoration: none;
}
.brand__seal {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__en {
  display: flex;
  flex-direction: column;
  font-family: var(--serif);
  line-height: 1.04;
  color: #5a5a5a;
}
.brand__en-1 { font-size: 11.5px; letter-spacing: 0.14em; }
.brand__en-2 { margin-top: 2px; font-size: 22px; letter-spacing: 0.05em; }
.brand__en-3 { margin-top: 3px; font-size: 9.5px; letter-spacing: 0.18em; }
.brand__zh {
  margin-top: 6px;
  font-family: var(--song);
  font-size: 14px;
  letter-spacing: 0.26em;
  color: #6f6f6f;
}
.masthead__note {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: #b3b3b3;
  white-space: nowrap;
}

.nav {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: clamp(22px, 4vw, 48px);
  min-height: 54px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav__inner::-webkit-scrollbar { display: none; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 16px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav a:hover { color: var(--brand); }
.nav a:hover::after { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100svh - 178px);
  padding: 56px 0 64px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -240px;
  right: -220px;
  width: 760px;
  height: 760px;
  border: 1px solid rgba(0, 51, 102, 0.1);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  right: 6%;
  bottom: -260px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(168, 123, 61, 0.16);
  border-radius: 50%;
  pointer-events: none;
}
.hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(300px, 0.94fr);
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
}
.hero__copy { max-width: 620px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: currentColor;
}

.hero__title {
  margin-top: 20px;
  color: var(--ink);
  font-size: clamp(42px, 4.5vw, 64px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.045em;
}
.hero__sub {
  margin-top: 14px;
  color: #6f6f6f;
  font-family: var(--serif);
  font-size: clamp(15px, 1.5vw, 18px);
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
}
html[data-lang="en"] .hero__title {
  max-width: 13em;
  font-family: var(--serif);
  font-size: clamp(34px, 3.5vw, 50px);
  line-height: 1.08;
  letter-spacing: 0.005em;
}
html[data-lang="en"] .hero__sub {
  font-family: var(--song);
  font-size: clamp(16px, 1.5vw, 19px);
  letter-spacing: 0.22em;
  text-transform: none;
}
.rule {
  width: 56px;
  height: 3px;
  margin: 26px 0;
  border: 0;
  background: var(--brand);
}

.hero__status {
  max-width: 36em;
  color: var(--gray);
  font-size: 16px;
  line-height: 1.8;
}
.hero__status strong { color: var(--brand); font-weight: 600; }

.hero__url {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: #6f6f6f;
  font-size: 12.5px;
}
.hero__url-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero__url a {
  color: var(--gray);
  text-decoration: none;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #d8d8d8;
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.hero__url a:hover { color: var(--brand); border-color: var(--brand); }

.countdown {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 48px;
  margin-top: 28px;
}
.countdown__num {
  min-width: 1.1ch;
  color: var(--brand);
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.countdown__label {
  color: var(--gray);
  font-size: 14px;
  letter-spacing: 0.01em;
}
body.is-stayed .countdown__num { display: none; }
body.is-stayed .countdown__label { color: var(--brand); font-weight: 500; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 50px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.22s ease, border-color 0.22s ease,
    color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}
.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 51, 102, 0.22);
}
.btn__arrow { transition: transform 0.25s var(--ease); }
.btn--primary:hover .btn__arrow { transform: translateX(3px); }
.btn--ghost {
  background: #fff;
  border-color: #d8d8d8;
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

.hero__note {
  max-width: 38em;
  margin-top: 20px;
  color: #6f6f6f;
  font-size: 12px;
  line-height: 1.65;
}

/* Medallion */
.hero__visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.medallion {
  position: relative;
  width: clamp(280px, 29vw, 380px);
  aspect-ratio: 1;
}
.medallion__ring {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  animation: med-spin 46s linear infinite;
}
.medallion__ring-text {
  fill: #8f8f8f;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 3.2px;
}
.medallion__progress {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.medallion__track { fill: none; stroke: #e6ecf3; stroke-width: 2; }
.medallion__bar {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
body.is-running .medallion__bar { animation: med-fill 4s linear forwards; }
body.is-stayed .medallion__bar {
  animation: none;
  stroke-dashoffset: 0;
  opacity: 0.3;
}
.medallion__photo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 72%;
  height: 72%;
  transform: translate(-50%, -50%);
  border: 3px solid var(--cream);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 16px 36px rgba(35, 31, 32, 0.18);
}
.medallion__caption {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6f6f6f;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}
.medallion__caption::before,
.medallion__caption::after {
  content: "";
  width: 28px;
  height: 1px;
  background: #dcdcdc;
}

/* --------------------------------------------------------------------------
   Footer / toast / no-js
   -------------------------------------------------------------------------- */
.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  color: #6f6f6f;
  font-size: 12px;
}
.footer__links { display: flex; flex-wrap: wrap; gap: 22px; }
.footer__links a {
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.footer__links a:hover {
  color: var(--brand);
  border-color: rgba(0, 51, 102, 0.3);
}
.footer__copy { letter-spacing: 0.02em; }
.footer__disclaimer {
  margin: 10px 0 0;
  padding: 0 var(--pad);
  color: #a3a3a3;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.28s ease, transform 0.28s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.nojs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  padding: 14px 20px;
  border-top: 3px solid var(--brand);
  background: #fff;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
  color: var(--gray);
  font-size: 13px;
  text-align: center;
}
.nojs a { color: var(--brand); }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@keyframes med-spin { to { transform: rotate(1turn); } }
@keyframes med-fill { to { stroke-dashoffset: 0; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: none; }
}
.hero__copy { animation: rise 0.7s var(--ease) both; }
.hero__visual { animation: pop 0.9s var(--ease) 0.12s both; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .hero {
    min-height: 0;
    padding: 48px 0 64px;
  }
  .hero__grid { grid-template-columns: 1fr; gap: 48px; }
  .hero__copy { max-width: 720px; }
  .hero__visual { margin-top: 4px; }
  .medallion { width: min(340px, 70vw); }
}

@media (max-width: 760px) {
  .utility__note { display: none; }
  .utility__inner { justify-content: flex-end; }
  .masthead { padding: 14px 0; gap: 16px; }
  .brand__seal { width: 46px; height: 46px; }
  .brand__en-1 { font-size: 10px; }
  .brand__en-2 { font-size: 18px; }
  .brand__zh { font-size: 12px; letter-spacing: 0.2em; }
  .masthead__note { display: none; }
  .nav__inner {
    flex-wrap: wrap;
    gap: 0 20px;
    min-height: 48px;
    overflow-x: visible;
  }
  .nav a { padding: 10px 0; font-size: 13px; }
  .hero { padding: 36px 0 52px; }
  .hero__title { font-size: clamp(36px, 10vw, 46px); }
  html[data-lang="en"] .hero__title { font-size: clamp(30px, 8vw, 38px); }
  .rule { margin: 22px 0; }
  .hero__status { font-size: 15px; }
  .countdown { margin-top: 22px; }
  .countdown__num { font-size: 38px; }
  .hero__actions { margin-top: 22px; }
  .hero__actions .btn { flex: 1 1 auto; }
  .hero__note { display: none; }
  .medallion { width: min(300px, 78vw); }
  .medallion__caption { font-size: 9.5px; letter-spacing: 0.16em; }
  .medallion__caption::before,
  .medallion__caption::after { width: 18px; }

  .footer__inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer__links { gap: 18px; }
}

@media (max-width: 480px) {
  .hero__actions { display: grid; grid-template-columns: 1fr; }
  .hero__actions .btn { width: 100%; }
  .hero__url { flex-wrap: wrap; row-gap: 4px; }
  .brand__en-2 { font-size: 17px; }
  .brand__zh { font-size: 11.5px; }
  .medallion { width: min(270px, 76vw); }
}

@media (max-height: 800px) and (min-width: 1081px) {
  .hero { min-height: 0; padding: 40px 0 56px; }
  .medallion { width: clamp(280px, 26vw, 340px); }
  .hero__title { font-size: clamp(40px, 4.2vw, 58px); }
  .rule { margin: 20px 0; }
  .countdown { margin-top: 20px; min-height: 44px; }
  .hero__actions { margin-top: 20px; }
  .hero__note { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .medallion__ring,
  .hero__copy,
  .hero__visual { animation: none; }
  .btn,
  .nav a::after { transition: none; }
}

@media print {
  .utility,
  .nav,
  .hero__actions,
  .hero__visual,
  .site-footer,
  .toast,
  .nojs { display: none !important; }
  .hero { min-height: 0; padding: 24px 0; }
}
