@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;700&display=swap');

/* ==============================
   基础重置与变量
   ============================== */
:root {
  --bg: #fafaf8;
  --ink: #1a1a1a;
  --mid: #4a4a4a;
  --pale: #f0ede8;
  --border: #c8c4bc;
  --accent: #2a2a2a;
  --nav-w: 220px;
  --radius: 18px;
  --shadow: 2px 4px 14px rgba(26,26,26,0.10);
  --font: 'Noto Sans Thai', 'Noto Sans', system-ui, sans-serif;
}

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

html {
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ==============================
   纸张纹理叠层
   ============================== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(26,26,26,0.025) 28px,
      rgba(26,26,26,0.025) 29px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(26,26,26,0.012) 40px,
      rgba(26,26,26,0.012) 41px
    );
  pointer-events: none;
  z-index: 0;
}

/* ==============================
   布局骨架
   ============================== */
.site-wrap {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ==============================
   左侧固定竖排导航
   ============================== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--nav-w);
  background: var(--ink);
  color: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 2px solid rgba(250,250,248,0.08);
  overflow: hidden;
}

.site-nav[open] {
  width: var(--nav-w);
}

.nav-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  cursor: pointer;
  border-bottom: 1px dashed rgba(250,250,248,0.15);
  list-style: none;
  min-height: 60px;
  flex-shrink: 0;
}

.nav-toggle::-webkit-details-marker,
.nav-toggle::marker {
  display: none;
}

.nav-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 6px;
  transform: rotate(-2deg);
  letter-spacing: -0.02em;
}

.nav-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--bg);
  opacity: 0.7;
  border-radius: 1px;
}

.nav-hamburger span:nth-child(1) { width: 80%; transform: rotate(-0.5deg); }
.nav-hamburger span:nth-child(2) { width: 60%; }
.nav-hamburger span:nth-child(3) { width: 90%; transform: rotate(0.8deg); }

.nav-menu {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 20px;
}

.nav-menu li {
  display: block;
}

.nav-menu li a {
  display: block;
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 400;
  color: rgba(250,250,248,0.82);
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: none;
  letter-spacing: 0.01em;
}

.nav-menu li a:hover,
.nav-menu li a[aria-current="page"] {
  color: var(--bg);
  border-left-color: var(--bg);
  background: rgba(250,250,248,0.06);
}

.nav-menu li a[aria-current="page"] {
  font-weight: 700;
}

/* ==============================
   主内容区
   ============================== */
.main-content {
  margin-left: var(--nav-w);
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* ==============================
   Hero 区块 — 首页
   ============================== */
.hero-section {
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  padding: 0 5vw 7vh;
  border-bottom: 1.5px solid var(--border);
  position: relative;
  overflow: hidden;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0,
    var(--ink) 8px,
    transparent 8px,
    transparent 16px
  );
}

.hero-inner {
  text-align: right;
  max-width: 820px;
  margin-left: auto;
}

.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--mid);
  text-transform: uppercase;
  margin-bottom: 18px;
  opacity: 0.8;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 20px;
  transform: rotate(-0.3deg);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--mid);
  line-height: 1.7;
  max-width: 520px;
  margin-left: auto;
}

/* ==============================
   分类 Hero
   ============================== */
.cat-hero-section,
.tag-hero-section {
  padding: 60px 5vw 50px;
  border-bottom: 1.5px solid var(--border);
  position: relative;
}

.cat-hero-section::after,
.tag-hero-section::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 5vw;
  right: 5vw;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--mid) 0,
    var(--mid) 4px,
    transparent 4px,
    transparent 10px
  );
  opacity: 0.3;
}

.cat-title,
.tag-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 12px 0 14px;
  transform: rotate(-0.2deg);
}

.cat-sub,
.tag-sub {
  font-size: 1rem;
  color: var(--mid);
  max-width: 600px;
  line-height: 1.7;
}

.tag-count {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--mid);
}

.tag-count strong {
  color: var(--ink);
  font-weight: 700;
}

/* ==============================
   Entry 页面 Header
   ============================== */
.entry-header-section {
  padding: 50px 5vw 40px;
  border-bottom: 1.5px solid var(--border);
}

.entry-title {
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 12px 0 16px;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.meta-date {
  font-size: 0.82rem;
  color: var(--mid);
  font-weight: 400;
  background: var(--pale);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.entry-hero-media {
  margin-top: 28px;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 420px;
}

.entry-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  font-size: 0.78rem;
  padding: 3px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 20px;
  color: var(--ink);
  font-weight: 500;
  transform: rotate(-0.5deg);
  display: inline-block;
}

.tag-chip:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ==============================
   About / Privacy Header
   ============================== */
.about-header-section,
.privacy-header-section {
  padding: 60px 5vw 46px;
  border-bottom: 1.5px solid var(--border);
}

.about-title,
.privacy-title {
  font-size: clamp(1.7rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 12px;
}

.about-sub {
  color: var(--mid);
  max-width: 560px;
  line-height: 1.7;
}

.privacy-updated {
  font-size: 0.85rem;
  color: var(--mid);
  margin-top: 10px;
}

.page-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--mid);
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  padding-bottom: 2px;
  margin-bottom: 14px;
}

