/* HR-LAB professional presentation layer.
   This file is intentionally last: one authoritative responsive system. */

:root { --home-gap: 14px; }

html, body { max-width: 100%; overflow-x: clip; }
body { min-width: 320px; }
.site-header, .header-shell, main, .hero-stage, .hero, .hero-grid,
.content-deck, .deck-grid, .deck-section, .system-grid, .system-card,
.article-carousel, .article-track, .article-slide, .community,
.site-footer, .footer-grid, .footer-bottom { min-width: 0; }

/* Header */
.site-header { padding: 10px 0 0; }
.header-shell {
  width: min(calc(100% - 28px), var(--page));
  min-height: 60px;
  grid-template-columns: 185px minmax(0,1fr) auto;
  gap: 14px;
  padding: 7px 11px 7px 18px;
}
.brand { width: 158px; }
.main-nav { gap: 3px; }
.main-nav a { min-width: 0; padding: 7px 12px; font-size: 11px; white-space: nowrap; }
.header-actions { gap: 6px; }
.login-button { min-width: 76px; justify-content: center; }

/* Hero and content deck share one visual stage. */
.hero-stage { padding-bottom: 16px; }
.hero-stage .hero { min-height: 252px; padding: 12px 0 6px; }
.hero-stage .hero-grid {
  min-height: 230px;
  grid-template-columns: minmax(0,1fr) minmax(400px,.82fr);
  gap: 28px;
}
.hero-copy { min-width: 0; padding: 12px 0 10px 12px; }
.hero h1 {
  width: 100%;
  max-width: 720px;
  font-size: clamp(34px,3.25vw,49px);
  line-height: 1.12;
  white-space: normal;
  text-wrap: balance;
}
.hero-copy > p {
  max-width: 700px;
  margin-top: 11px;
  font-size: 13px;
  line-height: 1.58;
  white-space: normal;
}
.hero-buttons { gap: 9px; margin-top: 15px; }
.hero-buttons .button { min-width: 146px; min-height: 39px; padding: 0 17px; font-size: 11px; }
.hero-stage .hero-visual { min-height: 130px; }
.hero-stage .hero-feature-strip { width: min(590px,100%); padding: 10px 8px; }

.hero-stage .content-deck { padding: 8px 0 0; }
.deck-grid {
  width: min(calc(100% - 28px), var(--page));
  grid-template-columns: minmax(0,7fr) minmax(280px,3fr);
  align-items: stretch;
  border-radius: 15px;
}
.deck-section { padding: 13px 14px 14px; }
.section-mini-header { min-height: 24px; margin-bottom: 9px; }
.section-mini-header h2 { font-size: 11px; }
.section-mini-header > a { font-size: 9px; }

/* Systems: equal cards, complete information, aligned actions. */
.system-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; align-items: stretch; }
.system-card {
  min-height: 205px;
  height: 100%;
  padding: 12px;
  border-radius: 13px;
}
.system-icon { width: 39px; height: 39px; margin-bottom: 8px; border-radius: 10px; }
.system-icon svg { width: 24px; height: 24px; }
.system-card h3 { font-size: 14px; }
.system-subtitle { font-size: 9px; }
.system-description {
  min-height: 3.05em;
  margin: 7px 0 10px;
  font-size: 10px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
}
.system-card-actions { width: 100%; margin-top: auto; }
.system-detail-link { padding: 5px 0; font-size: 9px; }
.small-button { min-height: 29px; padding: 0 11px; font-size: 9px; }

/* Articles */
.article-slide .article-image-link { min-height: 0; height: 165px; }
.article-track .article-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
}
.article-slide-copy { min-height: 58px; padding: 9px 11px 8px; }
.article-slide-copy h3 { font-size: 12px; }
.article-dots { min-height: 18px; padding-top: 6px; }
.perspective-preview-visual {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 25px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%,rgba(255,255,255,.18),transparent 24%),
    linear-gradient(135deg,#0e2f8f,#174ce0 58%,#2d67ef) !important;
}
.perspective-preview-visual::before {
  content: "PERSPECTIVES";
  color: rgba(255,255,255,.62);
  font-family: "Manrope",sans-serif;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .13em;
}
.perspective-preview-number {
  color: #fff;
  font-family: "Manrope",sans-serif;
  font-size: 46px;
  font-weight: 700;
  line-height: .9;
}
.perspective-preview-label {
  max-width: 80%;
  color: rgba(255,255,255,.82);
  font-family: "Manrope","Noto Sans Thai",sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .045em;
}
.perspective-preview-visual .article-tag {
  color: #12327d;
  background: #fff;
}

