/* ==========================================================================
   臺灣狂想曲 Taiwan Rhapsody
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Noto+Serif+TC:wght@400;600;700&family=Noto+Sans+TC:wght@400;500;700&display=swap');

/* --- Tokens ------------------------------------------------------------- */
:root {
  --ink: #525252;
  --ink-strong: #17131b;
  --shell-bg: #efecf2;
  --paper: #fff;
  --muted: #a6a6a6;
  --btn: #302a37;
  --btn-hover: #574a5c;
  --btn-alt: #dcd9e3;
  --btn-alt-hover: #bbaec1;
  --footer-ink: #8e8e8e;

  --display: 'Montserrat', 'Noto Sans TC', 'Microsoft JhengHei', Arial, sans-serif;
  --heading: 'Crimson Text', 'Noto Sans TC', 'Microsoft JhengHei', Georgia, serif;
  --body: 'Lato', 'Noto Sans TC', -apple-system, 'Segoe UI',
          'Microsoft JhengHei', Arial, sans-serif;

  --shell: 1100px;
  --header-h: 125px;
  --banner-h: 550px;   /* theme default; each page overrides inline */
  --ease: 180ms linear;
}

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

body {
  margin: 0;
  padding-top: var(--header-h);
  background: var(--shell-bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; border: 0; }
figure { margin: 0 0 1em; }
figure.img-right { text-align: right; }
figure.img-left  { text-align: left; }
figcaption { padding-top: .5em; font-size: 90%; text-align: center; }

.spacer { width: 100%; }

hr { height: 0; margin: 2.5em 0; border: 0; border-top: 1px solid #e4e0e9; }

a { color: var(--btn); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--muted); }

h1, h2, .h2-like {
  margin: 0 auto 1em;
  color: #000;
  font-family: var(--heading);
  font-size: 69px;
  font-weight: 700;
  line-height: 22px;
}
h3 { margin: 0 0 .8em; font-family: var(--heading); font-size: 24px; font-weight: 700; }

.h2-like { margin-bottom: 1em; }

p { margin: 0 0 1.2em; line-height: 1.7; }

.ta-center { text-align: center; }
.ta-right   { text-align: right; }
.ta-justify { text-align: justify; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- Page shell --------------------------------------------------------- */
.shell-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
}

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 50px; }

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 11;
  width: 100%;
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: var(--shell);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 50px;
  background: var(--paper);
  box-shadow: 0 2px 3px -1px rgba(30, 30, 30, .1);
}

.brand {
  max-width: 300px;
  color: #000;
  font-family: var(--heading);
  font-size: 2.25em;      /* 31.5px, matching the live header */
  font-weight: 700;
  line-height: 1.2;
}
.brand:hover { color: var(--muted); }
.brand img { max-width: 350px; max-height: 75px; }

