/* Theme vars are injected by app.js from config.theme / config.typography.
   Defaults are here as a fallback if the fetch fails. */
:root {
  --bg: #f0ece4;
  --bg-soft: #e8e2d6;
  --card: #ffffff;
  --card-border: #d9d2c4;
  --card-hover-bg: #fdfbf6;
  --card-hover-border: #b8ad97;
  --ink: #2a2724;
  --ink-soft: #6b665d;
  --accent: #3a3732;
  --arrow: #b8ad97;
  --footer-ink: #a89f8c;

  --name-size: 22px;
  --bio-size: 16px;
  --link-title-size: 16px;
  --link-desc-size: 12px;
  --section-title-size: 16px;
  --section-title-weight: 700;
  --section-title-color: var(--ink);

  --shadow: 0 1px 2px rgba(60, 50, 30, .06), 0 6px 20px rgba(60, 50, 30, .06);
  --shadow-hover: 0 2px 4px rgba(60, 50, 30, .08), 0 12px 28px rgba(60, 50, 30, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.page {
  max-width: 460px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 20px;
  object-fit: cover;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

h1.name {
  text-align: center;
  font-size: var(--name-size);
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: .02em;
}

.bio {
  text-align: center;
  font-size: var(--bio-size);
  color: var(--ink-soft);
  margin: 0 auto 36px;
  max-width: 340px;
  white-space: pre-line;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--card-hover-border);
  background: var(--card-hover-bg);
}

.link:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(60, 50, 30, .08);
  background: var(--bg-soft);
}

.link .icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.link .icon svg { width: 20px; height: 20px; }
.link .icon img { width: 20px; height: 20px; object-fit: contain; }

.link .text { display: flex; flex-direction: column; min-width: 0; }
.link .text .title {
  font-size: var(--link-title-size);
  font-weight: 500;
  line-height: 1.3;
}
.link .text .desc {
  font-size: var(--link-desc-size);
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link .arrow {
  margin-left: auto;
  color: var(--arrow);
  flex: 0 0 auto;
  transition: transform .15s ease, color .15s ease;
}
.link:hover .arrow { transform: translateX(2px); color: var(--accent); }

/* Section (galleries) */
.section { margin-top: 36px; }
.section h2 {
  font-size: var(--section-title-size);
  font-weight: var(--section-title-weight);
  color: var(--section-title-color);
  letter-spacing: .1em;
  text-align: center;
  margin: 0 0 14px;
}

.grid { display: grid; gap: 10px; }
.grid.g-2 { grid-template-columns: repeat(2, 1fr); }
.grid.g-3 { grid-template-columns: repeat(3, 1fr); }
.grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform .15s ease, box-shadow .15s ease;
}
.grid img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.grid-link {
  display: block;
  line-height: 0;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
.grid-link img { cursor: pointer; }

/* Share + QR icon row */
.actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 32px;
}
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--card-hover-border);
  background: var(--card-hover-bg);
}
.icon-btn:active { transform: translateY(0); background: var(--bg-soft); }
.icon-btn svg { width: 22px; height: 22px; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(30, 25, 20, .72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
  animation: fadeIn .15s ease;
}
.modal.open { display: flex; }
.modal-inner {
  background: var(--bg);
  border-radius: 16px;
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: pop .18s ease;
}
.modal-inner img { max-width: 100%; max-height: 72vh; border-radius: 10px; display: block; }
.modal-inner .label {
  font-size: 13px;
  color: var(--ink-soft);
  word-break: break-all;
  text-align: center;
  max-width: 320px;
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  border: none;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Toast */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer {
  text-align: center;
  margin-top: 40px;
  font-size: 11px;
  color: var(--footer-ink);
  letter-spacing: .05em;
}

/* Error banner */
.err-banner {
  background: #c04a3a;
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 400px) {
  .page { padding: 36px 16px 56px; }
}
