/* it-php — plain CSS port of the it-web styled-components design */

:root {
  --teal: #09c69b;
  --teal-bright: #00ffdb;
  --teal-mobile-active: #00c2a6;
  --nav-bg: #171717;
  --footer-top-bg: #111;
  --footer-bottom-bg: #000;
  --card-shadow: 0 0 11px 3px rgba(215, 215, 215, 0.51);
  --text-muted: #444;
  --text-body: #333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans Thai', sans-serif;
  color: var(--text-body);
  background: #fff;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.3s;
}

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

h1, h2, h3, h4 {
  margin: 0 0 10px;
}

.container {
  width: 1250px;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* it-web uses a narrower 1150px container for the home/category/tag listing sections and the
   hero, but the wider 1250px one for the article view, nav and footer — kept as a modifier
   rather than picking one width, to preserve the original's alignment between components. */
.container-narrow {
  width: 1150px;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

main {
  padding-top: 60px;
  min-height: 60vh;
}

/* ---------- Navbar (dark) ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 0 60px;
  height: 60px;
  z-index: 200;
  background: var(--nav-bg);
}

.navbar .logo a {
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar .logo img {
  /* The source logo's native aspect ratio (263x44) doesn't match the 120x44 box it's
     rendered at — without this it stretches instead of scaling proportionally (matches the
     original Next.js Image's objectFit: 'contain'). */
  object-fit: contain;
}

.footer-col img {
  object-fit: contain;
}

.menu-list {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.menu-item {
  padding: 5px 10px;
  font-weight: 500;
  color: #e1e1e1;
}

.menu-item:hover {
  color: var(--teal);
}

.menu-item.active {
  color: var(--teal-bright);
}

.menu-button {
  display: none;
  background: none;
  border: none;
  font-size: 1.6em;
  color: #e1e1e1;
  cursor: pointer;
}

.mobile-menu {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: rgb(24, 24, 24);
  padding: 20px;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.mobile-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-menu-item {
  padding: 10px;
  color: #ffffff;
  font-weight: 500;
}

.mobile-menu-item.active {
  color: var(--teal-mobile-active);
}

@media screen and (max-width: 1250px) {
  .navbar {
    padding: 0 20px;
  }
  .menu-list {
    display: none;
  }
  .menu-button {
    display: block;
  }
}

/* ---------- Highlight / hero section ---------- */
.highlight-section {
  display: flex;
  justify-content: center;
  padding: 25px 0 2em 0;
  overflow: hidden;
}

.highlight-body {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  gap: 20px;
}

.highlight-left {
  position: relative;
  min-width: 300px;
  width: 500px;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: block;
}

.highlight-left .img-container {
  position: relative;
  aspect-ratio: 1;
  height: 100%;
  margin-bottom: 10px;
}

.highlight-left img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.2s;
}

.highlight-left:hover img {
  filter: brightness(0.9);
}

.highlight-left .title {
  z-index: 10;
  padding: 10px 15px;
  background: #ffffffde;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: absolute;
  bottom: 0;
  width: 100%;
}

.highlight-left .title h3 {
  color: #000;
  font-size: 1.3em;
  margin: 0;
}

.highlight-right {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  flex: 1;
}

.highlight-right-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: block;
}

.highlight-right-card .img-container {
  position: relative;
  height: 200px;
  margin-bottom: 10px;
}

.highlight-right-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.2s;
}

.highlight-right-card:hover img {
  filter: brightness(0.9);
}

.highlight-right-card .details {
  padding: 10px 15px;
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #ffffffde;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 60px;
}

.highlight-right-card .details h3 {
  color: #000;
  font-size: 1em;
  font-weight: 500;
  margin: 0;
}

@media screen and (max-width: 850px) {
  .highlight-left {
    width: 350px;
    height: 350px;
  }
  .highlight-right {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* ---------- Article list (horizontal cards) ---------- */
.article-list-section {
  display: flex;
  justify-content: center;
  padding: 10px 0 4em;
}

.article-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.article-card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
}

.article-card .img-container {
  position: relative;
  width: 350px;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
}

@media screen and (max-width: 650px) {
  .article-card .img-container {
    width: 100%;
  }
}

.article-card .img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.2s;
}

.article-card:hover .img-container img {
  filter: brightness(0.9);
}

.article-card .details {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  min-width: 200px;
}

.article-card h3 {
  font-size: 1.5em;
  font-weight: 600;
  margin-bottom: 20px;
  color: #000;
}

.article-card:hover h3 {
  color: var(--teal);
}

.article-card p {
  color: var(--text-muted);
}

.category-tag-wrap {
  margin-top: 10px;
}

.category-tag {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9em;
  background: var(--teal);
}