.nav { margin-left: auto; text-align: right; }
.nav ul { margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.nav li { display: inline-block; }
.nav a {
  display: block;
  padding: 10px 8px;
  color: var(--ink-strong);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: .9em;
  transition: color var(--ease);
}
.nav a:hover,
.nav [aria-current='page'] { color: var(--muted); }

.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

/* --- Banner ------------------------------------------------------------- */
.banner {
  display: flex;
  align-items: center;
  height: var(--banner-h);
  padding: 3.5em;
  background: #574a5c 50% 50% / cover no-repeat;
  color: #fff;
  text-shadow: 0 0 1px rgba(0, 0, 0, .3);
  font-weight: 700;
}
.banner-inner { width: 100%; }
.banner h1,
.banner h2 {
  margin: 0 auto .8em;
  color: #fff;
  font-family: var(--display);   /* the heading override skips the banner */
  font-size: 3.5em;              /* 49px */
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.2;
}
.banner h1:last-child,
.banner h2:last-child { margin-bottom: 0; }
.banner p { margin: 0 auto 2.5em; color: #fff; font-size: 1.2em; }
.banner p:last-child { margin-bottom: 0; }

.banner { text-align: center; }
.banner-left  { text-align: left; }
.banner-right { text-align: right; }
.banner a { color: #fff; }
.banner .btn { background: #fff; color: #000; }
.banner .btn:hover { background: var(--btn-alt); color: #000; }

/* --- Main --------------------------------------------------------------- */
.main { position: relative; z-index: 1; }
.main > .shell > *:last-child { margin-bottom: 0; }

/* --- Columns ------------------------------------------------------------ */
.cols {
  display: flex;
  flex-wrap: nowrap;
  gap: 0 calc(var(--col-pad, 15px) * 2);
  margin-bottom: 1.2em;
}
.cols > .col { flex: 1 1 0; min-width: 0; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  margin-bottom: 1.2em;
  padding: 15px 35px;
  background: var(--btn);
  color: #fff;
  border-radius: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: .92em;
  font-weight: 700;
  transition: background 150ms cubic-bezier(.55, .085, .68, .53);
}
.btn:hover { background: var(--btn-hover); color: #fff; }
.btn:active { background: var(--ink-strong); color: #fff; }
.btn-lg { padding: 20px 40px; }
.btn-sm { padding: 11px 24px; font-size: .85em; }
.btn-primary { background: var(--btn-alt); color: #000; }
.btn-primary:hover { background: var(--btn-alt-hover); color: #000; }

/* Buttons the original site never gave a destination — kept for layout parity. */
.btn-inactive { background: var(--btn-alt); color: #6d6675; cursor: default; }

/* --- Image gallery ------------------------------------------------------ */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 1.2em;
  padding: 5px;   /* the original gave every tile a 5px margin, edges included */
  list-style: none;
}
.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #1b171f;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms ease, opacity var(--ease);
}
.gallery-item:hover img,
.gallery-item:focus-visible img { transform: scale(1.05); opacity: .85; }
.gallery-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  color: #fff;
  text-align: center;
  font-size: .85em;
  line-height: 1.35;
}
.gallery-item:empty,
.gallery-caption:empty { display: none; }

/* --- Slideshow ---------------------------------------------------------- */
.slideshow { margin-bottom: 1.5em; }
.slideshow-compact { max-width: 480px; margin-left: auto; margin-right: auto; }
.slideshow-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #1b171f;
}
.slideshow-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 500ms ease;
}
.slideshow-stage img.is-active { opacity: 1; }

.slideshow-btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  background: rgba(23, 19, 27, .5);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: background var(--ease);
}
.slideshow-btn:hover { background: var(--btn-hover); }
.slideshow-prev { left: 0; }
.slideshow-next { right: 0; }

.slideshow-thumbs {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
  padding: 4px 2px 8px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.slideshow-thumbs li { flex: 0 0 auto; scroll-snap-align: start; }
.slideshow-thumbs button {
  display: block;
  width: 68px;
  height: 50px;
  padding: 0;
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--ease), transform var(--ease);
}
.slideshow-thumbs button:hover { transform: translateY(-2px); }
.slideshow-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slideshow-thumbs [aria-current='true'] {
  border-color: var(--btn-hover);
  transform: scale(1.06);
}

.slideshow-caption { padding-top: .6em; font-size: .95em; text-align: center; }

/* Coffee Shop page: keep each row's captions/buttons aligned even when text length differs. */
body.coffee-shop .cols > .col {
  display: flex;
  flex-direction: column;
}
@media (max-width: 992px) {
  body.coffee-shop .cols > .col { display: block; }
  body.coffee-shop .cols > .col > .col-foot { margin-top: 0; }
}

/* --- Lightbox ----------------------------------------------------------- */
/* Scoped to [open]: an unscoped `display` here would beat the UA's
   `dialog:not([open]) { display: none }` and leave the closed dialog covering
   the page. */
.lightbox[open] {
  display: grid;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  place-items: center;
  padding: 40px 60px;
  background: rgba(23, 19, 27, .93);
  border: 0;
}
.lightbox::backdrop { background: rgba(23, 19, 27, .93); }
.lightbox img {
  width: min(90vw, calc(80vh * 3 / 2));
  height: 80vh;
  max-width: 90vw;
  object-fit: contain;
}
.lightbox-caption { padding-top: 14px; color: #fff; text-align: center; font-size: .95em; }
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 40px;
  line-height: .75;
  transition: color var(--ease);
}
.lightbox-close:hover,
.lightbox-nav:hover { color: var(--btn-alt-hover); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* --- Video -------------------------------------------------------------- */
.video { margin: 1em 0 1.5em; }
.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

/* --- Contact ------------------------------------------------------------ */
.contact-form-block {
  margin-bottom: 1.5em;
  padding: 1.5em;
  background: var(--paper);
  border-radius: 3px;
}
.contact-form-block p:first-child { margin-top: 0; }

.contact-form .form-row { margin-bottom: 1.2em; }
.contact-form label {
  display: block;
  margin-bottom: .5em;
  font-family: var(--display);
  font-size: .85em;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink-strong);
}
.contact-form .req { color: #b5495b; }

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  max-width: 320px;
  padding: .6em .7em;
  font: inherit;
  color: var(--ink-strong);
  background: var(--paper);
  border: 1px solid #d6d2dc;
  border-radius: 3px;
  transition: border-color var(--ease);
}
.contact-form textarea { max-width: 100%; resize: vertical; }
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--btn);
}

.contact-form .form-name {
  display: flex;
  gap: .8em;
  max-width: 320px;
}
.contact-form .form-name input { max-width: none; min-width: 0; flex: 1 1 0; }

.contact-form .form-actions { margin-bottom: 0; }
.contact-form button.btn {
  font: inherit;
  cursor: pointer;
  border: 0;
}

@media (max-width: 480px) {
  .contact-form .form-name { flex-direction: column; }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2.5em 50px;
  background: var(--paper);
  border-top: 4px solid var(--shell-bg);
  color: var(--footer-ink);
  font-size: .92em;
}
.site-footer p { margin-bottom: .5em; }
.site-footer a { color: var(--footer-ink); text-decoration: underline; }
.site-footer a:hover { color: var(--ink-strong); }

.mu-trip-grid-cont {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1180px) {
  .site-header-inner { padding: 0 25px; }
  .shell { padding: 25px; }
  .site-footer { padding: 2em 25px; }
}

@media (max-width: 992px) {
  :root { --header-h: 90px; }

  .site-header-inner { flex-wrap: wrap; align-content: center; }

  .nav-toggle-label {
    display: block;
    position: relative;
    margin-left: auto;
    width: 30px;
    height: 30px;
    cursor: pointer;
  }
  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    position: absolute;
    display: block;
    width: 24px;
    height: 2px;
    background: var(--ink-strong);
    content: '';
    transition: all var(--ease);
  }
  .nav-toggle-label span { top: 14px; left: 3px; }
  .nav-toggle-label span::before { top: -8px; }
  .nav-toggle-label span::after  { top: 8px; }

  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    background: var(--shell-bg);
    text-align: left;
    transition: max-height 400ms ease;
  }
  .nav ul { padding: 0 25px; }
  .nav li { display: block; }
  .nav a { padding: 10px 0; font-size: 1.05em; }

  .nav-toggle:checked ~ .nav { max-height: 80vh; overflow-y: auto; }
  .nav-toggle:checked ~ .nav-toggle-label span { background: transparent; }
  .nav-toggle:checked ~ .nav-toggle-label span::before { top: 0; transform: rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle-label span::after  { top: 0; transform: rotate(-45deg); }

  .brand { font-size: 1.4em; }

  /* Tall banners would swallow a phone screen; cap them but keep short ones short. */
  .banner { height: min(var(--banner-h), 380px); padding: 2em; }
  .banner h1, .banner h2 { font-size: 2em; }

  .cols { display: block; }
  .cols > .col { width: 100% !important; flex-basis: auto !important; margin-bottom: 1.5em; }
  .cols > .col:last-child { margin-bottom: 0; }

  figure.img-right, figure.img-left { text-align: center; }
}

@media (max-width: 767px) {
  .banner { height: min(var(--banner-h), 300px); padding: 1.5em; }
  .banner h1, .banner h2 { font-size: 1.6em; }
  .banner p { font-size: 1em; }
  .shell { padding: 25px 18px; }
  .lightbox { padding: 20px 12px; }
  .lightbox img { width: min(90vw, calc(65vh * 3 / 2)); height: 65vh; }
  .lightbox-nav { font-size: 30px; }
  .mu-trip-grid-cont { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .gallery { grid-template-columns: repeat(1, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .site-footer, .slideshow-btn { display: none; }
  body { padding-top: 0; }
}
