/* ============================================================
   好樣文房 VVG Chapter — vanilla stylesheet
   Animation craft follows Emil Kowalski's design-engineering
   philosophy: custom easing curves, purposeful motion,
   responsive press feedback, reduced-motion safety.
   ============================================================ */

:root {
  /* Palette */
  --paper: #f4efe6;
  --paper-dark: #e8dcc8;
  --ink: #1c1917;
  --ink-light: #78716c;
  --copper: #b45309;
  --copper-light: #d97706;
  --cream: #fefcf7;
  --wood: #5c4033;
  --mask: rgba(28, 25, 23, 0.35);

  /* Emil's strong easing curves — the built-in CSS easings
     are too weak; these give motion intentional punch. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto; /* Lenis owns smooth scrolling */
}

body {
  margin: 0;
  font-family: "Archivo", sans-serif;
  background-color: var(--paper);
  color: var(--ink);
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Noto Serif TC", serif;
}

.font-display-en { font-family: "Oranienbaum", serif; }
.font-body       { font-family: "Archivo", sans-serif; }
.font-serif-cn   { font-family: "Noto Serif TC", serif; }

/* ---------- Ink trail canvas ---------- */
#ink-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: all;
}

.content-layer {
  position: relative;
  z-index: 10;
}

/* ============================================================
   Calligraphy character reveal
   Each glyph is wrapped in an overflow-hidden mask so the
   inner span can rise into view.
   ============================================================ */
.char-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.char-inner {
  display: inline-block;
}

/* ============================================================
   Dot navigation (right rail)
   ============================================================ */
.dot-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dot-nav__item {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
}

.dot-nav__label {
  position: absolute;
  right: 45px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  opacity: 0;
  /* Origin-aware: label slides out from the dot it belongs to.
     Specific properties, strong ease-out, sub-300ms. */
  transition: opacity 220ms var(--ease-out),
              transform 220ms var(--ease-out);
  font-size: 0.875rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}

.dot-nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  display: block;
  transition: background-color 240ms var(--ease-out),
              transform 240ms var(--ease-out);
}

.dot-nav__item[data-active="true"] .dot-nav__dot {
  background: var(--ink);
  transform: scale(1.15);
}

@media (hover: hover) and (pointer: fine) {
  .dot-nav__item:hover .dot-nav__label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  .dot-nav__item:hover .dot-nav__dot {
    transform: scale(1.4);
  }
}

.dot-nav__item:active .dot-nav__dot {
  transform: scale(0.9);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  z-index: 10;
  pointer-events: none;
}

.hero__logo {
  position: absolute;
  top: 2rem;
  left: 2rem;
  pointer-events: auto;
}
.hero__logo-img {
  /* logo.png is an 8x render; 27px tall shows the circle mark at 24px */
  display: block;
  height: 27px;
  width: auto;
}

.hero__center {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: auto;
}
.hero__plate {
  background: var(--mask);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 2rem 3rem;
  border-radius: 2px;
}
.hero__title {
  font-family: "Noto Serif TC", serif;
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0;
  margin: 0;
}
.hero__subtitle {
  font-family: "Archivo", sans-serif;
  font-size: clamp(0.75rem, 1.5vw, 1.5rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-top: 1rem;
  opacity: 0;
}

.hero__scroll {
  position: absolute;
  bottom: 3rem;
  left: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
}
.hero__scroll-label {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
  writing-mode: vertical-rl;
}
.hero__scroll-line {
  width: 1px;
  height: 40px;
  background-color: var(--copper);
  animation: scrollBounce 2s var(--ease-in-out) infinite;
}

.hero__info {
  position: absolute;
  bottom: 3rem;
  right: 2rem;
  opacity: 0;
  max-width: 40vw;
  text-align: right;
}
.hero__info span {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-light);
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* ============================================================
   Shared section scaffolding
   ============================================================ */
.section {
  position: relative;
  z-index: 10;
  pointer-events: none;
}
.section--paper      { background-color: var(--paper); }
.section--paper-dark { background-color: var(--paper-dark); }

.container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 4rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 1.5rem;
}

.chapter-heading {
  font-family: "Noto Serif TC", serif;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0;
}

.subhead-en {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-family: "Archivo", sans-serif;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-top: 0.75rem;
}

.body-copy {
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0;
}

.text-link {
  display: inline-block;
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 400;
  color: var(--copper);
  text-decoration: none;
  pointer-events: auto;
  background-image: linear-gradient(var(--copper), var(--copper));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 260ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .text-link:hover { background-size: 100% 1px; }
}

/* Primary CTA button */
.btn {
  background-color: var(--ink);
  color: var(--paper);
  padding: 1rem 3rem;
  font-size: 0.875rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  border-radius: 1px;
  /* Specific properties only — never `all`. Colour change on
     hover uses gentle `ease`; press uses snappy ease-out. */
  transition: background-color 300ms ease,
              transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background-color: var(--copper); }
}
.btn:active { transform: scale(0.97); }