/* ==============================
   面包屑
   ============================== */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--mid);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.breadcrumb a {
  color: var(--mid);
  border-bottom: 1px dotted var(--border);
}

.breadcrumb a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ==============================
   内容区 + 侧边栏布局
   ============================== */
.content-section {
  padding: 0 0 60px;
}

.layout-with-aside {
  display: flex;
  gap: 0;
}

.page-aside {
  width: 220px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--border);
  min-height: 400px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}

.aside-inner {
  padding: 32px 20px 32px 24px;
}

.aside-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--mid);
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}

.aside-cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  counter-reset: aside-counter;
}

.aside-cat-list li {
  counter-increment: aside-counter;
}

.aside-cat-list li a {
  display: block;
  font-size: 0.84rem;
  color: var(--mid);
  padding: 7px 0 4px;
  border-bottom: 1px dashed rgba(74,74,74,0.18);
  line-height: 1.4;
  transition: none;
}

.aside-cat-list li a::before {
  content: counter(aside-counter, decimal-leading-zero) " ";
  font-size: 0.7rem;
  opacity: 0.5;
  margin-right: 4px;
}

.aside-cat-list li a:hover {
  color: var(--ink);
}

.aside-cat-list li small {
  display: block;
  font-size: 0.74rem;
  color: rgba(74,74,74,0.6);
  line-height: 1.3;
  margin-top: 2px;
  padding-left: 22px;
}

.aside-related-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aside-related-list .related-item a {
  display: block;
  font-size: 0.82rem;
  color: var(--mid);
  padding: 8px 0;
  border-bottom: 1px dashed rgba(74,74,74,0.15);
  line-height: 1.4;
}

.aside-related-list .related-item a:hover {
  color: var(--ink);
}

.aside-related-list .related-item a time {
  display: block;
  font-size: 0.72rem;
  opacity: 0.55;
  margin-top: 2px;
}

.aside-back-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--mid);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.aside-back-link:hover {
  color: var(--ink);
}

.aside-brand-block {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1.5px solid var(--border);
}

.aside-brand-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.aside-brand-desc {
  font-size: 0.74rem;
  color: var(--mid);
  line-height: 1.5;
}

.content-main {
  flex: 1;
  min-width: 0;
  padding: 40px 5vw 40px 40px;
}

/* ==============================
   正文排版
   ============================== */
.prose-block {
  max-width: 720px;
  margin-bottom: 48px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--mid);
}

.prose-block h2,
.prose-block h3 {
  color: var(--ink);
  font-weight: 700;
  margin: 1.8em 0 0.7em;
  letter-spacing: -0.01em;
}

.prose-block h2 { font-size: 1.25rem; }
.prose-block h3 { font-size: 1.05rem; }

.prose-block p {
  margin-bottom: 1.1em;
}

.prose-block a {
  color: var(--ink);
  border-bottom: 1.5px solid var(--border);
  transition: none;
}

.prose-block a:hover {
  border-bottom-color: var(--ink);
}

.prose-block ul, .prose-block ol {
  margin: 0.8em 0 1em 1.4em;
  list-style: disc;
}

.prose-block ol {
  list-style: decimal;
}

.prose-block li {
  margin-bottom: 0.4em;
}

/* ==============================
   区块标题
   ============================== */
.section-block {
  margin-top: 48px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: rotate(-0.2deg);
}

.section-title span {
  display: inline;
}

