@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300&family=Inter:wght@300;400;500&family=Noto+Sans+TC:wght@300;400;500&display=swap');

:root {
  --bg:         #F8F7F4;
  --surface:    #FFFFFF;
  --text:       #1A1A1A;
  --text-muted: #747070;
  --accent:     #A83226;
  --border:     #E0DBD5;
  --font-sans:  'Inter', 'Taipei Sans TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
  --font-display: 'Cormorant Garamond', serif;
  --font-serif: var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(248, 247, 244, 0.90);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: 52px;
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }

/* ── NAV DROPDOWN ── */
.nav-links li.has-dropdown { position: relative; }

.nav-links .dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--surface);
  border: 1px solid var(--border);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 140px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 110;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.nav-links li.has-dropdown:hover > .dropdown,
.nav-links li.has-dropdown:focus-within > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-links .dropdown li { display: block; }

.nav-links .dropdown a {
  display: block;
  padding: 0.45rem 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: none;
  white-space: nowrap;
  text-align: center;
}

.nav-links .dropdown a:hover {
  background: var(--bg);
  color: var(--accent);
}

/* invisible hover bridge so dropdown doesn't close between gap */
.nav-links li.has-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

/* ── MAIN ── */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

/* ── SECTIONS ── */
section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.15;
  margin-bottom: 2rem;
}

/* ── PAGE HERO ── */
.page-hero {
  padding-top: 108px;
  padding-bottom: 52px;
  border-top: none !important;
}

.page-hero h1 {
  font-family: var(--font-sans);
  font-size: 3rem;
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.page-hero .hero-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-hero .hero-sub::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── RESEARCH BLOCK ── */
.research-block + .research-block {
  margin-top: 4rem;
  padding-top: 4rem;
  border-top: 1px solid var(--border);
}

.research-title {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 300;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.research-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.9rem;
}

.research-desc {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text);
  max-width: 620px;
  margin-bottom: 1.6rem;
}

.research-desc p + p { margin-top: 0.75em; }

/* ── PDF VIEWER ── */
.pdf-wrap iframe {
  width: 100%;
  height: 560px;
  border: 1px solid var(--border);
  display: block;
  background: #fff;
}

.pdf-actions {
  display: flex;
  gap: 1.4rem;
  margin-top: 0.5rem;
}

.pdf-actions a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.pdf-actions a:hover { color: var(--accent); }

/* ── DOC CARD (replaces heavy inline PDF iframes) ── */
.doc-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 1.3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.doc-card:hover {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
  color: inherit;
}

.doc-ico {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.5em 0.55em;
  flex-shrink: 0;
}

.doc-info { flex: 1; min-width: 0; }

.doc-t {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
}