.btn--compact { padding: 1rem 2.5rem; }
@media (hover: hover) and (pointer: fine) {
  .btn--compact:hover { background-color: var(--wood); }
}

/* Parallax image frames */
.img-frame {
  border-radius: 2px;
  overflow: hidden;
}
.img-frame img {
  width: 100%;
  display: block;
  will-change: transform;
}

/* ============================================================
   Preface
   ============================================================ */
.preface {
  padding-top: 12rem;
  padding-bottom: 6rem;
}
.preface__grid {
  display: grid;
  grid-template-columns: 55% 45%;
  gap: 4rem;
  align-items: start;
}
.preface__image {
  box-shadow: 0 8px 40px rgba(28, 25, 23, 0.1);
}
.preface__image img {
  height: 120%;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}
.preface__content {
  padding-top: 6rem;
  pointer-events: auto;
}
.preface__paras {
  margin-top: 2rem;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================================
   Building
   ============================================================ */
.building { padding: 8rem 0; }
.building__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
.building__content { pointer-events: auto; }
.building__paras {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.building__image img {
  height: 120%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.stats {
  margin-top: 3rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.stat { text-align: center; }
.stat__number {
  font-family: "Noto Serif TC", serif;
  font-size: 4rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.stat__label {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  margin-top: 0.5rem;
}
.stat__divider {
  width: 1px;
  height: 60px;
  background-color: rgba(28, 25, 23, 0.15);
  align-self: center;
}

/* ============================================================
   Quote
   ============================================================ */
.quote { padding: 10rem 0; }
.quote__inner {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 4rem;
  text-align: center;
}
.quote__text {
  font-family: "Noto Serif TC", serif;
  font-size: clamp(1.5rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  opacity: 0;
}
.quote__attribution {
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  color: var(--ink-light);
  margin-top: 2rem;
  opacity: 0;
}

/* 3D ribbon flip glyphs for the quote */
.ribbon-char {
  display: inline-block;
  perspective: 1000px;
}
.ribbon-inner {
  display: inline-block;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

/* ============================================================
   Experience
   ============================================================ */
.experience {
  padding-top: 12rem;
  padding-bottom: 6rem;
}
.experience__header {
  text-align: center;
  margin-bottom: 4rem;
}
.experience__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.exp-card {
  background-color: var(--cream);
  border-radius: 2px;
  padding: 2.5rem;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.04);
  cursor: default;
  pointer-events: auto;
  /* Specific properties, not `all`. Lift is subtle and quick. */
  transition: background-color 300ms var(--ease-out),
              box-shadow 300ms var(--ease-out),
              transform 300ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .exp-card:hover {
    background-color: var(--paper-dark);
    box-shadow: 0 8px 32px rgba(28, 25, 23, 0.08);
    transform: translateY(-4px);
  }
}
.exp-card__icon { margin-bottom: 1.5rem; line-height: 0; }
.exp-card__title {
  font-size: 1.25rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 1rem 0;
}
.exp-card__body {
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ink-light);
  margin: 0 0 1.5rem 0;
}

/* ============================================================
   Events
   ============================================================ */
.events { padding: 8rem 0; }
.events__grid {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 4rem;
  align-items: center;
}
.event-card {
  background-color: var(--cream);
  border-radius: 2px;
  padding: 2.5rem;
  box-shadow: 0 8px 32px rgba(28, 25, 23, 0.08);
  border: 1px solid rgba(28, 25, 23, 0.06);
  pointer-events: auto;
}
.event-card__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: white;
  background-color: var(--copper);
  padding: 0.25rem 0.75rem;
  border-radius: 1px;
  margin-bottom: 1.5rem;
}
.event-card__title {
  font-family: "Noto Serif TC", serif;
  font-size: clamp(1.5rem, 3.5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 1rem 0;
}
.event-card__date {
  font-size: 1.25rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  color: var(--ink-light);
  margin: 0 0 1.5rem 0;
}
.event-card__body {
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ink);
  margin: 0 0 2rem 0;
}
.events__image img {
  height: 120%;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

/* ============================================================
   Gallery ribbon (marquee)
   ============================================================ */
.gallery {
  padding: 6rem 0;
  overflow: hidden;
}
.gallery__header {
  text-align: center;
  margin-bottom: 3rem;
}
.gallery__ribbon {
  opacity: 0;
  pointer-events: auto;
}
.gallery-ribbon-track {
  display: flex;
  gap: 1.5rem;
  width: max-content;
  /* Constant motion → linear, as the framework prescribes. */
  animation: ribbonScroll 40s linear infinite;
}
@media (hover: hover) and (pointer: fine) {
  .gallery-ribbon-track:hover { animation-play-state: paused; }
}
.gallery-item {
  flex-shrink: 0;
  height: 320px;
  aspect-ratio: 16 / 10;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 200ms ease, transform 600ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover img { opacity: 0.85; transform: scale(1.03); }
}
.gallery-item__tint {
  position: absolute;
  inset: 0;
  background-color: var(--paper-dark);
  opacity: 0.1;
  pointer-events: none;
}

@keyframes ribbonScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============================================================
   Visit
   ============================================================ */
.visit {
  padding-top: 12rem;
  padding-bottom: 6rem;
}
.visit__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.visit__content { pointer-events: auto; }
.info-block { margin-bottom: 2rem; }
.info-block:first-child { margin-bottom: 1.5rem; }
.info-label {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.5rem;
}
.info-value {
  font-size: 1.25rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  color: var(--ink);
}
.info-value--muted {
  font-size: 1rem;
  color: var(--ink-light);
  margin-top: 0.25rem;
}
.visit__map {
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(28, 25, 23, 0.1);
  aspect-ratio: 4 / 3;
  pointer-events: auto;
  will-change: transform;
}
.visit__map iframe {
  border: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: block;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative;
  z-index: 10;
  background-color: var(--wood);
  color: var(--paper);
  padding: 6rem 0 3rem;
  pointer-events: none;
}
.footer__top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4rem;
}
.footer__brand-name {
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.footer__brand-sub {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(244, 239, 230, 0.6);
}
.footer__col-title {
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 239, 230, 0.6);
  margin-bottom: 1rem;
}
.footer__col--right { text-align: right; }
.footer__link {
  display: block;
  font-size: 1rem;
  font-family: "Archivo", sans-serif;
  font-weight: 300;
  color: rgba(244, 239, 230, 0.8);
  text-decoration: none;
  margin-bottom: 0.75rem;
  pointer-events: auto;
  transition: color 200ms var(--ease-out);
  width: fit-content;
}
.footer__col--right .footer__link {
  margin-left: auto;
  color: rgba(244, 239, 230, 0.6);
}
@media (hover: hover) and (pointer: fine) {
  .footer__link:hover { color: var(--paper); }
}
.footer__divider {
  width: 100%;
  height: 1px;
  background-color: rgba(244, 239, 230, 0.15);
  margin: 4rem 0 2rem;
}
.footer__bottom {
  text-align: center;
  font-size: 0.75rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 239, 230, 0.4);
}

/* ============================================================
   Sub-pages (about / contact / legal)
   Static content pages that reuse the tokens above but need
   none of the WebGL / scroll machinery from the homepage.
   ============================================================ */
.subnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 4rem;
  background-color: rgba(244, 239, 230, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 25, 23, 0.08);
}
.subnav__brand {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--ink);
}
.subnav__mark {
  font-size: 0.875rem;
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
}
.subnav__sub {
  font-size: 0.875rem;
  font-family: "Archivo", sans-serif;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ink-light);
}
.subnav__back {
  font-size: 0.8125rem;
  font-family: "Archivo", sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-light);
  text-decoration: none;
  transition: color 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .subnav__back:hover { color: var(--copper); }
}

