/* palm-journal design tokens — ported from the Astro version */
:root {
  --background: #f7f2e7;
  --foreground: #2b2a26;
  --card: #ffffff;
  --card-foreground: #2b2a26;
  --primary: #c1602e; /* clay */
  --primary-foreground: #ffffff;
  --secondary: #3f5c44; /* forest */
  --secondary-foreground: #ffffff;
  --accent: #7c9468; /* sage */
  --accent-foreground: #2b2a26;
  --muted: #efe9dc;
  --muted-foreground: #6b6759;
  --border: #e7e1d2;
  --font-sans: "IBM Plex Sans Thai", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", monospace;
  --radius: 8px;
  --max: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --background: #1c1b18;
    --foreground: #f2ede2;
    --card: #242320;
    --card-foreground: #f2ede2;
    --primary: #e08657;
    --primary-foreground: #1c1b18;
    --secondary: #6d9074;
    --secondary-foreground: #1c1b18;
    --accent: #a3b98d;
    --accent-foreground: #1c1b18;
    --muted: #2c2a25;
    --muted-foreground: #a39d8c;
    --border: #3a3730;
  }
}

:root.dark {
  --background: #1c1b18;
  --foreground: #f2ede2;
  --card: #242320;
  --card-foreground: #f2ede2;
  --primary: #e08657;
  --primary-foreground: #1c1b18;
  --secondary: #6d9074;
  --secondary-foreground: #1c1b18;
  --accent: #a3b98d;
  --accent-foreground: #1c1b18;
  --muted: #2c2a25;
  --muted-foreground: #a39d8c;
  --border: #3a3730;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Header */
.site-header {
  border-bottom: 1px solid transparent;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 40;
  color: #fff;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.site-header.is-solid,
.site-header.is-menu-open {
  background: var(--background);
  color: var(--foreground);
  border-bottom-color: var(--border);
}

body:not(.has-hero) .site-header {
  background: var(--background);
  color: var(--foreground);
  border-bottom-color: var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1.15rem;
  color: inherit;
}

.brand:hover {
  text-decoration: none;
}

.brand svg,
.brand img {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  object-fit: contain;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  color: inherit;
  opacity: 0.78;
  font-size: 0.9rem;
}

.site-nav a:hover,
.site-nav a.is-active {
  opacity: 1;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(127, 127, 127, 0.15);
}

.mobile-menu-btn {
  display: none;
}

#mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
}

#mobile-menu.is-open {
  display: block;
}

#mobile-menu nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 20px;
}

#mobile-menu a {
  color: var(--foreground);
  padding: 8px 0;
}

/* Hero */
.hero {
  position: relative;
  margin-top: -65px;
  min-height: 560px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #111 center/cover no-repeat;
  color: #fff;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(20, 18, 14, 0.78), rgba(30, 26, 20, 0.45) 55%, rgba(30, 26, 20, 0.1));
}

.hero-content {
  position: relative;
  max-width: 640px;
  padding: 120px 20px 64px;
  margin: 0 auto;
  width: 100%;
}

.hero-content h1 {
  font-size: 2.5rem;
  line-height: 1.1;
  margin: 0;
}

.hero-content p {
  margin-top: 20px;
  font-size: 1.1rem;
  opacity: 0.88;
  max-width: 480px;
}

.hero-links {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.hero-links a {
  color: #fff;
}

.hero-links .lead {
  border-bottom: 1px solid #fff;
  padding-bottom: 2px;
  font-weight: 500;
}

.hero-links .browse {
  opacity: 0.8;
}

/* Featured */
.featured {
  border-bottom: 1px solid var(--border);
  padding: 56px 0;
}

.featured-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 860px) {
  .featured-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.featured-thumb {
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
}

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

.featured-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.featured-body h2 {
  font-size: 2rem;
  margin: 10px 0;
  line-height: 1.15;
}

.featured-body h2 a {
  color: inherit;
}

.featured-body p {
  color: var(--muted-foreground);
  font-size: 1.05rem;
}

/* Category + lang badges */
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.category-tag {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Latest section */
.latest {
  padding: 56px 0;
}

.latest-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.latest-head h2 {
  font-size: 1.5rem;
  margin: 0;
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 32px;
  margin: 32px 0;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-card .thumb {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
}

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

.post-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.post-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.post-card .excerpt {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin: 0;
}

/* Post detail */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  padding-top: 24px;
}

.breadcrumbs a {
  color: var(--muted-foreground);
}

.post-header {
  text-align: center;
  max-width: 640px;
  margin: 32px auto 0;
}

.post-header h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  margin: 12px 0;
}

.post-thumb {
  max-width: 880px;
  margin: 40px auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
}

.post-body {
  max-width: 680px;
  margin: 32px auto;
  font-size: 1.05rem;
}

.post-body h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
}

.translation-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 0.9rem;
}

.tag-row {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.author-box {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.author-box .avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  flex-shrink: 0;
}

.author-box .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.post-pagination {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.post-pagination a {
  color: var(--foreground);
}

.post-pagination .next {
  text-align: right;
}

.post-pagination .direction {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Filters */
.category-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-filters button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.category-filters button.is-active {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
}

.footer-grid {
  display: grid;
  gap: 32px;
  padding: 48px 0;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-grid .brand {
  font-size: 1.1rem;
}

.footer-grid p {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  max-width: 340px;
}

.footer-col .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.footer-col a {
  color: var(--foreground);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

/* Responsive */
@media (max-width: 760px) {
  .site-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .hero-content h1 {
    font-size: 1.9rem;
  }
  .post-header h1 {
    font-size: 1.75rem;
  }
  .post-pagination {
    grid-template-columns: 1fr;
  }
  .post-pagination .next {
    text-align: left;
  }
}