.doc-m {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.doc-card:hover .doc-t { color: var(--accent); }

.doc-arrow { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
.doc-card:hover .doc-arrow { color: var(--accent); }

.doc-actions { margin-top: 0.55rem; }
.doc-actions a {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.doc-actions a:hover { color: var(--accent); }

/* ── FILE PLACEHOLDER ── */
.file-placeholder {
  border: 1px dashed var(--border);
  padding: 2.5rem 1.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── SUPPLEMENTARY DOCS ── */
.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.doc-list li a {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}

.doc-list li a:hover { color: var(--accent); }

/* ── AWARDS GRID ── */
.awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.4rem;
}

.award-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.award-item .award-thumb {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.award-item:hover .award-thumb {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
}

.award-item .award-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.award-item .award-thumb.is-pdf {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  background: var(--bg);
}

.award-item .award-thumb.is-pdf::before {
  content: 'PDF';
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.15em 0.7em;
}

.award-meta {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  line-height: 1.5;
}

.award-year {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.1em;
}

.award-name {
  color: var(--text);
}

.award-item:hover .award-name { color: var(--accent); }

/* ── POSTER ── */
.poster-wrap {
  margin: 1.4rem 0;
}

.poster-wrap img {
  max-width: 100%;
  max-height: 600px;
  border: 1px solid var(--border);
  display: block;
}

.caption {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ── YOUTUBE GRID ── */
.yt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.yt-item h3 {
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.yt-item .yt-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.yt-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.yt-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── IG NOTE ── */
.ig-note {
  border: 1px solid var(--border);
  padding: 1.2rem 1.6rem;
  font-size: 0.87rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--text-muted);
}

.ig-note a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.ig-note a:hover { text-decoration: underline; }

/* ── PAINTING GRID ── */
.painting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.painting-item img {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
  height: auto;
}

/* ── GALLERY (masonry columns — preserve each drawing's aspect ratio) ── */
.gallery-grid {
  column-count: 4;
  column-gap: 0.5rem;
}

.gallery-grid a {
  display: block;
  break-inside: avoid;
  margin-bottom: 0.5rem;
}

.gallery-grid img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.gallery-grid img:hover { opacity: 0.8; }

.gallery-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.9rem;
  font-style: italic;
}

/* ── ORIGAMI ── */
.origami-wrap {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.origami-wrap img {
  width: 100%;
  border: 1px solid var(--border);
  display: block;
}

.origami-desc {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text);
}

.origami-desc p + p { margin-top: 0.8em; }

.origami-desc a {
  color: var(--accent);
  text-decoration: none;
}

.origami-desc a:hover { text-decoration: underline; }

/* ── BREADCRUMB ── */
.breadcrumb {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 0.4em; }

/* ── PROJECT GRID (Interactive landing) ── */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 2rem 1.8rem 1.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
  color: inherit;
}

.project-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.7rem;
}

.project-card h3 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: 0.8rem;
}

.project-card .project-desc {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.project-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.2em 0.6em;
  line-height: 1.6;
}

.project-arrow {
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: auto;
}

.project-card:hover .project-arrow { color: var(--accent); }

/* ── LAUNCH BUTTON ── */
.launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.8rem 1.7rem;
  border: 1px solid var(--accent);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.launch-btn:hover {
  background: transparent;
  color: var(--accent);
}

.launch-row,
.store-links {
  display: flex;
  align-items: center;
  justify-content: center;
}

.launch-row {
  margin-top: 1rem;
}

.store-links {
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.itch-badge,
.google-play-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 60px;
  overflow: hidden;
  line-height: 0;
}

.itch-badge img,
.google-play-badge img {
  display: block;
  width: 200px;
  height: auto;
  transition: opacity 0.2s ease;
}

.itch-badge:hover img {
  opacity: 0.78;
}

.itch-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ── STAT GRID ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin: 1.4rem 0 2rem;
}

.stat-item {
  background: var(--surface);
  padding: 1.4rem 1.2rem;
  text-align: center;
}

.stat-num {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── DETAIL TABLE ── */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin-top: 1rem;
}

.detail-table td {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.detail-table td:first-child {
  color: var(--text-muted);
  width: 38%;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  padding-right: 1.2rem;
}

.detail-table tr:last-child td { border-bottom: none; }

/* ── SCREENSHOT ── */
.shot {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
  margin-bottom: 1.4rem;
}

.shot-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
  background: var(--surface);
  text-align: center;
  padding: 1rem;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
}

footer p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ── RESPONSIVE ── */
@media (max-width: 740px) {
  nav { padding: 0 1.4rem; }
  main { padding: 0 1.4rem; }
  .nav-links { gap: 1.2rem; }
  /* Dropdown becomes inline on mobile */
  .nav-links .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
    border: none;
    padding: 0;
    box-shadow: none;
    background: transparent;
    min-width: 0;
  }
  .nav-links li.has-dropdown::after { display: none; }
  .nav-links li.has-dropdown:hover > .dropdown { display: none; }
  .yt-grid { grid-template-columns: 1fr; }
  .painting-grid { grid-template-columns: 1fr; }
  .gallery-grid { column-count: 3; }
  .origami-wrap { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 2.4rem; }
}

@media (max-width: 480px) {
  .gallery-grid { column-count: 2; }
  footer { flex-direction: column; gap: 0.4rem; text-align: center; }
  .nav-links { gap: 0.9rem; }
}

/* ── DEFAULT INLINE LINK STYLE ──
   Content links inherit text color with a thin underline by default,
   and turn blue on hover. Component-scoped rules above (nav, awards,
   social-links, pdf-actions, etc.) override this where text-decoration
   is explicitly set, so layout links remain unaffected. */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: currentColor;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: #2563eb;
  text-decoration-color: #2563eb;
}
