/* ===========================
   SWOJ Khmer — Shared Styles
   Cambodia flag palette:
     Blue  #032EA1
     Red   #CC0001
     White #FFFFFF
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Khmer:wght@300;400;600;700&family=Noto+Sans:ital,wght@0,300;0,400;0,600;1,300&display=swap');

:root {
  --blue:       #032EA1;
  --blue-dark:  #021e70;
  --blue-light: #e8eeff;
  --red:        #CC0001;
  --red-dark:   #a30001;
  --white:      #ffffff;
  --off-white:  #f7f8fc;
  --text:       #1a1a2e;
  --text-muted: #5a607a;
  --radius:     10px;
  --shadow-sm:  0 2px 8px rgba(3,46,161,0.10);
  --shadow-md:  0 6px 24px rgba(3,46,161,0.18);
  --shadow-lg:  0 12px 40px rgba(3,46,161,0.22);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── HERO / INDEX ─────────────────────────────── */

.hero {
  min-height: 100svh;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero-content { max-width: 860px; }
  .hero-desc { max-width: 860px; }
}

/* subtle flag-stripe accent */
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--red);
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 6px;
  background: var(--red);
}

.hero-content {
  text-align: center;
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  width: min(480px, 90vw);
  height: auto;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.35));
}

.greeting-km {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.57rem, 5.5vw, 2.17rem);
  font-weight: 400;
  color: var(--blue);
  line-height: 1.5;
}

.greeting-en {
  font-size: clamp(0.95rem, 2.8vw, 1.12rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-desc {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.02rem, 2.4vw, 1.15rem);
  color: var(--text);
  line-height: 1.75;
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-desc-intro,
.hero-desc-closing {
  text-align: center;
}

.goals-list {
  list-style: disc;
  padding-left: 1.5rem;
  text-align: left;
  width: 100%;
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.02rem, 2.4vw, 1.15rem);
  color: var(--text);
  line-height: 1.75;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.activities-heading {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: var(--blue);
  text-align: center;
}

.activity-body p + p {
  margin-top: 0.75rem;
}

.activity-sub-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.activity-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-header {
  background: var(--blue-light);
  color: var(--blue);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  text-align: center;
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.05rem, 2.5vw, 1.17rem);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.activity-body {
  text-align: left;
  padding: 0 0.25rem;
}

body.lang-en .activity-header {
  font-family: 'Noto Sans', sans-serif;
}

body.lang-en .activity-body {
  font-family: 'Noto Sans', sans-serif;
}

body.lang-en .hero-desc-intro,
body.lang-en .hero-desc-closing {
  font-family: 'Noto Sans', sans-serif;
}

body.lang-en .goals-list,
body.lang-en .activities-heading,
body.lang-en .activity-sub-list {
  font-family: 'Noto Sans', sans-serif;
}

body.lang-en .activity-body p {
  font-family: 'Noto Sans', sans-serif;
}

.hero-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.hero-social a {
  display: inline-flex;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.hero-social a:hover {
  opacity: 1;
}

.scroll-hint {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: nudge 2.2s ease-in-out infinite;
}

.scroll-hint svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0);   opacity: .5; }
  50%       { transform: translateY(6px); opacity: .85; }
}

/* ─── RED ACCENT STRIPE (resources + social pages) ─ */

.resources-main {
  border-top: 6px solid var(--red);
}

/* ─── PAGE INTRO (resources + social pages) ───── */

.page-intro {
  max-width: 860px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
}

.page-intro .activity-body p,
.page-intro .activity-sub-list li {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.02rem, 2.4vw, 1.15rem);
  line-height: 1.75;
  color: var(--text);
}

body.lang-en .page-intro .activity-body p,
body.lang-en .page-intro .activity-sub-list li {
  font-family: 'Noto Sans', sans-serif;
}

/* ─── RESOURCES SECTION (INDEX) ───────────────── */

.resources-section {
  padding: 2.5rem 1rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.section-title {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.37rem, 4vw, 1.77rem);
  color: var(--blue);
  font-weight: 600;
}

.section-subtitle {
  font-size: 1.02rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

/* Grid: 2 cols on mobile, 3 on tablet, 4 on desktop */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  align-items: start;
}

@media (min-width: 580px) {
  .resources-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .resources-grid { grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
}

.resource-card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  background: var(--off-white);
  /* transition for desktop hover */
  transition: transform var(--transition), box-shadow var(--transition);
}

.resource-card img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition);
}

/* Desktop-only hover: grow card */
@media (hover: hover) and (pointer: fine) {
  .resource-card:hover {
    transform: scale(1.07);
    box-shadow: var(--shadow-lg);
    z-index: 2;
  }
}

/* Touch active feedback */
.resource-card:active {
  transform: scale(0.96);
}

/* ─── FOOTER ───────────────────────────────────── */

.site-footer {
  background: var(--blue);
  text-align: center;
  padding: 1.25rem 1rem;
}

.footer-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
}

.footer-icons a {
  display: inline-flex;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.footer-icons a:hover {
  opacity: 1;
}


/* ─── AUDIO TABLE ───────────────────────────────── */

.audio-section {
  width: 100%;
}

.audio-section-title {
  font-size: 1.11rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  padding: 2rem 1rem 0.75rem;
}

body.lang-km .audio-section-title {
  font-family: 'Noto Serif Khmer', serif;
}

.audio-table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(3,46,161,0.12);
}

.audio-table {
  width: 100%;
  border-collapse: collapse;
}

.audio-table tr {
  border-bottom: 1px solid rgba(3,46,161,0.08);
  transition: background var(--transition);
}

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

.audio-table tr:nth-child(odd) {
  background: var(--off-white);
}

