/* ===========================================================
   បច្ចេកវិទ្យាខ្មែរ — Khmer Technology
   Aesthetic: editorial tech magazine. Warm off-white base,
   deep ink for body, saffron/khmer-temple gold as the signature
   accent. Designed for long-form Khmer reading.
   =========================================================== */

:root {
  /* palette — warm editorial */
  --bg:        #faf8f3;       /* warm off-white */
  --bg-alt:    #f2efe6;       /* slightly deeper */
  --bg-dark:   #1a1817;       /* deep ink for inverted sections */
  --bg-darker: #100f0e;
  --ink:       #1a1817;
  --ink-soft:  #4a4744;
  --ink-dim:   #8a857d;
  --rule:      #e2ddd1;
  --rule-dark: #2a2724;

  /* accents */
  --gold:      #c8932b;       /* khmer temple gold — the signature */
  --gold-soft: #e8b94a;
  --red:       #b8412e;       /* secondary, used sparingly */
  --green:     #4a7c3e;

  /* type */
  --khmer: 'Kantumruy Pro', 'Noto Sans Khmer', system-ui, sans-serif;
  --sans:  'Inter', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  /* layout */
  --max:   1280px;
  --pad:   clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--khmer);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ========== HEADER ========== */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(250, 248, 243, 0.92);
}
.header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--pad);
  display: flex; align-items: center; gap: 32px;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo__mark {
  font-family: var(--khmer);
  font-size: 32px;
  color: var(--gold);
  line-height: 1;
}
.logo__text { display: flex; flex-direction: column; line-height: 1.1; }
.logo__km {
  font-family: var(--khmer);
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.logo__en {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav { display: flex; gap: 24px; margin-left: auto; }
.nav__link {
  font-family: var(--khmer);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink-soft);
  padding: 6px 0;
  position: relative;
  transition: color .2s;
}
.nav__link::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--gold);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s;
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover::after { transform: scaleX(1); }

.header__actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  padding: 8px 14px;
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--gold); }
.lang-toggle__active { color: var(--gold); font-weight: 700; }
.lang-toggle__sep { color: var(--ink-dim); margin: 0 6px; }

/* ========== TICKER ========== */
.ticker {
  background: var(--bg-dark);
  color: #e6e3dd;
  overflow: hidden;
}
.ticker__inner {
  max-width: var(--max); margin: 0 auto;
  padding: 12px var(--pad);
  display: flex; align-items: center; gap: 20px;
  white-space: nowrap;
  font-size: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ticker__inner::-webkit-scrollbar { display: none; }
.ticker__label {
  font-family: var(--mono); font-size: 11px;
  background: var(--gold); color: var(--bg-darker);
  padding: 4px 10px;
  font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  flex-shrink: 0;
}
.ticker__item { color: #d8d4cd; }
.ticker__dot { color: var(--gold); font-size: 10px; }

/* ========== HERO ========== */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--pad);
  border-bottom: 1px solid var(--rule);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 60px;
}

.kicker {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 14px;
}
.kicker--featured {
  background: var(--gold);
  color: var(--bg-dark);
  padding: 4px 12px;
}
.kicker--accent { color: var(--gold-soft); }

.hero__title {
  font-family: var(--khmer);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
}
.hl {
  color: var(--gold);
  background: linear-gradient(transparent 70%, rgba(200,147,43,0.18) 70%);
  padding: 0 4px;
}
.hero__deck {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--ink-soft);
  max-width: 580px;
  margin-bottom: 24px;
  line-height: 1.7;
}
.hero__meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-dim);
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 28px;
}
.byline strong { color: var(--ink); font-weight: 600; }
.dot-sep { color: var(--rule); }

.hero__cta {
  display: inline-block;
  font-family: var(--khmer); font-weight: 700;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--bg);
  transition: background .2s, transform .15s;
  font-size: 15px;
}
.hero__cta:hover { background: var(--gold); color: var(--bg-dark); transform: translateY(-2px); }