.footer-card {
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.article-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: #666;
}

/* ---------- Pagination ---------- */
.pagination {
  padding: 2em 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-link {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-body);
}

.page-link:hover {
  background: rgba(0, 0, 0, 0.06);
}

.page-link.active {
  background: var(--teal);
  color: #fff;
}

.page-link-prev,
.page-link-next {
  width: auto;
  min-width: 0;
  padding: 0 14px;
  border-radius: 16px;
}

/* ---------- Article view page ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #777;
}

.article-body {
  padding-top: 25px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.article-body .content {
  flex: 1;
  min-width: 0;
}

.article-body .right-side {
  width: 300px;
  flex-shrink: 0;
}

.article-body .right-side .ads {
  position: sticky;
  top: 90px;
  min-height: 280px;
  background: #f3f3f3;
}

@media screen and (max-width: 850px) {
  .article-body {
    flex-direction: column;
  }
  .article-body .right-side {
    width: 100%;
  }
}

.article-content {
  line-height: 1.8;
  font-size: 1.05em;
}

.article-content img {
  border-radius: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
}

.tag-item {
  padding: 4px 15px;
  border-radius: 8px;
  background: #e6fbf5;
  transition: 0.2s;
}

.tag-item:hover {
  background: #bdf3e5;
}

.related-articles {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 25px;
}

@media screen and (max-width: 850px) {
  .related-articles {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.related-article-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 1px 1px rgba(238, 238, 238, 0.65);
  transition: 0.2s;
}

.related-article-card:hover {
  box-shadow: 0 0 7px 1px #ddd;
}

.related-article-card .img-container {
  position: relative;
  height: 150px;
}

.related-article-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-article-card .details {
  flex: 1;
  padding: 10px 12px;
  color: #555;
}

.divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  margin: 20px 0;
}

/* ---------- Category / tag header strip ---------- */
.page-header-strip {
  display: flex;
  justify-content: center;
  padding: 15px 0;
}

.page-header-strip .breadcrumb {
  margin: 0;
}

.page-header-strip h1 {
  color: #000;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #141414;
  color: #fff;
}

.footer-top {
  background: var(--footer-top-bg);
  padding: 40px 0;
}

.footer-body {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.footer-col {
  flex: 1;
  min-width: 260px;
}

.footer-policy-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--teal);
}

.footer-policy-link:hover {
  color: var(--teal-mobile-active);
}

.footer-menu-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--teal);
  color: #fff;
  font-size: 0.85em;
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-bottom {
  padding: 20px 0;
  background: var(--footer-bottom-bg);
}

.footer-bottom p {
  text-align: center;
  color: #fff;
  margin: 0;
}

/* ---------- Policy popup ---------- */
.policy-popup {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #fff;
  width: 340px;
  max-width: 80%;
  padding: 20px;
  z-index: 200;
  border-radius: 16px;
  font-size: 13px;
  box-shadow: rgba(0, 0, 0, 0.12) 0 4px 8px 0, rgba(0, 0, 0, 0.08) 0 2px 4px 0;
}

.policy-popup p {
  color: var(--text-body);
  margin: 0 0 10px;
}

.policy-popup a {
  color: var(--teal);
  font-weight: 500;
}

.policy-popup-actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 8px 14px;
  border-radius: 16px;
  border: none;
  font-size: 12px;
  cursor: pointer;
}

.btn-default {
  background: #eee;
  color: #333;
}

.btn-dark {
  background: #222;
  color: #fff;
}

/* ---------- Policy page ---------- */
.policy-page {
  padding: 40px 0 60px;
}

.policy-page h1 {
  text-align: center;
  font-size: 2em;
}

.policy-page ul {
  padding-left: 20px;
}

/* ---------- Contact page ---------- */
.contact-page {
  display: flex;
  justify-content: center;
  padding: 60px 0 100px;
}

.contact-page h1 {
  font-size: 2.4em;
  font-weight: bold;
  text-align: center;
  margin-bottom: -6px;
}

.contact-page h2 {
  font-weight: 300;
  font-size: 1.1em;
  text-align: center;
  margin-top: 0;
  margin-bottom: 50px;
  letter-spacing: 4px;
  color: #17776b;
}

.contact-page h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 1.2em;
  margin-top: 30px;
  margin-bottom: 5px;
}

.contact-page a {
  color: #777;
}

.contact-page a:hover {
  color: var(--teal-mobile-active);
}

/* ---------- 404 / 410 page ---------- */
.not-found-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 20px;
}

.not-found-page h1 {
  font-size: 3em;
  color: var(--teal);
}

/* Visible to screen readers and search engines, hidden visually — used for pages (like home)
   that need a real <h1> for SEO/accessibility but whose design has no natural place to show one. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
