/* ==========================================================
   Technosophy Lab 社技哲學實驗室 — main stylesheet
   1. tokens & base   2. header   3. small parts   4. home
   5. news            6. pages    7. footer        8. responsive
   ========================================================== */

/* ---------- 1. tokens & base ---------- */
:root {
  --black: #0e0e0e;
  --orange: #fb5e0c;
  --paper: #f8f8f7;
  --paper-2: #ecece8;
  --ink-2: #55554f;
  --ink-3: #8a8a83;
  --rule: rgba(14, 14, 14, .9);
  --hair: rgba(14, 14, 14, .18);
  --rule-inv: rgba(248, 248, 247, .2);
  --sans: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --gutter: clamp(20px, 3.2vw, 48px);
  --frame: clamp(8px, 1.4vw, 20px);
  --mid: .4em; /* 字面中線（距基線），橘色方格對齊用 */
  --halftone: radial-gradient(rgba(14, 14, 14, .16) 1px, transparent 1.3px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--black);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  /* paper grain */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .44  0 0 0 0 .41  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.2'/></svg>");
}
[lang="en"] { font-family: "Segoe UI", "Helvetica Neue", Arial, var(--sans); }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--orange); color: var(--black); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--black); color: var(--paper); padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }

.frame { margin: var(--frame); border: 1px solid var(--rule); }
.wrap { padding-inline: var(--gutter); }