.audio-table tr:nth-child(even) {
  background: var(--white);
}

.audio-table tr:hover {
  background: var(--blue-light);
}

.audio-name {
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  font-family: 'Noto Serif Khmer', serif;
  color: var(--text);
  font-size: 1.12rem;
  vertical-align: middle;
  line-height: 1.4;
}

body.lang-en .audio-name {
  font-family: 'Noto Sans', sans-serif;
}

.audio-action {
  padding: 0.45rem 0.75rem;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

.btn-sm {
  padding: 0.38rem 0.8rem;
  font-size: 0.97rem;
  width: auto;
  gap: 0.3rem;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

/* ─── RESOURCE DETAIL PAGE ─────────────────────── */

.resource-page-header {
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--white);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.9;
  transition: opacity 0.15s;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.back-btn:hover,
.back-btn:focus {
  opacity: 1;
  background: rgba(255,255,255,0.12);
}

.back-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.header-logo-mini {
  height: 32px;
  width: auto;
  opacity: 0.88;
}

.resource-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}

.resource-cover-wrap {
  text-align: center;
  margin-bottom: 1.75rem;
}

.resource-cover {
  max-width: min(320px, 80vw);
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: inline-block;
}

.resource-title {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.27rem, 4vw, 1.62rem);
  font-weight: 600;
  color: var(--blue);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.resource-description {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.12rem, 3vw, 1.22rem);
  color: var(--text);
  line-height: 1.85;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--off-white);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.resource-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
  font-size: 1.17rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-align: center;
  width: 100%;
  letter-spacing: 0.02em;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 3px 12px rgba(204,0,1,0.3);
}

.btn-primary:hover {
  background: var(--red-dark);
  box-shadow: 0 5px 18px rgba(204,0,1,0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: var(--blue-light);
  color: var(--blue);
  border: 2px solid rgba(3,46,161,0.18);
}

.btn-secondary:hover {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

/* ─── LANGUAGE TOGGLE ──────────────────────────── */

.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.lang-toggle {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.35);
  color: var(--white);
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.91rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.4;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.lang-toggle:hover {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.6);
}

.lang-sep {
  opacity: 0.45;
  font-weight: 300;
}

.lang-toggle[data-current="km"] .lang-km-label { opacity: 1;    font-weight: 700; }
.lang-toggle[data-current="km"] .lang-en-label { opacity: 0.45; font-weight: 400; }
.lang-toggle[data-current="en"] .lang-en-label { opacity: 1;    font-weight: 700; }
.lang-toggle[data-current="en"] .lang-km-label { opacity: 0.45; font-weight: 400; }

/* Hero: position toggle button in top-right corner */
.lang-toggle-hero {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
}

/* Hide the Khmer subtitle when in English mode */
body.lang-en .greeting-en { display: none; }

/* Switch to latin font in English mode for Khmer-font elements */
body.lang-en .resource-title,
body.lang-en .resource-description,
body.lang-en .greeting-km,
body.lang-en .section-title,
body.lang-en .hero-desc {
  font-family: 'Noto Sans', sans-serif;
}

/* ─── RESPONSIVE TWEAKS ─────────────────────────── */

@media (min-width: 600px) {
  .resource-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .btn {
    width: auto;
    flex: 1 1 200px;
  }
}

/* ─── RESOURCE PAGE NAV ARROWS (FAB) ───────────── */

.resource-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.resource-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.resource-nav-arrow svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .resource-nav-arrow:hover {
    background: var(--blue-dark);
    box-shadow: var(--shadow-lg);
    transform: scale(1.08);
  }
}

.resource-nav-arrow:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

.resource-nav-arrow:active {
  background: var(--blue-dark);
  box-shadow: var(--shadow-sm);
  transform: scale(0.93);
}

/* ─── SITE NAV ──────────────────────────────────── */

.site-nav {
  background: var(--blue);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  flex-shrink: 0;
  line-height: 0;
}

.nav-logo img {
  height: 32px;
  width: auto;
  opacity: 0.92;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.2rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  display: block;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-family: 'Noto Serif Khmer', serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.38rem 0.85rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.14);
  color: var(--white);
}

.nav-link.active {
  background: rgba(255,255,255,0.18);
  color: var(--white);
}

body.lang-en .nav-link {
  font-family: 'Noto Sans', sans-serif;
  letter-spacing: 0.08em;
}

/* ─── SOCIAL MEDIA PAGE ──────────────────────────── */

.social-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

.social-page-title {
  font-family: 'Noto Serif Khmer', serif;
  font-size: clamp(1.37rem, 4vw, 1.77rem);
  color: var(--blue);
  font-weight: 600;
  text-align: center;
  margin-bottom: 2rem;
}

body.lang-en .social-page-title {
  font-family: 'Noto Sans', sans-serif;
}

.social-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.5rem;
  border-radius: var(--radius);
  background: var(--off-white);
  border: 1.5px solid rgba(3,46,161,0.1);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

@media (hover: hover) and (pointer: fine) {
  .social-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(3,46,161,0.25);
  }
}

.social-card:active {
  transform: scale(0.98);
}

.social-card-icon {
  flex-shrink: 0;
  line-height: 0;
}

.social-card-body {
  flex: 1;
}

.social-card-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--blue);
  margin-bottom: 0.15rem;
}

.social-card-handle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ─── PAGE TRANSITIONS ─────────────────────────── */

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes page-leave {
  to { opacity: 0; transform: translateY(-6px); }
}

body {
  animation: page-enter 0.28s ease-out both;
}

body.page-leaving {
  animation: page-leave 0.22s ease-in forwards;
  pointer-events: none;
}
