:root {
  --red-950: #5f0714;
  --red-800: #920d22;
  --red-700: #b8152e;
  --gold-400: #f2c866;
  --gold-200: #ffe8a7;
  --ink: #30151a;
  --muted: #826a6d;
  --surface: #fffdf9;
  --line: #eaded6;
  --shadow: 0 14px 30px rgba(63, 7, 17, 0.17);
  --shadow-hover: 0 20px 38px rgba(63, 7, 17, 0.22);
}

* { box-sizing: border-box; }

html { background: var(--red-950); }

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans Thai", Tahoma, Arial, sans-serif;
  background: var(--red-950);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(151deg, transparent 0 27%, #e71924 27% 72%, transparent 72% 100%);
}

button, a { font: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 64px) 64px;
}

.site-header {
  position: relative;
  padding: 16px 0 45px;
  color: #fffaf1;
}

.site-header::after {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: min(220px, 45vw);
  height: 2px;
  content: "";
  background: var(--gold-400);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-200);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 6px;
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.2;
}

.intro { margin-bottom: 0; color: rgba(255, 250, 241, 0.8); font-size: 16px; }

.projects-section {
  padding: clamp(12px, 2vw, 18px) 0 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  color: #fffaf1;
}

.section-heading h2 { margin-bottom: 0; font-size: 22px; font-weight: 600; }
.section-heading p { margin-bottom: 0; color: var(--gold-200); font-size: 13px; }

.tag-scroller {
  overflow-x: auto;
  margin: 0 -4px 26px;
  padding: 4px;
  scrollbar-color: rgba(184, 21, 46, 0.38) transparent;
  scrollbar-width: thin;
}

.tag-list { display: flex; width: max-content; gap: 7px; }

.tag-button {
  min-height: 28px;
  padding: 4px 12px;
  color: #111;
  cursor: pointer;
  background: #fff;
  border: 1px solid #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.tag-button:hover { transform: translateY(-1px); }
.tag-button:focus-visible, .explore-button:focus-visible, .thumbnail-link:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.tag-button[aria-selected="true"] { color: #fff; background: #111; border-color: #111; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 24px);
}

.project-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.project-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.location-mark { display: grid; flex: 0 0 auto; width: 19px; height: 19px; place-items: center; color: var(--red-700); }
.location-mark svg { width: 17px; height: 17px; }
.location-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thumbnail-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 14px;
}

.thumbnail {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #f1f1f1;
  border-radius: 14px;
}

.thumbnail img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.thumbnail.is-placeholder::after { position: relative; z-index: 1; color: #a8a8a8; content: "SEAMSI"; font-size: 13px; font-weight: 700; letter-spacing: 1.2px; }

.project-title {
  min-height: 46px;
  margin: 12px 0 2px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.updated-at { min-height: 18px; margin-bottom: 8px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.explore-button {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 4px 7px 4px 18px;
  color: #fffaf1;
  text-decoration: none;
  background: var(--red-700);
  border: 1px solid var(--red-700);
  border-radius: 999px;
  transition: background 160ms ease, transform 160ms ease;
}

.explore-label { flex: 1; text-align: center; }

.explore-icon {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--red-700);
  background: #fff;
  border-radius: 50%;
}

.explore-icon svg { width: 16px; height: 16px; }

.explore-button:hover { background: var(--red-950); transform: translateY(-1px); }
.empty-state, .loading-state { margin: 30px 0 0; color: #fffaf1; text-align: center; }
.load-more-sentinel { height: 1px; }

@media (max-width: 1050px) {
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .site-shell { padding: 28px 14px 38px; }
  .site-header { padding: 10px 6px 35px; }
  .projects-section { padding-top: 8px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .project-card { padding: 9px; }
  .tag-scroller { scrollbar-width: none; }
  .tag-scroller::-webkit-scrollbar { display: none; }
  .tag-button { min-height: 26px; padding: 3px 10px; font-size: 11px; }
  .project-meta { margin-bottom: 8px; font-size: 10px; }
  .location-mark { width: 16px; height: 16px; }
  .location-mark svg { width: 14px; height: 14px; }
  .project-title { min-height: 38px; margin-top: 9px; font-size: 14px; }
  .updated-at { min-height: 14px; margin-bottom: 7px; font-size: 10px; }
  .explore-button { min-height: 35px; font-size: 12px; }
}
