/* =====================================================================
   筑见 · Paper & Seal — shared stylesheet
   Warm cream paper, seal-red ink, editorial Songti
   Mobile-first; scales up on wider viewports.
   ===================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --paper:        #f2e9d8;
  --paper-deep:   #ebe1cc;
  --paper-warm:   #f6eeda;
  --ink:          #1a1612;
  --ink-soft:     #3d342a;
  --ink-mute:     #7a6e5e;
  --ink-dim:      #a89d89;
  --seal:         #b13a2f;
  --seal-deep:    #8a2a22;
  --seal-glow:    rgba(177,58,47,0.12);
  --rule:         rgba(26,22,18,0.12);
  --rule-soft:    rgba(26,22,18,0.06);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "kern" 1, "palt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* ===== Paper texture overlay ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(139,106,60,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139,106,60,0.03) 0%, transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 100%, 100%, 180px 180px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
}

main { position: relative; z-index: 2; }

/* ===== Vertical edge rule & stamp ===== */
.edge-rule {
  position: fixed;
  left: 22px; top: 0; bottom: 0;
  width: 1px;
  background: var(--rule);
  z-index: 3;
  pointer-events: none;
}
.edge-stamp {
  position: fixed;
  left: 14px; top: 40px;
  writing-mode: vertical-rl;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 10px;
  letter-spacing: 0.6em;
  color: var(--ink-dim);
  z-index: 4;
  pointer-events: none;
}

/* ===== Subpage header (back link) ===== */
.page-header {
  position: relative;
  z-index: 2;
  padding: 28px 32px 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.back-link {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.2em;
  font-family: "Songti SC", serif;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.back-link:active { color: var(--seal); border-bottom-color: var(--seal); }
.page-header-mark {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--seal);
  text-transform: uppercase;
}

/* ===== Page hero (subpages) ===== */
.page-hero {
  padding: 56px 32px 72px 48px;
  position: relative;
}
.page-hero-eyebrow {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.35em;
  color: var(--seal);
  text-transform: uppercase;
  margin-bottom: 18px;
  font-weight: 500;
}
.page-hero-eyebrow::before {
  content: "§ ";
  font-style: normal;
  margin-right: 4px;
}
.page-hero h1 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(34px, 10vw, 52px);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 22px;
  max-width: 14ch;
}
.page-hero h1 .accent { color: var(--seal); }
.page-hero-desc {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
  max-width: 38ch;
}

/* ===== Page hero visual (canvas anchor) ===== */
.hero-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1.1 / 1;
  max-width: 340px;
  margin: 0 0 32px;
}
.hero-visual canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Section base ===== */
section.content {
  padding: 72px 32px 72px 48px;
  position: relative;
  border-top: 1px solid var(--rule);
}

.section-head { margin-bottom: 48px; }

.section-label {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--seal);
  margin-bottom: 16px;
  font-weight: 500;
  text-transform: uppercase;
}
.section-label::before {
  content: "§ ";
  font-style: normal;
  color: var(--seal);
  margin-right: 4px;
}

.section-title {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(26px, 7.5vw, 34px);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink);
  line-height: 1.3;
}
.section-title .accent { color: var(--seal); }

/* ===== Entry (numbered list item, used by work list & tool list) ===== */
.entry-list {
  display: flex;
  flex-direction: column;
}
.entry {
  display: block;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: padding-left 0.35s ease;
}
.entry:last-child { border-bottom: 1px solid var(--rule); }
.entry:active { padding-left: 8px; }

.entry-num {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 12px;
  color: var(--seal);
  letter-spacing: 0.25em;
  margin-bottom: 8px;
  font-weight: 500;
}

.entry-title {
  font-family: "Songti SC", serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  color: var(--ink);
  line-height: 1.3;
}

.entry-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.75;
  max-width: 42ch;
}
.entry-desc strong { color: var(--ink); font-weight: 600; }

.entry-arrow {
  position: absolute;
  top: 32px;
  right: 0;
  font-family: "Songti SC", serif;
  color: var(--ink-dim);
  font-size: 16px;
}

/* ===== Tag ===== */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag {
  padding: 4px 12px;
  border: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  background: rgba(246,238,218,0.4);
  font-family: "Songti SC", serif;
}
.tag.seal { color: var(--seal); border-color: rgba(177,58,47,0.35); }

/* ===== Image card (for subpages) ===== */
.image-card {
  position: relative;
  margin: 22px 0 0;
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--paper-warm);
}
.image-card img {
  display: block;
  width: 100%;
  height: auto;
}
.image-card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--seal);
  border-left: 1px solid var(--seal);
}
.image-card::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 1px solid var(--seal);
  border-right: 1px solid var(--seal);
}

