:root {
  --bg: #FBEFE6;
  --accent: #C9821E;
  --ink: #2A2118;
  --ink-soft: #5C5148;
  --line: #E3CBB4;
  --navy: #16326E;
  --red: #C6302B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", "Sarabun", sans-serif;
}

body {
  min-height: 100vh;
}

/* ---------- Masthead (right-aligned, rebuilt from logo.png) ---------- */

.masthead {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  justify-content: flex-end;
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.masthead-text {
  text-align: right;
}

.masthead-skyline {
  display: block;
  margin-left: auto;
  height: 34px;
  width: auto;
}

.masthead-text h1 {
  margin: 0.15rem 0 0;
  font-size: 2rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.wordmark-flag {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
  height: 0.85em;
  width: auto;
}

.word-khaothai { color: var(--navy); }
.word-wanni { color: var(--red); }

.masthead-underline {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0.15rem;
}

.masthead-underline span {
  display: block;
  height: 3px;
  width: 44px;
  border-radius: 2px;
}

.underline-navy { background: var(--navy); }
.underline-red { background: var(--red); }

.masthead-tagline {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Feed ---------- */

.feed {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 1rem;
}

.story {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.feed .story:last-child {
  border-bottom: none;
}

.story.image-right {
  flex-direction: row-reverse;
}

.story-image {
  flex: 0 0 38%;
  max-width: 38%;
}

.story-image img {
  width: 100%;
  height: auto;
  display: block;
}

.story-text {
  flex: 1;
  min-width: 0;
}

.story-section {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.story-title {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

.story-preview {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-soft);
  white-space: pre-line;
}

.story-continue {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.92rem;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* ---------- Overlay (full-screen article modal) ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  overflow-y: auto;
  z-index: 100;
}

.overlay.open {
  display: block;
}

.overlay-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
  position: relative;
}

.overlay-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 101;
}

.overlay-image {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 1.5rem;
}

.overlay-section {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.overlay-title {
  margin: 0 0 1.25rem;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.4;
}

.overlay-body p {
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--ink);
  margin: 0 0 1.1rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .masthead-text h1 { font-size: 1.5rem; }
  .masthead-skyline { height: 26px; }

  .story,
  .story.image-right {
    flex-direction: column;
    gap: 0.9rem;
  }

  .story-image,
  .story-image {
    flex: none;
    max-width: 100%;
  }

  .overlay-inner {
    padding: 4rem 1.1rem 2.5rem;
  }
}