/* ==============================
   卡片网格 — Gallery
   ============================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
  counter-reset: gallery-counter;
}

.gallery-card {
  counter-increment: gallery-counter;
}

.gallery-card a {
  display: block;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transform: rotate(var(--rot, 0deg));
  transition: none;
  position: relative;
}

.gallery-card a::before {
  content: counter(gallery-counter, decimal-leading-zero);
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(26,26,26,0.25);
  letter-spacing: 0.06em;
  z-index: 2;
}

.gallery-card a:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 4px 8px 24px rgba(26,26,26,0.16);
  border-color: var(--mid);
}

.card-media {
  height: 140px;
  overflow: hidden;
  background: var(--pale);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-media img.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-no-img {
  background: repeating-linear-gradient(
    45deg,
    var(--pale),
    var(--pale) 6px,
    rgba(200,196,188,0.3) 6px,
    rgba(200,196,188,0.3) 12px
  );
}

.card-no-img-num {
  font-size: 2.2rem;
  font-weight: 700;
  color: rgba(74,74,74,0.18);
  letter-spacing: -0.04em;
}

.card-body {
  padding: 14px 16px 16px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 7px;
}

.card-title span {
  display: inline;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--mid);
  line-height: 1.55;
  margin-bottom: 8px;
}

.card-date {
  font-size: 0.72rem;
  color: rgba(74,74,74,0.5);
  display: block;
}

/* ==============================
   分类卡片网格
   ============================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  counter-reset: cat-counter;
}

.cat-card {
  counter-increment: cat-counter;
}

.cat-card a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--pale);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  transform: rotate(var(--rot, 0deg));
  transition: none;
}

.cat-card a:hover {
  background: var(--bg);
  border-color: var(--ink);
  transform: rotate(0deg) translateY(-2px);
  box-shadow: var(--shadow);
}

.cat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(26,26,26,0.12);
  line-height: 1;
  letter-spacing: -0.04em;
  display: block;
}

.cat-card strong {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  display: block;
}

.cat-card small {
  font-size: 0.76rem;
  color: var(--mid);
  line-height: 1.45;
  display: block;
}

/* ==============================
   h2/h3 内 span 装饰（契约要求）
   ============================== */
h2 > span, h3 > span {
  display: inline;
  position: relative;
}

.aside-title > span::after {
  display: none;
}

.section-title > span,
.cat-title > span,
.tag-title > span,
.about-title > span,
.privacy-title > span,
.entry-title > span {
  display: inline;
}

/* ==============================
   页脚
   ============================== */
.site-footer {
  margin-left: var(--nav-w);
  border-top: 2px solid var(--ink);
  padding: 40px 5vw 28px;
  background: var(--bg);
  position: relative;
}

.footer-cta {
  text-align: center;
  margin-bottom: 28px;
}

.btn-cta {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 40px;
  letter-spacing: 0.04em;
  border: 2px solid var(--ink);
  transform: rotate(-0.5deg);
  transition: none;
  min-height: 48px;
  line-height: 1.2;
}

.btn-cta:hover {
  background: var(--bg);
  color: var(--ink);
  transform: rotate(0deg);
}

.footer-address {
  font-style: normal;
  text-align: center;
  font-size: 0.82rem;
  color: var(--mid);
  margin-bottom: 14px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links li a {
  font-size: 0.82rem;
  color: var(--mid);
  border-bottom: 1px dotted var(--border);
  padding: 8px 4px;
  display: inline-block;
  min-height: 40px;
  line-height: 1.5;
}

.footer-links li a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.footer-copy {
  text-align: center;
  font-size: 0.78rem;
  color: rgba(74,74,74,0.5);
}

/* ==============================
   动效
   ============================== */
@media (prefers-reduced-motion: no-preference) {
  .gallery-card a,
  .cat-card a,
  .btn-cta {
    transition: transform 0.18s cubic-bezier(.25,.46,.45,.94),
                box-shadow 0.18s ease,
                background 0.15s ease,
                border-color 0.15s ease;
  }

  .gallery-card a:hover {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
  }

  .nav-menu li a {
    transition: color 0.1s ease, background 0.1s ease;
  }
}

/* ==============================
   响应式断点
   ============================== */
@media (max-width: 1024px) {
  :root {
    --nav-w: 200px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  :root {
    --nav-w: 0px;
  }

  .site-nav {
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    flex-direction: column;
    border-right: none;
    border-bottom: 2px solid rgba(250,250,248,0.12);
    z-index: 200;
  }

  .site-nav:not([open]) {
    height: auto;
    overflow: hidden;
  }

  .site-nav:not([open]) .nav-menu {
    display: none;
  }

  .site-nav[open] {
    width: 100%;
    height: auto;
    max-height: 100vh;
  }

  .nav-toggle {
    padding: 12px 16px;
    min-height: 52px;
  }

  .nav-menu {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0 16px;
    flex-direction: column;
  }

  .nav-menu li a {
    padding: 13px 20px;
    font-size: 0.95rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .main-content {
    margin-left: 0;
    margin-top: 52px;
  }

  .site-footer {
    margin-left: 0;
  }

  .layout-with-aside {
    flex-direction: column;
  }

  .page-aside {
    width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--border);
    position: static;
    max-height: none;
  }

  .aside-inner {
    padding: 20px 20px;
  }

  .content-main {
    padding: 28px 20px 32px;
  }

  .hero-section {
    min-height: 70vh;
    padding: 0 20px 48px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
  }

  .cat-hero-section,
  .tag-hero-section,
  .about-header-section,
  .privacy-header-section,
  .entry-header-section {
    padding: 40px 20px 32px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }

  .cat-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 12px;
  }

  .btn-cta {
    padding: 14px 28px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .cat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .entry-title,
  .cat-title,
  .tag-title,
  .about-title,
  .privacy-title {
    font-size: 1.5rem;
  }
}
