@font-face {
  font-family: "Pyidaungsu";
  src: url("/fonts/Pyidaungsu/Pyidaungsu-Regular.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pyidaungsu";
  src: url("/fonts/Pyidaungsu/Pyidaungsu-Bold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #202124;
  --ink-soft: #3c4043;
  --muted: #5f6368;
  --line: #dadce0;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --accent: #1a73e8;
  --accent-deep: #174ea6;
  --accent-soft: #e8f0fe;
  --source: #174ea6;
  --shell: 720px;
  --radius: 8px;
  --font-ui: "Pyidaungsu", "Manrope", system-ui, sans-serif;
  --font-body: "Pyidaungsu", "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 17.5px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  background: var(--surface);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-bg {
  display: none;
}

.shell {
  width: min(100% - 1.5rem, var(--shell));
  margin-inline: auto;
}

/* Header — Google News style */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.gnav__top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand__name {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--muted);
  text-align: center;
}

.brand__name-accent {
  color: var(--accent);
  font-weight: 600;
}

.brand__tag {
  display: none;
}

.gnav__cats {
  background: var(--surface);
}

.gnav__cats-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.gnav__cats-track {
  display: flex;
  flex: 1;
  gap: 0;
  justify-content: safe center;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.gnav__cats-track::-webkit-scrollbar {
  display: none;
}

.cats-arrow {
  appearance: none;
  border: 0;
  flex: 0 0 36px;
  width: 36px;
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  position: relative;
}

.cats-arrow:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.cats-arrow[hidden] {
  display: none;
}

.cats-arrow--prev::after,
.cats-arrow--next::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
}

.cats-arrow--prev::after {
  left: 100%;
  background: linear-gradient(90deg, var(--surface), transparent);
}

.cats-arrow--next::before {
  right: 100%;
  background: linear-gradient(270deg, var(--surface), transparent);
}

.cat-chip {
  flex: 0 0 auto;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 12px 14px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.cat-chip:hover {
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-2);
}

.cat-chip.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.feed-heading {
  margin: 0 0 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.feed-heading--latest {
  margin-top: 8px;
}

.feed-heading__title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
}

.feed-heading__meta {
  margin: 4px 0 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Topic grid — Google News style category columns */
.topic-grid-wrap {
  margin: 0 0 28px;
}

.latest-topics.topic-grid-wrap {
  margin-bottom: 12px;
}

.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px 24px;
}

.topic-card {
  min-width: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.topic-card__heading {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.topic-card__heading a {
  color: inherit;
  text-decoration: none;
}

.topic-card__heading a:hover {
  color: var(--accent);
  text-decoration: none;
}

.topic-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-card__item + .topic-card__item {
  border-top: 1px solid var(--line);
}

.topic-card__link {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
}

.topic-card__link:hover {
  text-decoration: none;
}

.topic-card__media {
  width: 80px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
}

.topic-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topic-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* source + 3 title lines + date */
  min-height: calc(1.35em + 0.92rem * 1.5 * 3 + 1.35em);
}

.topic-card__source {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--source);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.topic-card__title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-card__link:hover .topic-card__title {
  color: var(--accent);
}

.topic-card__date {
  margin-top: 4px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
}

/* Latest news — row 1: one heading, same 3-column topic cards */
.latest-topics {
  margin-top: 0;
}

.latest-topics__heading {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.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;
}

.site-main {
  padding: 16px 0 48px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 32px;
  color: var(--muted);
  background: var(--surface);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-footer__brand {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.site-footer__links {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
}

.site-footer__links a {
  color: var(--muted);
}

.site-footer__links a:hover {
  color: var(--accent);
}

.meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  row-gap: 2px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  min-width: 0;
}

.meta__source {
  color: var(--source);
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta__dot {
  opacity: 0.7;
  flex-shrink: 0;
}

.meta time {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Lead story */
.feed-lead {
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  animation: fade 0.35s ease both;
}

.feed-lead__link {
  display: grid;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.feed-lead__link:hover {
  text-decoration: none;
}

.feed-lead__media {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
  aspect-ratio: 16 / 9;
  order: -1;
  position: relative;
}

.feed-lead__media img,
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.media-frame {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, #e8f0fe 0%, #f1f3f4 55%, #e8eaed 100%);
  flex-shrink: 0;
}

.media-frame--thumb {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
}

.media-frame--lead {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.media-frame.is-placeholder {
  display: grid;
  place-items: center;
}

.media-frame.is-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(26, 115, 232, 0.16), transparent 55%),
    linear-gradient(145deg, #e8f0fe, #f8f9fa);
}

.media-frame__fallback {
  position: relative;
  z-index: 1;
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  user-select: none;
}

.media-frame--lead .media-frame__fallback {
  font-size: 2.4rem;
}

.feed-lead__title {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 4.2vw, 1.75rem);
  line-height: 1.28;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.feed-lead__link:hover .feed-lead__title {
  color: var(--accent-deep);
}

/* Story list — text left, image right (Google News) */
.feed-list {
  display: flex;
  flex-direction: column;
}

.feed-item {
  border-bottom: 1px solid var(--line);
  animation: fade 0.4s ease both;
  animation-delay: calc(var(--i, 1) * 25ms);
}

.feed-item__link {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 16px;
  align-items: start;
  padding: 16px 0;
  text-decoration: none;
  color: inherit;
}

.feed-item__link:hover {
  text-decoration: none;
}

.feed-item__body {
  min-width: 0;
}

.feed-item__media {
  justify-self: end;
}

.feed-item__thumb {
  width: 100%;
  height: 100%;
}

.feed-item__title {
  margin: 6px 0 0;
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 400;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item__body .meta {
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 2px;
  line-height: 1.35;
  min-height: calc(1.35em * 2);
  height: auto;
  overflow: visible;
}

.feed-item__body .meta__dot {
  display: none;
}

.feed-item__link:hover .feed-item__title {
  color: var(--accent-deep);
}

.pager {
  margin-top: 16px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.latest-topics + .pager {
  margin-top: 8px;
}

.pager__btn {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.pager__btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.pager__btn--disabled {
  opacity: 0.38;
  pointer-events: none;
}

.pager__status {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  min-width: 1.75rem;
  letter-spacing: 0.02em;
}

.article {
  animation: fade 0.3s ease both;
}

.article__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.article__title {
  margin: 8px 0 0;
  font-size: clamp(1.45rem, 4.4vw, 2rem);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.article__content {
  font-size: 1.05rem;
  line-height: 1.95;
  color: var(--ink-soft);
  -webkit-user-select: none;
  user-select: none;
}

.article__content ::selection {
  background: var(--accent-soft);
}

.article__content p {
  margin: 0 0 1.25rem;
}

.article__content iframe {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 220px;
}

.article__img,
.article__content img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
  margin: 0.75rem 0 1rem;
  background: var(--surface-2);
}

.article__img-missing {
  width: 100%;
  height: 180px;
  margin: 0.75rem 0 1rem;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 30%, rgba(26, 115, 232, 0.12), transparent 55%),
    linear-gradient(145deg, #e8f0fe, #f1f3f4);
}

.article__source {
  margin: 24px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
}

.related {
  margin-top: 36px;
  padding-top: 8px;
}

.app-promo {
  margin-top: 28px;
}

.app-promo__link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.app-promo__link:hover {
  text-decoration: none;
  background: var(--surface-2);
}

.app-promo__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.app-promo__title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.app-promo__text {
  margin: 2px 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.app-promo__badge {
  width: 110px;
  height: auto;
}

.promo-wrap {
  margin-top: 8px;
}

.not-found {
  text-align: center;
  padding: 48px 0;
}

.not-found h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 400;
}

.not-found p {
  color: var(--muted);
}

.btn-link {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-ui);
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 10px 18px;
  text-decoration: none;
}

.btn-link:hover {
  background: var(--accent-deep);
  color: #fff;
  text-decoration: none;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 420px) {
  .app-promo__link {
    grid-template-columns: auto 1fr;
  }

  .app-promo__badge {
    grid-column: 1 / -1;
    justify-self: start;
    width: 120px;
  }

  .feed-item__link {
    grid-template-columns: 1fr 84px;
    gap: 12px;
  }

  .media-frame--thumb {
    width: 84px;
    height: 84px;
  }
}

@media (min-width: 640px) {
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 32px;
  }

  .topic-card {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Latest: orphan 3rd column fills full width (no empty slot before pager) */
  .latest-topics__grid > .topic-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .latest-topics__grid > .topic-card:last-child:nth-child(odd) .topic-card__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 28px;
  }

  .latest-topics__grid > .topic-card:last-child:nth-child(odd) .topic-card__item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .latest-topics__grid > .topic-card:last-child:nth-child(odd) .topic-card__body {
    min-height: calc(1.35em + 0.92rem * 1.5 * 3 + 1.35em);
  }

  /* Category: odd leftover → full-width horizontal strip */
  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px 16px;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__item + .topic-card__item {
    border-top: none;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__link {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__media {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__title {
    font-size: 0.88rem;
    font-weight: 500;
    -webkit-line-clamp: 3;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__body {
    min-height: 0;
  }
}

@media (min-width: 768px) {
  :root {
    --shell: 780px;
  }

  .site-main {
    padding-top: 24px;
  }

  .feed-lead__link {
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    align-items: center;
  }

  .feed-lead__media {
    order: 2;
  }

  .feed-lead__body {
    order: 1;
  }

  .feed-item__link {
    grid-template-columns: 1fr 120px;
    gap: 20px;
    padding: 18px 0;
  }

  .media-frame--thumb {
    width: 120px;
    height: 120px;
  }

  .feed-item__title {
    font-size: 1.15rem;
  }

  .article__content {
    font-size: 1.08rem;
    line-height: 1.85;
  }

  .article__title {
    line-height: 1.4;
  }
}

@media (min-width: 980px) {
  :root {
    --shell: 1100px;
  }

  .topic-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px 36px;
  }

  /* Reset 2-col leftover rules */
  .latest-topics__grid > .topic-card:last-child:nth-child(odd),
  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .latest-topics__grid > .topic-card:last-child:nth-child(odd) .topic-card__list,
  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__list {
    display: block;
  }

  .latest-topics__grid > .topic-card:last-child:nth-child(odd) .topic-card__item:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__item + .topic-card__item {
    border-top: 1px solid var(--line);
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__link {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 10px;
    padding: 10px 0;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__media {
    width: 80px;
    height: 80px;
    aspect-ratio: auto;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__title {
    font-size: 0.92rem;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:last-child:nth-child(odd) .topic-card__body {
    min-height: calc(1.35em + 0.92rem * 1.5 * 3 + 1.35em);
  }

  /* 4th of 7 (အားကစား) alone on row 2 → full-width strip of 5 stories */
  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) {
    grid-column: 1 / -1;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 18px;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__item + .topic-card__item {
    border-top: none;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__link {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__media {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__title {
    font-size: 0.9rem;
    font-weight: 500;
    -webkit-line-clamp: 3;
  }

  .topic-grid:not(.latest-topics__grid) > .topic-card:nth-child(4):nth-last-child(4) .topic-card__body {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