/* ===== Data card ===== */
.data-card {
  padding: 24px 22px;
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(246,238,218,0.5), transparent);
  position: relative;
  margin-top: 22px;
}
.data-card-title {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ink-mute);
  margin-bottom: 18px;
  font-family: "Songti SC", serif;
  text-transform: uppercase;
}
.data-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.data-item { }
.data-value {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 26px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.data-value.accent { color: var(--seal); font-style: italic; }
.data-label {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  line-height: 1.5;
}

/* ===== Signal grid (two cells) ===== */
.signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.signal-item {
  background: rgba(246,238,218,0.5);
  border: 1px solid var(--rule);
  padding: 16px 14px;
}
.signal-value {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 4px;
}
.signal-value.buy { color: var(--seal); font-style: italic; }
.signal-label {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
}

/* ===== Button ===== */
.btn {
  display: inline-block;
  padding: 13px 26px;
  background: var(--ink);
  color: var(--paper-warm);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.25em;
  font-weight: 500;
  font-family: "Songti SC", serif;
  transition: background 0.2s, transform 0.2s;
  margin-top: 16px;
}
.btn::after { content: " →"; font-family: "Songti SC", serif; }
.btn:active { background: var(--seal); transform: translateY(1px); }
.btn.ghost {
  background: transparent;
  color: var(--seal);
  border: 1px solid var(--seal);
}
.btn.ghost:active { background: var(--seal); color: var(--paper-warm); }
.btn.disabled {
  background: transparent;
  color: var(--ink-dim);
  border: 1px dashed var(--ink-dim);
  pointer-events: none;
}
.btn.disabled::after { content: ""; }

/* ===== Output grid (AI skills) ===== */
.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.output-card {
  padding: 16px 14px;
  background: rgba(246,238,218,0.5);
  border: 1px solid var(--rule);
}
.output-card .kanji {
  font-family: "Songti SC", serif;
  font-size: 20px;
  color: var(--seal);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.output-card .output-title {
  font-family: "Songti SC", serif;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.06em;
}
.output-card .output-text {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.65;
}

/* ===== Timeline (meta page) ===== */
.timeline {
  margin: 32px 0 8px 0;
  padding-left: 18px;
  border-left: 1px solid var(--rule);
  position: relative;
}
.timeline-step {
  position: relative;
  padding: 0 0 32px 22px;
}
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 8px;
  width: 7px; height: 7px;
  background: var(--paper);
  border: 1px solid var(--seal);
  border-radius: 50%;
}
.timeline-step:last-child::before {
  background: var(--seal);
  box-shadow: 0 0 0 3px rgba(177,58,47,0.15);
}
.step-title {
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: 0.18em;
}
.step-title::after {
  content: attr(data-en);
  display: inline-block;
  margin-left: 12px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--seal);
  font-weight: 500;
  text-transform: lowercase;
  vertical-align: middle;
}
.step-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.85;
  white-space: pre-line;
  font-family: -apple-system, "PingFang SC", sans-serif;
}

/* ===== Info cards (2-up) ===== */
.info-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 22px;
}
.info-card {
  padding: 20px;
  background: rgba(246,238,218,0.5);
  border: 1px solid var(--rule);
}
.info-card-title {
  font-family: "Songti SC", serif;
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.08em;
}
.info-card-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.75;
}

/* ===== Graph images ===== */
.graph-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 22px 0;
}
.graph-images img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper-warm);
}

/* ===== Closing ===== */
.closing {
  padding: 80px 32px 80px 48px;
  border-top: 1px solid var(--rule);
  position: relative;
  z-index: 2;
}
.closing p {
  font-family: "Songti SC", serif;
  font-size: 18px;
  line-height: 1.9;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  max-width: 22ch;
}
.closing p .accent { color: var(--seal); }

/* ===== Footer ===== */
footer {
  padding: 48px 32px 40px 48px;
  text-align: left;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.4em;
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  position: relative;
  z-index: 2;
  font-family: "Songti SC", serif;
}
footer .mark { color: var(--seal); margin: 0 6px; }
footer a {
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
footer a:active { color: var(--seal); border-bottom-color: var(--seal); }

/* ===================== LARGE-VIEWPORT ADJUSTMENTS ===================== */
@media (min-width: 700px) {
  .page-header, .page-hero, section.content, .closing, footer {
    padding-left: 10vw;
    padding-right: 10vw;
  }
  .edge-rule { left: 5vw; }
  .edge-stamp { left: calc(5vw - 8px); }
  .info-cards, .output-grid { grid-template-columns: 1fr 1fr; }
  .graph-images { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .page-header, .page-hero, section.content, .closing, footer {
    padding-left: 16vw;
    padding-right: 16vw;
  }
  .edge-rule { left: 8vw; }
  .edge-stamp { left: calc(8vw - 8px); }
  .page-hero h1 { max-width: 18ch; }
}