.subpage {
  max-width: 48rem;
  margin: 0 auto;
  padding: 7rem 4rem 6rem;
}
/* Match the footer content width (.container = 72rem) */
.subpage--wide { max-width: 72rem; }
.subpage__header { margin-bottom: 3.5rem; }
.subpage__updated {
  font-size: 0.8125rem;
  font-family: "Archivo", sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink-light);
  margin-top: 1rem;
}
.subpage__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.subpage__body h3 {
  font-family: "Noto Serif TC", serif;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  margin: 1.75rem 0 0;
}
.subpage__body a { color: var(--copper); }

/* Contact details — info blocks stacked, no form (info only) */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.contact-map {
  margin-top: 3.5rem;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(28, 25, 23, 0.1);
  aspect-ratio: 16 / 9;
}
.contact-map iframe {
  border: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Legal links row in the footer bottom bar */
.footer__legal {
  margin-top: 1rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.footer__legal a {
  color: rgba(244, 239, 230, 0.5);
  text-decoration: none;
  pointer-events: auto;
  transition: color 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .footer__legal a:hover { color: var(--paper); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .subnav { padding: 1rem 1.5rem; }
  .subpage { padding: 5rem 1.5rem 4rem; }
  .container { padding: 0 2rem; }
  .preface__grid,
  .building__grid,
  .events__grid,
  .visit__grid { grid-template-columns: 1fr; }
  .preface__content { padding-top: 0; }
  .experience__cards { grid-template-columns: 1fr; }
  .footer__top { grid-template-columns: 1fr; gap: 2rem; }
  .footer__col--right { text-align: left; }
  .footer__col--right .footer__link { margin-left: 0; }
  .stats { flex-wrap: wrap; gap: 1.5rem; }
  .dot-nav { right: 1rem; }
  .hero__info { max-width: 55vw; }
}

/* ============================================================
   Reduced motion — keep opacity/comprehension cues, drop
   position + transform motion. Not zero animation; gentler.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hero__scroll-line { animation: none; }
  .gallery-ribbon-track { animation: none; }
  .exp-card,
  .btn,
  .dot-nav__dot,
  .gallery-item img {
    transition: background-color 200ms ease,
                box-shadow 200ms ease,
                opacity 200ms ease,
                color 200ms ease;
  }
  .exp-card:hover,
  .btn:active,
  .gallery-item:hover img { transform: none; }
}
