/* ===== Fonts ===== */
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/plex-thai-400-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/plex-thai-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/plex-thai-600-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/plex-thai-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ===== Custom properties / theme ===== */
:root {
  --font-sans: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI",
    sans-serif;

  --accent: #e8871e;
  --accent-hover: #cf7414;
  --teal: #1e8e82;

  --radius: 14px;
  --max-width-article: 44rem;
  --max-width-page: 72rem;
}

html[data-theme="light"],
:root {
  --bg: #fafaf7;
  --bg-elevated: #ffffff;
  --text: #1c1a17;
  --text-muted: #5c574f;
  --border: #e4dfd6;
  --shadow: 0 8px 24px rgba(28, 26, 23, 0.08);
  --shadow-hover: 0 14px 32px rgba(28, 26, 23, 0.12);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #111418;
  --bg-elevated: #191d22;
  --text: #f1efe9;
  --text-muted: #b3aea3;
  --border: #2b2f35;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ===== Reset ===== */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1em;
}

/* ===== Layout ===== */
.page-container {
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.site-main {
  min-height: 60vh;
}

/* ===== Header / Nav ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.site-header__inner {
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-name {
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.lock-link {
  margin-left: auto;
  text-decoration: none;
  font-size: 1rem;
  opacity: 0.75;
}

.lock-link:hover {
  opacity: 1;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* ===== Hero ===== */
.hero {
  padding: 3rem 0 2rem;
  text-align: left;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.5rem;
}

.hero__intro {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 38rem;
}

.section-title {
  font-size: 1.4rem;
  margin: 2.5rem 0 1.25rem;
}

/* ===== Card grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 780px) {
  .card-grid,
  .card-grid--2,
  .card-grid--3 {
    grid-template-columns: 1fr;
  }
}

.path-card,
.section-card,
.card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.path-card:hover,
.section-card:hover,
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.path-card__icon,
.card__icon {
  font-size: 1.8rem;
  display: inline-block;
  margin-bottom: 0.6rem;
}

.path-card h3,
.section-card h3,
.card__title {
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
}

.path-card p,
.section-card p,
.card__desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.card__date {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.section-card h3 {
  color: var(--accent);
}

/* ===== Tags ===== */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
}

.tag-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  color: var(--teal);
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
}

/* ===== Article ===== */
.article {
  max-width: var(--max-width-article);
  margin: 0 auto;
}

.article__header {
  margin-bottom: 2rem;
}

.article__header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
}

.article__meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.article__prose {
  font-size: 1.05rem;
}

.article__prose :first-child {
  margin-top: 0;
}

/* ===== Disclaimer ===== */
.disclaimer-box {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.disclaimer-box p {
  margin: 0;
}

/* ===== Listing pages ===== */
.listing-header {
  margin-bottom: 2rem;
}

.listing-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Watchlist table ===== */
.watchlist {
  margin-top: 3rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.watchlist-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  background: var(--bg-elevated);
}

.watchlist-table th,
.watchlist-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.watchlist-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: color-mix(in srgb, var(--teal) 8%, transparent);
}

.watchlist-table tr:last-child td {
  border-bottom: none;
}

/* ===== Link cards (me page) ===== */
.link-card {
  text-align: left;
}

/* ===== quiz ===== */
.quiz-card {
  max-width: var(--max-width-article);
  margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

@media (max-width: 600px) {
  .quiz-card {
    padding: 1.25rem;
  }
}

.quiz-progress {
  width: 100%;
  height: 0.4rem;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.quiz-progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.quiz-step {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.quiz-question {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  outline: none;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.quiz-option:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quiz-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz-option.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.quiz-nav {
  margin-top: 1.5rem;
  min-height: 2.2rem;
}

.quiz-back {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.quiz-back:hover {
  color: var(--accent);
}

.quiz-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Result screen ---- */
.quiz-result {
  text-align: left;
}

.quiz-result__emoji {
  font-size: 2.75rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.quiz-result__title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  outline: none;
}

.quiz-result__desc {
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.quiz-result__details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 0 1.75rem;
}

.quiz-result__details dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.quiz-result__details dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.quiz-mix {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-bottom: 1.75rem;
}

.quiz-mix__title {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.quiz-mix__row {
  display: grid;
  grid-template-columns: 8.5rem 1fr 3rem;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.quiz-mix__label {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-mix__track {
  height: 0.5rem;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
  overflow: hidden;
}

.quiz-mix__fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.quiz-mix__pct {
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quiz-replay {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.quiz-replay:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.quiz-replay:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz-footer-note {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 500px) {
  .quiz-mix__row {
    grid-template-columns: 6.5rem 1fr 2.5rem;
    font-size: 0.78rem;
  }
}

/* ===== page extras ===== */
.hero__tagline {
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: -0.25rem;
  margin-bottom: 0.9rem;
}

.principles p {
  max-width: var(--max-width-article);
  line-height: 1.7;
  margin-bottom: 1.1rem;
}

.watchlist-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ===== journey ===== */
.cat-header__emoji {
  font-size: 2.5rem;
  line-height: 1;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.cat-header p {
  color: var(--text-muted);
  max-width: 38rem;
}

.home-categories .card__icon,
.home-more .card__icon {
  font-size: 1.8rem;
}

.home-more {
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}


/* ===== affiliate ===== */
.aff-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; background: var(--bg-elevated); }
.aff-box__name { margin: 0 0 0.25rem; font-weight: 600; }
.aff-box__note { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.aff-box__btn { display: inline-block; padding: 0.4rem 1rem; border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 0.9rem; text-decoration: none; }
.aff-box__btn:hover { opacity: 0.9; }
.aff-box__disclosure { margin: 0.75rem 0 0; font-size: 0.72rem; color: var(--text-muted); }