/* hero side */
.hero__side {
  display: flex; flex-direction: column;
  gap: 24px;
  border-left: 1px solid var(--rule);
  padding-left: 40px;
}
.side-story {
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--rule);
  cursor: pointer;
}
.side-story:last-child { border-bottom: none; padding-bottom: 0; }
.side-story h3 {
  font-family: var(--khmer);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.35;
  margin-bottom: 8px;
  transition: color .2s;
}
.side-story:hover h3 { color: var(--gold); }
.side-story__meta {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

/* ========== GENERIC SECTION ========== */
.section {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(60px, 8vw, 100px) var(--pad);
  border-bottom: 1px solid var(--rule);
}
.section__head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 50px;
  flex-wrap: wrap; gap: 20px;
}
.eyebrow {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.eyebrow--light { color: var(--gold-soft); }
.section__title {
  font-family: var(--khmer);
  font-weight: 800;
  font-size: clamp(28px, 3.5vw, 42px);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.section__title--light { color: var(--bg); }
.section__more {
  font-family: var(--mono); font-size: 13px;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
  letter-spacing: 0.05em;
  transition: color .2s, border-color .2s;
}
.section__more:hover { color: var(--ink); border-color: var(--ink); }
.section__more--light { color: var(--gold-soft); border-color: var(--gold-soft); }
.section__more--light:hover { color: var(--bg); border-color: var(--bg); }

/* ========== CARDS GRID ========== */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}
.card {
  background: var(--bg);
  border: 1px solid var(--rule);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(26,24,23,0.08);
  border-color: var(--gold);
}
.card__img {
  height: 200px;
  position: relative;
  background: linear-gradient(135deg, #d4c8a8, #9c8456);
}
.card__img--1 { background: linear-gradient(135deg, #2a3a5c, #1a2438); }
.card__img--2 { background: linear-gradient(135deg, #5c4d3a, #3a3024); }
.card__img--3 { background: linear-gradient(135deg, #1a3a2a, #0e2418); }
.card__img--4 { background: linear-gradient(135deg, #5c2a3a, #3a1828); }
.card__img--5 { background: linear-gradient(135deg, #3a2a5c, #241838); }
.card__img--6 { background: linear-gradient(135deg, #5c4a2a, #3a2e18); }
.card__img::after {
  /* subtle pattern overlay */
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.15) 0%, transparent 50%);
}
.card__tag {
  position: absolute; top: 16px; left: 16px;
  background: rgba(0,0,0,0.55);
  color: var(--gold-soft);
  font-family: var(--mono); font-size: 11px;
  padding: 5px 11px;
  letter-spacing: 0.06em;
  font-weight: 600;
  backdrop-filter: blur(4px);
  z-index: 1;
}
.card__body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.card__title {
  font-family: var(--khmer);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 12px;
  transition: color .2s;
}
.card:hover .card__title { color: var(--gold); }
.card__excerpt {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 18px;
  line-height: 1.6;
  flex: 1;
}
.card__meta {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim);
  display: flex; gap: 8px;
  letter-spacing: 0.04em;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

/* ========== GUIDES (inverted) ========== */
.guides {
  background: var(--bg-dark);
  color: #e6e3dd;
  position: relative;
  overflow: hidden;
}
.guides::before {
  /* decorative khmer-pattern hint */
  content: '';
  position: absolute; right: -100px; top: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(200,147,43,0.08), transparent 70%);
  pointer-events: none;
}
.guides__inner {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(60px, 8vw, 100px) var(--pad);
  position: relative; z-index: 1;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--rule-dark);
}
.guide {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 24px 28px;
  border: 1px solid var(--rule-dark);
  margin: -1px;
  background: var(--bg-dark);
  transition: background .2s;
  cursor: pointer;
}
.guide:hover { background: var(--bg-darker); }
.guide:hover h3 { color: var(--gold); }
.guide__num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  font-feature-settings: "tnum";
}
.guide__body h3 {
  font-family: var(--khmer);
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 4px;
  transition: color .2s;
}
.guide__body p {
  font-size: 13px;
  color: #a8a39a;
}
.guide__time {
  font-family: var(--mono); font-size: 11px;
  color: var(--gold-soft);
  letter-spacing: 0.06em;
  border: 1px solid var(--rule-dark);
  padding: 4px 10px;
  white-space: nowrap;
}

/* ========== REVIEWS ========== */
.reviews {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
}

.review-big {
  background: var(--bg);
  border: 1px solid var(--rule);
}
.review-big__img {
  height: 320px;
  background: linear-gradient(135deg, #4a4035, #2a2419);
  position: relative;
}
.score-badge {
  position: absolute;
  top: 20px; right: 20px;
  background: var(--gold);
  color: var(--bg-dark);
  padding: 12px 18px;
  font-family: var(--mono);
  font-weight: 700;
  display: flex; align-items: baseline; gap: 4px;
}
.score-badge__num { font-size: 28px; }
.score-badge__label { font-size: 13px; opacity: 0.7; }
.review-big__body { padding: 32px; }
.review-big__title {
  font-family: var(--khmer);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.3;
  margin-bottom: 14px;
}
.review-big__excerpt {
  color: var(--ink-soft);
  margin-bottom: 24px;
  line-height: 1.7;
}
.review-big__specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.review-big__specs div {
  display: flex; flex-direction: column; gap: 4px;
}
.review-big__specs dt {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.review-big__specs dd {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
}

.review-small-list {
  display: flex; flex-direction: column;
  gap: 0;
  border: 1px solid var(--rule);
}
.review-small {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--rule);
  align-items: center;
  cursor: pointer;
  transition: background .15s;
}
.review-small:last-child { border-bottom: none; }
.review-small:hover { background: var(--bg-alt); }
.mini-score {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  color: var(--gold);
  background: var(--bg-alt);
  padding: 10px 14px;
  min-width: 64px;
  text-align: center;
}
.review-small h4 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}
.review-small p {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ========== TOPICS ========== */
.topics {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(60px, 8vw, 100px) var(--pad);
  border-bottom: 1px solid var(--rule);
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.topic {
  background: var(--bg);
  padding: 32px 24px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-start;
  transition: background .2s, transform .2s;
  cursor: pointer;
}
.topic:hover {
  background: var(--bg-alt);
}
.topic:hover .topic__icon { color: var(--gold); transform: scale(1.1); }
.topic__icon {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  transition: color .2s, transform .2s;
}
.topic h3 {
  font-family: var(--khmer);
  font-weight: 700;
  font-size: 18px;
}
.topic__count {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

/* ========== NEWSLETTER ========== */
.newsletter {
  background: var(--gold);
  color: var(--bg-dark);
}
.newsletter__inner {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(50px, 7vw, 80px) var(--pad);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 50px;
  align-items: center;
}
.newsletter h2 {
  font-family: var(--khmer);
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.4;
  margin-bottom: 12px;
}
.newsletter p {
  font-size: 14px;
  color: rgba(26,24,23,0.75);
}
.newsletter__form {
  display: flex; gap: 0;
  background: var(--bg-dark);
  padding: 6px;
}
.newsletter__form input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 16px;
  font-family: var(--khmer);
  font-size: 15px;
  color: var(--bg);
  outline: none;
}
.newsletter__form input::placeholder { color: var(--ink-dim); }
.newsletter__form button {
  background: var(--gold);
  color: var(--bg-dark);
  border: none;
  padding: 14px 22px;
  font-family: var(--khmer); font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .2s;
}
.newsletter__form button:hover { background: var(--gold-soft); }

/* ========== ABOUT ========== */
.about {
  background: var(--bg-alt);
}
.about__inner {
  max-width: 900px; margin: 0 auto;
  padding: clamp(60px, 8vw, 100px) var(--pad);
  text-align: center;
}
.about__lead {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-soft);
  line-height: 1.8;
  margin: 24px 0 50px;
}
.about__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}
.about__stat-num {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(24px, 3vw, 36px);
  color: var(--gold);
  margin-bottom: 6px;
}
.about__stat-label {
  font-family: var(--khmer);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ========== FOOTER ========== */
.footer {
  background: var(--bg-darker);
  color: #c8c4bc;
}
.footer__inner {
  max-width: var(--max); margin: 0 auto;
  padding: 60px var(--pad) 40px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer__col { display: flex; flex-direction: column; gap: 10px; }
.footer__col--brand p {
  font-size: 14px;
  color: #8a857d;
  max-width: 280px;
  margin-top: 12px;
  line-height: 1.6;
}
.footer__col--brand .logo__km { color: #e6e3dd; }
.footer__col h4 {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.footer__col a {
  font-size: 14px;
  color: #c8c4bc;
  padding: 3px 0;
  transition: color .2s;
}
.footer__col a:hover { color: var(--gold); }

.footer__bottom {
  max-width: var(--max); margin: 0 auto;
  padding: 24px var(--pad);
  border-top: 1px solid var(--rule-dark);
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 12px;
  color: #6a655c;
  letter-spacing: 0.04em;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-list { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__side { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 40px; }
  .reviews { grid-template-columns: 1fr; }
  .newsletter__inner { grid-template-columns: 1fr; gap: 30px; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .nav { display: none; }
  .header__inner { gap: 16px; }
  .cards { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .about__stats { grid-template-columns: 1fr 1fr; gap: 20px; }
  .footer__inner { grid-template-columns: 1fr; }
  .footer__bottom { flex-direction: column; gap: 8px; text-align: left; }
  .newsletter__form { flex-direction: column; padding: 8px; gap: 8px; }
  .newsletter__form button { width: 100%; }
  .review-big__specs { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .topic-grid { grid-template-columns: 1fr; }
}

/* a11y */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