/* Lower page rhythm. */
.community {
  width: min(calc(100% - 28px),var(--page));
  margin-top: 22px;
  margin-bottom: 18px;
}
.footer-grid-minimal, .footer-bottom { width: min(calc(100% - 28px),var(--page)); }

/* Tablet: stack functional groups before they become cramped. */
@media (max-width: 1100px) {
  .header-shell {
    min-height: 58px;
    grid-template-columns: minmax(140px,1fr) auto auto;
    grid-template-rows: 1fr;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .main-nav { display: none; }
  .main-nav.is-open {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: color-mix(in srgb,var(--bg) 96%,transparent);
    box-shadow: var(--shadow);
  }
  .mobile-menu-button { display: block; grid-column: 3; grid-row: 1; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .header-actions .icon-button, .header-actions .login-button { display: none; }
  .hero-stage .hero-grid { grid-template-columns: 1fr; }
  .hero-stage .hero-visual { display: none; }
  .deck-grid { grid-template-columns: 1fr; }
}

/* Mobile: one deliberate layout, no inherited desktop measurements. */
@media (max-width: 760px) {
  body { min-width: 0; font-size: 13px; }
  [data-fit-text] { width: auto !important; max-width: 100% !important; }

  .site-header { padding-top: 5px; }
  .header-shell {
    width: calc(100% - 12px);
    min-height: 50px;
    grid-template-columns: minmax(92px,1fr) auto auto;
    grid-template-rows: 1fr;
    gap: 5px;
    padding: 5px 7px 5px 10px;
    border-radius: 12px;
  }
  .brand { grid-column: 1; grid-row: 1; width: 118px; max-width: 100%; }
  .header-actions { grid-column: 2; grid-row: 1; display: flex; gap: 3px; }
  .header-actions .icon-button, .header-actions .login-button { display: none; }
  .header-actions .home-lang-switch { display: flex; padding: 2px; }
  .home-lang-switch button { min-width: 24px; width: 24px; height: 24px; padding: 0; font-size: 8px; }
  .theme-toggle { width: 31px; height: 31px; flex-basis: 31px; }
  .mobile-menu-button { grid-column: 3; grid-row: 1; width: 32px; height: 32px; }
  .main-nav { top: calc(100% + 5px); padding: 8px; border-radius: 12px; }
  .main-nav.is-open { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .main-nav a { width: 100%; padding: 8px 10px; }

  .hero-stage { padding-bottom: 9px; background-position: 68% top; }
  .hero-stage::before { background: color-mix(in srgb,var(--bg) 89%,transparent); }
  .hero-stage .hero { min-height: 0; padding: 13px 0 12px; }
  .hero-stage .hero-grid { width: calc(100% - 24px); min-height: 0; }
  .hero-copy { width: 100%; padding: 5px 0 0; overflow: visible; }
  .hero h1 {
    width: 100% !important;
    max-width: 100%;
    margin: 0;
    overflow: visible;
    font-size: clamp(25px,8.3vw,34px) !important;
    line-height: 1.14;
    white-space: normal;
    text-wrap: balance;
  }
  .hero-copy > p {
    width: 100% !important;
    max-width: 100%;
    margin-top: 8px;
    overflow: visible;
    font-size: 11px !important;
    line-height: 1.5;
    white-space: normal;
  }
  .hero-buttons { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
  .hero-buttons .button { width: 100%; min-width: 0; min-height: 35px; padding: 0 7px; gap: 5px; font-size: 9px; }
  .hero-buttons .button [data-fit-text] { width: auto !important; }

  .hero-stage .content-deck { padding-top: 4px; }
  .deck-grid { width: calc(100% - 12px); border-radius: 12px; }
  .deck-section { padding: 10px 9px 11px; }
  .section-mini-header { min-height: 21px; margin-bottom: 7px; }
  .section-mini-header h2 { font-size: 11px; }
  .section-mini-header > a { font-size: 10px; }

  .system-grid { grid-template-columns: 1fr; gap: 7px; }
  .system-card {
    min-height: 0;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr);
    grid-template-rows: auto auto auto auto;
    gap: 1px 8px;
    padding: 9px 10px;
    border-radius: 10px;
  }
  .system-icon { grid-column: 1; grid-row: 1 / 4; width: 32px; height: 32px; margin: 0; border-radius: 8px; }
  .system-icon svg { width: 20px; height: 20px; }
  .system-card h3 { grid-column: 2; grid-row: 1; font-size: 14px; }
  .system-subtitle { grid-column: 2; grid-row: 2; font-size: 10px; }
  .system-description {
    grid-column: 2; grid-row: 3;
    min-height: 0; margin: 3px 0 0;
    font-size: 11px; line-height: 1.42;
    -webkit-line-clamp: 2;
  }
  .system-card-actions {
    grid-column: 1 / -1; grid-row: 4;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
  }
  .system-detail-link { margin-right: auto; padding: 5px 2px; font-size: 10px; }
  .small-button { width: auto; min-width: 82px; min-height: 30px; padding: 0 10px; gap: 5px; font-size: 10px; }
  .small-button [data-fit-text], .small-button span:first-child { display: inline-block; width: auto !important; }

  .article-slide .article-image-link { height: clamp(145px,43vw,190px); }
  .article-slide-copy { min-height: 55px; padding: 8px 9px; }
  .article-slide-copy h3 { font-size: 12px; }

  .community { width: calc(100% - 12px); margin: 13px auto 11px; border-radius: 12px; }
  .community-image, .community-copy p, .community-points span { display: none; }
  .community-copy { padding: 10px 10px 5px; text-align: center; }
  .community-copy h2 { font-size: 15px; }
  .community-points { grid-template-columns: repeat(3,1fr); }
  .community-points article { min-height: 58px; padding: 6px 3px; }
  .community-points svg { width: 22px; height: 22px; margin-bottom: 2px; }
  .community-points strong { font-size: 10px; }
  .community-button { min-height: 34px; margin: 8px auto 10px; font-size: 10px; }

  .footer-grid-minimal { width: calc(100% - 12px); grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 12px; }
  .footer-grid-minimal .footer-brand { grid-column: 1 / -1; display: grid; justify-items: center; }
  .footer-grid-minimal .footer-brand img { width: 132px; }
  .footer-motto { width: 132px; font-size: 8.5px !important; }
  .footer-grid-minimal .footer-column:nth-of-type(3) { display: none !important; }
  .footer-grid h3, .footer-links a, .contact-list a, .contact-list > span { font-size: 10px; }
  .footer-bottom { width: calc(100% - 12px); font-size: 9px; }
}

@media (max-width: 380px) {
  .brand { width: 96px; }
  .header-actions .home-lang-switch { display: flex; }
  .home-lang-switch button { min-width: 22px; width: 22px; }
  .hero-buttons { grid-template-columns: 1fr; }
  .footer-grid-minimal { grid-template-columns: 1fr; text-align: center; }
  .footer-links-inline, .footer-contact .contact-list { justify-content: center; }
}

/* Homepage vision: one integrated public-facing object with complete desktop copy. */
.vision-board {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.vision-board-card {
  width: min(560px,100%);
  overflow: hidden;
  border: 1px solid rgba(119,92,67,.16);
  border-radius: 18px;
  background: rgba(255,253,249,.86);
  box-shadow: 0 22px 52px rgba(77,60,42,.12);
  backdrop-filter: blur(16px);
}
.vision-board-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(130px,.58fr);
  gap: 16px;
  align-items: end;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(119,92,67,.13);
  background: linear-gradient(115deg,rgba(255,255,255,.82),rgba(244,235,222,.70));
}
.vision-board-head strong {
  display: block;
  color: #1e1b18;
  font: 750 14px/1.18 "Manrope","Noto Sans Thai",sans-serif;
}
.vision-board-head p {
  margin: 0;
  color: #776b60;
  font-size: 9px;
  line-height: 1.45;
  text-align: right;
}
.vision-board-list { display: grid; }
.vision-board-list article {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px 31px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 16px;
}
.vision-board-list article + article { border-top: 1px solid rgba(119,92,67,.12); }
.vision-number {
  color: #756451;
  font: 700 9px/1 "Manrope",sans-serif;
}
.vision-board-list svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #a17d53;
  stroke-width: 1.45;
}
.vision-board-list strong {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: #26211d;
  font: 750 11px/1.2 "Manrope","Noto Sans Thai",sans-serif;
}
.vision-board-list strong small {
  color: #1467c8;
  font: 700 8px/1.2 "Noto Sans Thai","Manrope",sans-serif;
}
.vision-board-list div > span {
  display: block;
  margin-top: 3px;
  color: #74695f;
  font-size: 9px;
  line-height: 1.35;
  white-space: normal;
}
html[data-theme="dark"] .vision-board-card {
  border-color: rgba(98,200,244,.19);
  background: rgba(4,18,31,.88);
  box-shadow: 0 24px 58px rgba(0,0,0,.31);
}
html[data-theme="dark"] .vision-board-head {
  border-color: rgba(98,200,244,.15);
  background: linear-gradient(115deg,rgba(9,34,56,.92),rgba(5,24,42,.84));
}
html[data-theme="dark"] .vision-board-list strong small { color: #62c8f4; }
html[data-theme="dark"] .vision-board-head strong,
html[data-theme="dark"] .vision-board-list strong { color: #f2f7fc; }
html[data-theme="dark"] .vision-board-head p,
html[data-theme="dark"] .vision-board-list div > span { color: #a8b8c8; }
html[data-theme="dark"] .vision-board-list article + article { border-color: rgba(98,200,244,.12); }
html[data-theme="dark"] .vision-board-list svg { stroke: #62c8f4; }
html[data-theme="dark"] .vision-number { color: #8da4b8; }

@media (min-width: 1101px) and (max-width: 1240px) {
  .hero-stage .hero-grid { grid-template-columns: minmax(0,1fr) minmax(380px,.75fr); gap: 20px; }
  .vision-board-head p { display: none; }
  .vision-board-head { grid-template-columns: 1fr; }
}

/* Match the homepage footer position and bottom row to every inner page. */
@media (min-width:901px) {
  body[data-page="home"] .site-footer { padding: 8px 0 10px; }
  body[data-page="home"] .footer-grid-minimal { padding-block: 10px; }
  body[data-page="home"] .footer-bottom {
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 6px;
  }
}

/* On normal desktop viewports, the whole homepage forms one complete screen. */
@media (min-width:1101px) and (min-height:850px) {
  body[data-page="home"] {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto;
    overflow: hidden;
  }
  body[data-page="home"] main {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0,1fr) auto;
    overflow: hidden;
  }
  body[data-page="home"] .hero-stage {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(220px,.9fr) minmax(245px,1.1fr);
    padding-bottom: 6px;
  }
  body[data-page="home"] .hero-stage .hero,
  body[data-page="home"] .hero-stage .hero-grid,
  body[data-page="home"] .hero-stage .content-deck {
    min-height: 0;
  }
  body[data-page="home"] .hero-stage .hero-grid,
  body[data-page="home"] .deck-grid { height: 100%; }
  body[data-page="home"] .hero-stage .content-deck { padding-top: 6px; }
  body[data-page="home"] .community {
    min-height: 118px;
    margin-top: 8px;
    margin-bottom: 6px;
  }
  body[data-page="home"] .community-image { min-height: 118px; }
  body[data-page="home"] .community-copy { padding-block: 15px; }
  body[data-page="home"] .community-points article { min-height: 84px; }
}
