/* =========================================================================
   DOF Lab — Editorial Design System  (雜誌編輯風 / 暖色圖文並重)
   doflab.cc  ·  2026 redesign
   單一設計系統檔，供首頁與所有子頁共用。
   ========================================================================= */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,900;1,9..144,400&family=Inter:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;700&family=Noto+Serif+TC:wght@600;700;900&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* 暖色紙感配色 */
  --paper:        #faf6ef;   /* 主背景：暖米白 */
  --paper-2:      #f1e9db;   /* 次背景區塊 */
  --card:         #fffdf9;   /* 卡片底 */
  --ink:          #1d1813;   /* 近黑暖墨 */
  --ink-soft:     #4a4239;   /* 次要文字 */
  --muted:        #837868;   /* 輔助文字 */
  --line:         #e4d9c7;   /* 細分隔線 */
  --line-strong:  #cdbfa6;

  --rust:         #b4451f;   /* 主強調：燒赭 */
  --rust-deep:    #8f3415;
  --gold:         #b3893a;   /* 次強調：暖金 */
  --forest:       #2f5346;   /* 點綴：深林綠 */

  --shadow:       0 1px 2px rgba(45,30,15,.04), 0 8px 30px rgba(45,30,15,.06);
  --shadow-lift:  0 6px 16px rgba(45,30,15,.10), 0 20px 50px rgba(45,30,15,.12);

  --maxw: 1180px;
  --gut: clamp(1.2rem, 4vw, 3rem);

  --serif: 'Fraunces', 'Noto Serif TC', Georgia, serif;
  --sans:  'Inter', 'Noto Sans TC', system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  font-size: 17px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

::selection { background: var(--rust); color: #fff; }

/* paper grain — 極淡雜誌紙質感 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .35;
  background-image: radial-gradient(rgba(120,90,50,.05) 1px, transparent 1px);
  background-size: 4px 4px;
}

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }
.section { padding: clamp(4rem, 9vw, 8rem) 0; }
.section--tight { padding: clamp(3rem, 6vw, 5rem) 0; }
.bg-2 { background: var(--paper-2); }
.bg-ink { background: var(--ink); color: #f3ece0; }
.bg-ink .kicker { color: var(--gold); }

/* ---------- Editorial typography ---------- */
.kicker {
  font-family: var(--sans);
  font-size: .74rem; font-weight: 600;
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--rust);
  display: inline-flex; align-items: center; gap: .6rem;
}
.kicker::before { content: ''; width: 28px; height: 1px; background: currentColor; }

.display {
  font-family: var(--serif);
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.02em;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.section-title { font-size: clamp(2rem, 4.5vw, 3.4rem); font-weight: 900; }
.lede {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 56ch;
}
.sec-no {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(2.4rem,5vw,3.6rem); color: var(--line-strong);
}

/* section header row, magazine-style */
.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding-bottom: 1.4rem; margin-bottom: 3rem;
  border-bottom: 2px solid var(--ink);
}
.sec-head .sec-head__l { max-width: 60ch; }
.sec-head .kicker { margin-bottom: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--sans); font-weight: 600; font-size: .95rem;
  padding: .85rem 1.6rem; border-radius: 100px;
  border: 1.5px solid var(--ink); cursor: pointer;
  transition: all .25s ease; background: transparent; color: var(--ink);
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--rust); border-color: var(--rust); }
.btn--rust { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn--rust:hover { background: var(--rust-deep); border-color: var(--rust-deep); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,246,239,.82);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-family: var(--serif); font-weight: 900; font-size: 1.35rem; letter-spacing: -.02em; }
.brand .dot { color: var(--rust); }
.brand small { font-family: var(--sans); font-weight: 500; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: block; margin-top: -2px; }
.nav__links { display: flex; align-items: center; gap: 1.6rem; }
.nav__links a { font-size: .92rem; font-weight: 500; color: var(--ink-soft); position: relative; padding: 4px 0; transition: color .2s; }
.nav__links a::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px; background: var(--rust); transition: width .25s ease; }
.nav__links a:hover, .nav__links a.active { color: var(--ink); }
.nav__links a:hover::after, .nav__links a.active::after { width: 100%; }
.nav__cta { padding: .55rem 1.1rem; font-size: .85rem; }
.nav__toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--ink); cursor: pointer; }