/* ---------- 2. header ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; border-bottom: 1px solid var(--rule); }
.brand img { height: 22px; width: auto; }
.nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); font-size: 14px; font-weight: 500; }
.nav a { text-decoration: none; position: relative; padding-block: 6px; }
.nav a:not(.lang)::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px; background: var(--orange); transition: right .18s ease; }
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }
.nav .ext::after { content: none; }
.nav .ext span { font-size: 12px; margin-left: 2px; }
.nav .lang { border: 1px solid var(--black); padding: 2px 8px; font-size: 12px; letter-spacing: .08em; }
.nav .lang:hover { background: var(--black); color: var(--paper); }
.menu { display: none; }

/* ---------- 3. small parts ---------- */
/* 橘色方格：以文字基線定位，方格中心對齊字面中線（約 0.37em），不受各系統字型行高差異影響 */
.eyebrow { display: block; margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.eyebrow::before { content: ""; display: inline-block; vertical-align: baseline; width: 8px; height: 8px; margin: 0 10px calc(var(--mid) - 4px) 0; background: var(--orange); }
.btn { display: inline-flex; align-items: center; gap: 14px; background: var(--black); color: var(--paper); padding: 12px 16px 12px 18px; text-decoration: none; font-size: 14px; font-weight: 500; }
.btn .arrow { display: inline-grid; place-items: center; width: 22px; height: 22px; background: var(--orange); color: var(--black); font-size: 13px; }
.textlink { font-size: 14px; font-weight: 500; text-decoration: none; border-bottom: 1px solid currentColor; }
.textlink:hover { color: var(--orange); }
.tag { display: inline-block; font-size: 12px; font-weight: 500; letter-spacing: .08em; white-space: nowrap; }
.tag::before { content: ""; display: inline-block; vertical-align: baseline; width: 6px; height: 6px; margin: 0 6px calc(var(--mid) - 3px) 0; background: var(--orange); }

/* ---------- 4. home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(220px, 3fr) minmax(140px, 2fr); border-bottom: 1px solid var(--rule); }

/* 定位欄 */
.intro .eyebrow, .host .eyebrow { font-size: 15px; }
.intro { padding: clamp(40px, 5.5vw, 88px) var(--gutter) clamp(32px, 4vw, 56px); display: flex; flex-direction: column; gap: 26px; }
.intro h1 { margin: 0; font-size: clamp(34px, 4.2vw, 64px); line-height: 1.22; font-weight: 500; letter-spacing: .01em; }
.intro h1 span { white-space: nowrap; }
.lead { margin: 0; max-width: 30em; font-size: clamp(16px, 1.25vw, 19px); color: var(--ink-2); }
.lead-en { margin: 0; font-size: 14px; color: var(--ink-3); line-height: 1.6; }
.actions { display: flex; align-items: center; gap: 22px; margin-top: auto; padding-top: 8px; }

/* 主理欄 — 照片＋橘色斜切色塊（不經過臉與頸部） */
.host { border-left: 1px solid var(--rule); padding: clamp(28px, 3vw, 40px) 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.host-art { position: relative; margin: 0; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.host-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.host-art .tint, .host-art .dots { clip-path: polygon(0 79%, 100% 40.6%, 100% 100%, 0 100%); }
.host-art .dots { position: absolute; inset: 0; background-image: var(--halftone); background-size: 6px 6px; }
.host .meta { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair); }
.host .meta .textlink { display: inline-block; margin-top: 12px; font-size: 13px; }
.host-name { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.35; }
.host-name small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.host-role { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.65; }

/* 數字欄 */
.stats { border-left: 1px solid var(--rule); display: grid; grid-template-rows: repeat(4, 1fr); }
.stat { padding: 18px 20px; border-bottom: 1px solid var(--hair); display: flex; flex-direction: column; justify-content: flex-end; }
.stat:last-child { border-bottom: 0; }
.stat b { display: block; font-size: clamp(30px, 3vw, 46px); line-height: 1; font-weight: 300; }
.stat span { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-2); letter-spacing: .04em; }

/* 領域欄 */
.areas { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.area { padding: 26px var(--gutter) 30px; }
.area + .area { border-left: 1px solid var(--hair); }
.area .no { font-size: 12px; color: var(--orange); font-weight: 700; letter-spacing: .1em; }
.area h3 { margin: 10px 0 6px; font-size: 18px; font-weight: 700; line-height: 1.4; }
.area p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.75; }

/* ---------- 5. news ---------- */
.section { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.section > .head { padding: clamp(36px, 5vw, 72px) var(--gutter); border-right: 1px solid var(--hair); }
.section > .head h1,
.section > .head h2 { margin: 18px 0 14px; font-size: clamp(28px, 3vw, 44px); line-height: 1.25; font-weight: 500; }
.section > .head p:not(.eyebrow) { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 22em; }
.section > .head .eyebrow { font-size: 15px; }
.section > .head .more { display: inline-block; margin-top: 22px; }
.section > .body { padding: clamp(24px, 3.4vw, 48px) var(--gutter) clamp(36px, 5vw, 72px); }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.row { position: relative; display: grid; grid-template-columns: 112px 92px minmax(0, 1fr); gap: 20px; padding: 18px 0 20px; border-bottom: 1px solid var(--hair); align-items: baseline; }
.row time { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.row h3 { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.6; }
.row h3 a,
.featured h3 a { text-decoration: none; background-image: linear-gradient(var(--orange), var(--orange)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .2s; }
.row h3 a:hover,
.featured h3 a:hover { background-size: 100% 2px; }
.row p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.7; }

/* 置頂區：灰底＋左上橘色三角，以 .rows 的黑線與最新三則分開 */
.featured { position: relative; background: var(--paper-2); padding: 26px 30px 24px; }
.featured::before { content: ""; position: absolute; left: 0; top: 0; width: 22px; height: 22px; background: var(--orange); clip-path: polygon(0 0, 100% 0, 0 100%); }
.featured .f-meta { display: flex; align-items: baseline; gap: 18px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.featured h3 { margin: 8px 0; font-size: clamp(20px, 1.8vw, 24px); font-weight: 700; line-height: 1.45; }
.featured p { margin: 0 0 14px; font-size: 15px; color: var(--ink-2); }
.featured .textlink { font-size: 13px; }
.featured + .rows { margin-top: 30px; }

/* 單則消息 */
.news-meta { display: flex; align-items: baseline; gap: 18px; margin: 22px 0 0 !important; font-size: 13px; font-variant-numeric: tabular-nums; }
.news-single .body h1 { margin: 0; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.45; font-weight: 700; }
.news-single .summary { margin: 14px 0 0; font-size: 17px; color: var(--ink-2); }
.news-single .prose { margin-top: 28px; }
.news-link { margin-top: 28px; }

/* ---------- 6. pages ---------- */
.prose { max-width: 42em; }
.prose > :first-child { margin-top: 0; }
/* 只作用於內文的直接子元素，不影響 .rows 等元件 */
.prose > p, .prose > ul:not(.rows), .prose > ol { margin: 0 0 1em; }
.prose > ul:not(.rows), .prose > ol { padding-left: 1.4em; }
.prose > h2 { margin: 2em 0 .6em; font-size: 22px; font-weight: 700; line-height: 1.45; }
.prose > h3 { margin: 1.6em 0 .5em; font-size: 18px; font-weight: 700; line-height: 1.5; }
.prose > p a:not(.btn):not(.textlink), .prose > ul:not(.rows) a, .prose > ol a { text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose > blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 3px solid var(--orange); color: var(--ink-2); }
.page-news .prose { max-width: none; }

/* ---------- 7. footer ---------- */
.site-footer { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); background: var(--black); color: var(--paper); }
.site-footer::after { content: ""; position: absolute; right: 0; top: 0; width: 96px; height: 100%; background: var(--orange); clip-path: polygon(62% 0, 100% 0, 100% 100%, 0 100%); }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--orange); }
.f-id { position: relative; z-index: 1; padding: 34px var(--gutter) 32px; }
.f-id img { height: 20px; width: auto; }
.f-lines { font-style: normal; margin: 16px 0 0; font-size: 13px; line-height: 1.85; color: #b9b9b2; }
.f-name { font-size: 14px; font-weight: 500; color: var(--paper); letter-spacing: .04em; }
.f-lines [lang="en"] { color: #d6d6d0; }
.f-links { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr); gap: 32px; padding: 36px calc(var(--gutter) + 110px) 32px var(--gutter); }
.site-footer h2 { margin: 2px 0 8px; font-size: 12px; letter-spacing: .14em; font-weight: 500; color: #a9a9a2; }
.f-link { font-size: 14px; }
.social { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: max-content; gap: 2px 28px; font-size: 14px; line-height: 1.7; }

/* ---------- 8. responsive ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 7fr) minmax(220px, 4fr); }
  .stats { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); grid-template-rows: none; grid-template-columns: repeat(4, 1fr); }
  .stat { border-bottom: 0; border-right: 1px solid var(--hair); }
  .stat:last-child { border-right: 0; }
  .site-footer { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .menu { display: block; position: relative; }
  .menu summary { list-style: none; cursor: pointer; font-size: 14px; font-weight: 500; border: 1px solid var(--black); padding: 4px 10px; }
  .menu summary::-webkit-details-marker { display: none; }
  .menu nav { position: absolute; right: 0; top: calc(100% + 8px); background: var(--paper); border: 1px solid var(--rule); display: grid; min-width: 180px; z-index: 50; }
  .menu nav a { padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--hair); font-size: 15px; }
  .menu nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--orange); }

  .hero { grid-template-columns: 1fr; }
  .host { border-left: 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 112px 1fr; align-items: end; gap: 0 18px; padding: 22px var(--gutter); }
  .host .eyebrow { grid-column: 1 / -1; margin-bottom: 14px; }
  .host-art { width: 112px; }
  .host .meta { margin: 0; padding: 0; border: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--hair); }

  .areas { grid-template-columns: 1fr; }
  .area + .area { border-left: 0; border-top: 1px solid var(--hair); }

  .section { grid-template-columns: 1fr; }
  .section > .head { border-right: 0; padding-bottom: 8px; }
  .row { grid-template-columns: auto 1fr; gap: 4px 16px; }
  .row > div { grid-column: 1 / -1; }
  .featured { padding: 22px 20px 20px; }

  .site-footer { grid-template-columns: 1fr; }
  .site-footer::after { width: 48px; }
  .f-id { margin-right: 52px; padding: 26px 12px 4px var(--gutter); }
  .f-links { grid-template-columns: 1fr; gap: 20px; padding: 22px 64px 26px var(--gutter); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 消息的外部連結（報名表單、官方報導等） */
.row p.go { margin-top: 6px; }
.row p.go .textlink { font-size: 13px; }

/* 即將到來的消息：標籤橘底黑字（由 assets/js/upcoming.js 判斷日期） */
.upcoming .tag { justify-self: start; width: max-content; background: var(--orange); color: var(--paper); padding: 1px 7px 2px; margin-left: -7px; }
.upcoming .tag::before { background: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 頁首固定在上方（2026-11 調整） */
:root { --hdr: 72px; }
html { scroll-padding-top: calc(var(--hdr) + 12px); }
.site-header { position: sticky; top: 0; z-index: 60; background: var(--paper); }
.more-below { margin: 22px 0 0; }

/* 外框寬度上限：大螢幕時置中，兩側留紙色 */
.frame { width: min(1440px, calc(100% - 2 * var(--frame))); margin: var(--frame) auto; }

/* 清單：第一筆上方、最後一筆下方不畫線；下方接「顯示更多」折疊時保留最後一條線 */
.rows { border-top: 0; }
.rows > li:last-child { border-bottom: 0; }
.rows:has(+ details) > li:last-child { border-bottom: 1px solid var(--hair); }
