/* ============================================================
   Chih Han Yang — personal site
   Anthropic / Claude aesthetic: warm ivory, clay accent,
   delicate serif headings (Fraunces) + clean sans body (Inter).
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #f7f4ef;          /* warm ivory */
  --bg-card: #fcfbf8;
  --bg-elevated: #ffffff;

  /* Text */
  --text: #191919;        /* near-black */
  --text-muted: #6b665c;
  --text-subtle: #908a7d;

  /* Accent — warm brick red */
  --accent: #c0432f;
  --accent-hover: #9e3320;

  /* Lines & shadows */
  --border: #e7e1d7;
  --shadow-sm: 0 1px 2px rgba(50, 40, 30, 0.04);
  --shadow-md: 0 4px 18px rgba(50, 40, 30, 0.06);

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Layout */
  --measure: 920px;
  --nav-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease;
}
a:hover { color: var(--accent-hover); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
  margin: 0;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(247, 244, 239, 0.78);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__inner {
  max-width: var(--measure);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav__brand:hover { color: var(--text); }

.nav__links {
  display: flex;
  gap: 28px;
}
.nav__links a {
  position: relative;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 4px 0;
}
.nav__links a:hover { color: var(--text); }
.nav__links a.is-active { color: var(--accent); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Layout primitives ---------- */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.section__title {
  font-size: 1.6rem;
  margin-bottom: 24px;
}

.section__lead {
  color: var(--text-muted);
  margin: -8px 0 24px;
  font-size: 1rem;
}

.prose p {
  margin: 0 0 1.1em;
  color: #2a2a2a;
}
.prose p:last-child { margin-bottom: 0; }

.prose h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  margin: 1.9em 0 0.7em;
  color: var(--text);
}
.prose h2:first-child { margin-top: 0; }

.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--accent);
}
.prose blockquote p {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-style: italic;
  line-height: 1.65;
  color: #33302b;
  margin: 0 0 10px;
}
.prose blockquote cite {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 48px;
  text-align: left;
  padding: 80px 0 56px;
}
.hero__text { flex: 1 1 auto; min-width: 0; }

.hero__photo {
  position: relative;
  flex: 0 0 auto;
  width: 280px;
  height: 280px;
}
.hero__photo img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  object-position: center 25%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.hero__monogram {
  display: none; /* shown only if the photo fails to load */
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: linear-gradient(150deg, #f3d7d0, #e8aea2);
  color: var(--accent-hover);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 4.2rem;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.hero__name {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 500;
}
.hero__name-cjk {
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap; /* keep 楊智翰 together; wrap before it instead */
}

.hero__role {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.hero__tagline {
  margin: 22px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--accent);
}

.hero__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  margin: 30px 0 0;
  padding: 0;
}
.hero__links a {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.hero__links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Verse ---------- */
.verse {
  padding: 48px 0;
}
.verse__quote {
  margin: 0;
  padding: 4px 0 4px 28px;
  border-left: 3px solid var(--accent);
}
.verse__quote p {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.6;
  color: #33302b;
  margin: 0 0 14px;
}
.verse__quote cite {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ---------- Cards (research) ---------- */
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d9d0c2;
}
.card__title a {
  color: var(--text);
  border-bottom: 1px solid transparent;
}
.card__title a:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}
.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(192, 67, 47, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.card__title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
}
.card__authors {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.card__authors strong { color: var(--text); font-weight: 600; }
.card__abstract {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.card--media {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.card--media .card__body { flex: 1 1 auto; min-width: 0; }
.card__figure {
  margin: 0;
  flex: 0 0 auto;
  width: 200px;
  height: 200px;
}
.card__figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.card__links {
  margin: 16px 0 0;
  display: flex;
  gap: 18px;
}
.card__links a {
  font-weight: 500;
  font-size: 0.92rem;
  border-bottom: 1px solid transparent;
}
.card__links a:hover { border-bottom-color: currentColor; }

/* ---------- Lists ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list__item {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list__item:first-child { padding-top: 0; }
.list__item:last-child { border-bottom: none; padding-bottom: 0; }
.list__main {
  color: var(--text);
  font-size: 1.02rem;
}
.list__main a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.list__main a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.list__meta {
  flex: 0 0 130px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Sub-page header ---------- */
.page-header {
  padding: 72px 0 36px;
}
.page-title {
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  font-weight: 500;
}
.page-lead {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
}
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.back-link:hover { color: var(--accent); }

/* ---------- Summary cards (About → other pages) ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.summary-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.summary-card:hover {
  color: var(--text);
  border-color: #d9d0c2;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.summary-card__title {
  font-size: 1.2rem;
  font-weight: 600;
}
.summary-card__desc {
  margin: 8px 0 14px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.summary-card__more {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ---------- Faith ---------- */
.faith {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 40px;
}
.faith__lang {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px 56px;
  text-align: center;
}
.footer__links {
  margin: 0 0 10px;
  font-size: 0.92rem;
}
.footer__links a { color: var(--text-muted); }
.footer__links a:hover { color: var(--accent); }
.footer__dot { color: var(--text-subtle); margin: 0 8px; }
.footer__copy {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

/* ---------- Scroll reveal ----------
   Hidden state is gated behind .js so that without JavaScript every
   section stays fully visible (no blank page). */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }

  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 8px 24px 16px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .nav__links.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .nav__links a { padding: 12px 0; }
  .nav__links a.is-active::after { display: none; }

  .section { padding: 44px 0; }
  .page-header { padding: 48px 0 28px; }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 26px;
    padding: 48px 0 36px;
  }
  .hero__photo { width: 200px; height: 200px; }
  .hero__monogram { font-size: 3rem; }
  .hero__text { width: 100%; }
  .hero__name { font-size: 1.7rem; }
  .hero__links { justify-content: center; }

  .cards-grid { grid-template-columns: 1fr; }
  .card--media { flex-direction: column; }
  .card--media .card__figure { width: 100%; max-width: 220px; height: 220px; }
  .faith { grid-template-columns: 1fr; gap: 24px; }

  .list__item { flex-direction: column; gap: 4px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.001ms !important; }
}