@media (max-width: 880px) {
  .nav__links {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 1rem var(--gut) 1.6rem; transform: translateY(-120%);
    transition: transform .3s ease; box-shadow: var(--shadow);
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { width: 100%; padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .nav__toggle { display: block; }
}

/* =========================================================================
   HERO — 沉浸式雜誌封面
   ========================================================================= */
.hero { position: relative; padding: clamp(3rem,7vw,6rem) 0 clamp(3rem,6vw,5rem); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem,5vw,5rem); align-items: center; }
.hero__issue {
  display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap;
  font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line);
  padding: .7rem 0; margin-bottom: 2.4rem; font-weight: 600;
}
.hero__issue .pill { color: var(--rust); }
.hero h1.display { margin-bottom: 1.5rem; }
.hero h1 .ital { font-style: italic; font-weight: 400; color: var(--rust); }
.hero__name {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.3rem,2.6vw,1.9rem); color: var(--ink-soft); margin-bottom: 1.6rem;
}
.hero__lede { margin-bottom: 2.2rem; }
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* hero feature card (圖文並重的「圖」) */
.hero__feature {
  position: relative; background: var(--ink); color: #f3ece0; border-radius: 18px;
  padding: 2.2rem; box-shadow: var(--shadow-lift); overflow: hidden;
}
.hero__feature::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(180,69,31,.55), transparent 70%); filter: blur(6px);
}
.hero__feature .kicker { color: var(--gold); position: relative; }
.hero__feature h3 { font-size: 1.7rem; color: #fff; margin: 1rem 0 .6rem; position: relative; }
.hero__feature p { color: #cdbfa6; font-size: .98rem; position: relative; }
.hero__feature .mini-stats { display: flex; gap: 1.4rem; margin-top: 1.6rem; position: relative; }
.hero__feature .mini-stats div { flex: 1; }
.hero__feature .mini-stats b { font-family: var(--serif); font-size: 1.8rem; font-weight: 900; color: #fff; display: block; }
.hero__feature .mini-stats span { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }

@media (max-width: 920px) { .hero__grid { grid-template-columns: 1fr; } }

/* ---------- Marquee 跑馬燈 (研究關鍵字) ---------- */
.marquee { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; overflow: hidden; background: var(--paper-2); }
.marquee__track { display: flex; gap: 3rem; white-space: nowrap; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee span { font-family: var(--serif); font-style: italic; font-size: 1.5rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 3rem; }
.marquee span::after { content: '✶'; color: var(--rust); font-style: normal; font-size: 1rem; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================================
   STATS — 專案統計儀表
   ========================================================================= */
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; background: var(--card); }
.stat {
  padding: 2rem 1.6rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  position: relative;
}
.stat:nth-child(4n) { border-right: 0; }
.stat__no { font-family: var(--serif); font-weight: 900; font-size: clamp(2.6rem,5vw,3.8rem); line-height: 1; color: var(--ink); }
.stat__no .u { font-size: .9rem; color: var(--rust); margin-left: .2rem; }
.stat__label { font-size: .82rem; color: var(--muted); margin-top: .5rem; letter-spacing: .04em; }
.stat__bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 1rem; overflow: hidden; }
.stat__bar i { display: block; height: 100%; background: var(--rust); width: 0; transition: width 1.4s cubic-bezier(.2,.8,.2,1); }
@media (max-width: 760px) {
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2n) { border-right: 0; }
}

/* category distribution bars */
.cat-list { display: grid; gap: 1.1rem; margin-top: 2.5rem; }
.cat-row { display: grid; grid-template-columns: 180px 1fr 48px; align-items: center; gap: 1.2rem; }
.cat-row__name { font-weight: 600; font-size: .95rem; }
.cat-row__name span { display: block; font-size: .72rem; color: var(--muted); font-weight: 400; letter-spacing: .1em; text-transform: uppercase; }
.cat-track { height: 12px; background: var(--paper-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.cat-track i { display: block; height: 100%; width: 0; border-radius: 8px; transition: width 1.3s cubic-bezier(.2,.8,.2,1); }
.cat-row__val { font-family: var(--serif); font-weight: 900; text-align: right; }
@media (max-width: 620px) { .cat-row { grid-template-columns: 110px 1fr 36px; gap: .7rem; } .cat-row__name { font-size: .82rem; } }

/* =========================================================================
   FEATURE GRID — 精選專案/成果卡片 (圖文並重)
   ========================================================================= */
.feat-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.6rem; }
.feat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 2rem; display: flex; flex-direction: column; transition: transform .3s ease, box-shadow .3s ease, border-color .3s;
  position: relative; overflow: hidden;
}
.feat:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.feat--lg { grid-column: span 7; }
.feat--sm { grid-column: span 5; }
.feat--third { grid-column: span 4; }
.feat--half { grid-column: span 6; }
.feat__cover {
  aspect-ratio: 16/9; border-radius: 12px; margin-bottom: 1.4rem; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ink), #3a2c20);
}
.feat__cover .ico { font-size: 3rem; color: var(--gold); opacity: .9; }
.feat__cover--rust { background: linear-gradient(135deg, var(--rust), var(--rust-deep)); }
.feat__cover--forest { background: linear-gradient(135deg, var(--forest), #1c352c); }
.feat__cover--gold { background: linear-gradient(135deg, var(--gold), #8a6a26); }
.feat__cover .badge { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.4); color: #fff; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 100px; backdrop-filter: blur(4px); }
.feat__tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.tag { font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rust); background: rgba(180,69,31,.08); padding: .25rem .6rem; border-radius: 6px; }
.tag--ink { color: var(--ink-soft); background: var(--paper-2); }
.feat h3 { font-size: 1.45rem; margin-bottom: .6rem; }
.feat__desc { color: var(--ink-soft); font-size: .96rem; flex: 1; }
.feat__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.feat__prog { font-size: .8rem; color: var(--muted); }
.feat__prog b { font-family: var(--serif); font-weight: 900; color: var(--ink); font-size: 1.1rem; }
.read-more { font-weight: 600; font-size: .9rem; color: var(--rust); display: inline-flex; align-items: center; gap: .4rem; transition: gap .2s; }
.read-more:hover { gap: .8rem; }
@media (max-width: 860px) {
  .feat--lg, .feat--sm, .feat--third, .feat--half { grid-column: span 12; }
}

/* =========================================================================
   PUBLICATIONS preview
   ========================================================================= */
.pub-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.2rem; margin-bottom: 3rem; }
.pub-stat { text-align: center; padding: 1.6rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.pub-stat b { font-family: var(--serif); font-weight: 900; font-size: 2.4rem; display: block; color: var(--rust); }
.pub-stat span { font-size: .82rem; color: var(--muted); }
@media (max-width:620px){ .pub-strip{ grid-template-columns: repeat(2,1fr);} }

.pub-line { display: grid; grid-template-columns: 70px 1fr; gap: 1.4rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.pub-line:hover { background: linear-gradient(90deg, rgba(180,69,31,.04), transparent); }
.pub-line__yr { font-family: var(--serif); font-weight: 900; font-size: 1.5rem; color: var(--line-strong); }
.pub-line__t { font-weight: 600; line-height: 1.4; margin-bottom: .3rem; }
.pub-line__m { font-size: .86rem; color: var(--muted); }
.pub-line__m .jn { font-style: italic; color: var(--forest); font-weight: 600; }
.scie { font-size: .62rem; font-weight: 700; letter-spacing: .08em; color: #fff; background: var(--forest); padding: .12rem .45rem; border-radius: 4px; vertical-align: middle; margin-left: .4rem; }

/* =========================================================================
   BLOG list
   ========================================================================= */
.post-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 1.6rem; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--line); transition: padding-left .25s ease; }
.post-row:hover { padding-left: .6rem; }
.post-row__date { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.post-row__t { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; line-height: 1.3; }
.post-row__arrow { color: var(--rust); opacity: 0; transform: translateX(-8px); transition: all .25s; }
.post-row:hover .post-row__arrow { opacity: 1; transform: translateX(0); }
@media (max-width:680px){ .post-row{ grid-template-columns: 1fr; gap:.4rem;} .post-row__arrow{display:none;} }

/* =========================================================================
   MEMBERS
   ========================================================================= */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1.4rem; }
.member { text-align: center; padding: 2rem 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: transform .3s, box-shadow .3s; }
.member:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.member__ava { width: 90px; height: 90px; border-radius: 50%; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 900; font-size: 2rem; color: #fff; background: linear-gradient(135deg,var(--rust),var(--gold)); }
.member h4 { font-size: 1.15rem; }
.member__role { font-size: .82rem; color: var(--rust); font-weight: 600; margin: .2rem 0 .6rem; }
.member__area { font-size: .82rem; color: var(--muted); }

/* =========================================================================
   FOOTER
   ========================================================================= */
.footer { background: var(--ink); color: #d9cfc0; padding: clamp(3.5rem,7vw,6rem) 0 2.5rem; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 3rem; padding-bottom: 3rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer__brand .brand { color: #fff; font-size: 1.8rem; }
.footer__brand p { color: #a99e8e; margin-top: 1rem; max-width: 38ch; font-size: .95rem; }
.footer h5 { color: var(--gold); font-family: var(--sans); font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 1.2rem; font-weight: 600; }
.footer a { color: #d9cfc0; font-size: .95rem; display: block; padding: .35rem 0; transition: color .2s, padding-left .2s; }
.footer a:hover { color: #fff; padding-left: .4rem; }
.footer__bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-top: 2rem; font-size: .84rem; color: #877c6c; }
.footer__social { display: flex; gap: 1rem; }
.footer__social a { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; }
.footer__social a:hover { background: var(--rust); border-color: var(--rust); padding-left: 0; }
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr; gap: 2rem; } }

/* =========================================================================
   PAGE HEADER (子頁)
   ========================================================================= */
.page-head { padding: clamp(3rem,6vw,5.5rem) 0 clamp(2rem,4vw,3rem); border-bottom: 2px solid var(--ink); }
.page-head h1 { font-size: clamp(2.4rem,6vw,4.2rem); font-weight: 900; }
.page-head .lede { margin-top: 1.2rem; }

/* filter tabs */
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: 2.5rem 0; }
.tab { font-family: var(--sans); font-size: .88rem; font-weight: 600; padding: .55rem 1.2rem; border-radius: 100px; border: 1.5px solid var(--line-strong); background: transparent; color: var(--ink-soft); cursor: pointer; transition: all .2s; }
.tab:hover { border-color: var(--ink); }
.tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* =========================================================================
   Reveal-on-scroll
   ========================================================================= */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .marquee__track { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* drop cap for editorial intro */
.dropcap::first-letter {
  font-family: var(--serif); font-weight: 900; float: left; font-size: 3.6rem;
  line-height: .8; padding: .1rem .6rem .1rem 0; color: var(--rust);
}
