/* One type family (Noto Sans and its sister fonts for non-Latin scripts), flat colors only — no gradients. */

/* Noto Sans, self-hosted (SIL Open Font License); variable weight 400–700, split by script. */
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-devanagari.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-greek-ext.woff2") format("woff2");
  unicode-range: U+1F00-1FFF;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-greek.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/noto-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Always the dark theme, whatever the device's setting. */
  color-scheme: dark;
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-2: #1C1C1E;
  --border: #27272A;
  --border-strong: #3F3F46;
  --text: #FAFAFA;
  --muted: #A1A1AA;
  --primary: #FAFAFA;
  --on-primary: #0A0A0A;
  --error: #F87171;
  --error-bg: #1F1212;
  --pattern: #222225;

  --radius: 14px;
  --radius-sm: 10px;
  --font-script: "Noto Sans";
  --font: "Noto Sans", var(--font-script), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --header-h: calc(65px + env(safe-area-inset-top));
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}


body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Form controls don't inherit the page font by default on Android/iOS/Windows. */
button, input, select, textarea, summary { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; }
img, svg { display: block; }
a { color: inherit; }
strong { font-weight: 600; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; inset-inline-start: 12px; top: -48px; z-index: 20;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary); text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.container.narrow { max-width: 860px; }
/* Same page width as ineedbarcode.vercel.app: max 1440px, 16px side padding on phones, 32px from 768px. */
@media (min-width: 768px) {
  :root { --gutter: max(32px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .container.narrow { max-width: calc(860px + 2 * var(--gutter)); }
}

/* ---------- header ---------- */
.header {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
/* Three columns with equal sides, so the nav sits exactly in the middle of the bar. */
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; height: 64px; }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 9px; background: var(--primary); color: var(--on-primary);
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
/* Page marker: the section currently on screen (home) or the current page (articles). */
.nav a[aria-current] { color: var(--text); background: var(--surface-2); font-weight: 600; }

/* ---------- language picker (dropdown, same layout as ineedbarcode.vercel.app) ---------- */
.lang-picker { position: relative; justify-self: end; }
.lang-button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.lang-button:hover, .lang-button[aria-expanded="true"] { border-color: var(--text); }
.lang-button .chev {
  width: 12px; height: 8px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s;
}
.lang-button[aria-expanded="true"] .chev { transform: rotate(180deg); }
.flag {
  width: 20px; height: 15px; flex: none; border-radius: 2px; object-fit: cover;
  outline: 1px solid var(--border); outline-offset: -1px;
}

.lang-panel {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 50;
  width: 300px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.lang-panel[hidden] { display: none; }
.lang-search-wrap { padding: 8px; border-bottom: 1px solid var(--border); }
.lang-search {
  width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); font-size: 16px; outline: 0;
  -webkit-appearance: none; appearance: none;
}
.lang-search:focus { border-color: var(--text); }
.lang-list { max-height: min(420px, 55vh); overflow-y: auto; overscroll-behavior: contain; padding: 0 0 4px; }
.lang-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 8px 14px;
  border: 0; background: transparent; color: var(--text);
  font-size: 15px; text-align: start; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.lang-option.active { background: var(--surface-2); }
.lang-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-option[aria-selected="true"] { font-weight: 700; }
.lang-option[aria-selected="true"]::after {
  content: ""; flex: none; width: 6px; height: 11px; margin-inline-end: 4px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.lang-empty { padding: 16px; color: var(--muted); font-size: 14px; text-align: center; }
.lang-empty[hidden] { display: none; }

/* Small laptops / landscape tablets: the centred navbar menu needs the room, so show the flag only. */
@media (min-width: 1024px) and (max-width: 1199px) {
  .lang-name { display: none; }
  .nav a { padding-inline: 6px; }
}

/* Phones: flag + chevron only, and the list spans the screen width. */
@media (max-width: 479px) {
  .lang-name { display: none; }
  .lang-picker { position: static; }
  .lang-panel { inset-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); width: auto; max-width: none; }
}

/* ---------- section background: flat dot pattern (SVG mask tinted with --pattern). Each tile has its dot in the
   middle and tiles are rounded to fit the section, so dots sit 12px either side of every divider. ---------- */
.pattern-dots { position: relative; isolation: isolate; }
.pattern-dots::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-color: var(--pattern);
  -webkit-mask-repeat: round; mask-repeat: round; /* whole tiles only: dots sit 12px from every edge */
}
.pattern-dots::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='1.5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='1.5'/%3E%3C/svg%3E"); }

/* ---------- full-screen sections (desktop and tablet) ---------- */
.screen {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: flex; flex-direction: column; justify-content: center;
}

/* ---------- hero ---------- */
.hero { padding: 48px 0; text-align: center; }
h1 {
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lead {
  max-width: 720px; margin: 16px auto 0;
  color: var(--muted); font-size: clamp(16px, 2.2vw, 18px);
  text-wrap: pretty;
}

.search { display: flex; gap: 10px; margin-top: 32px; }
.field {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.field:focus-within { border-color: var(--text); }
.field-icon { flex: none; margin-inline-start: 16px; color: var(--muted); }
.field input {
  flex: 1; min-width: 0; height: 100%;
  padding: 0; padding-inline: 12px 8px;
  border: 0; outline: 0; background: transparent;
  font-size: 16px; /* >=16px stops iOS Safari from zooming on focus */
  -webkit-appearance: none; appearance: none;
  border-radius: 0;
}
.field input::placeholder { color: var(--muted); opacity: 1; }
.field-action {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 40px; min-width: 40px; margin-inline-end: 8px; padding: 0 12px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.field-action:hover { background: var(--border); }
.field-action[hidden] { display: none; }
#clear { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 16px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
  transition: opacity .15s, background-color .15s, border-color .15s;
}
.btn-primary { height: 56px; padding: 0 28px; background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { cursor: wait; opacity: .7; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--text); }

.spinner {
  display: none; width: 18px; height: 18px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.is-loading .spinner { display: block; }
.is-loading .btn-label { display: none; }
.btn.is-busy { cursor: progress; }
.btn.is-busy .spinner { display: block; width: 16px; height: 16px; }
.btn.is-busy > svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 24px; padding: 0; list-style: none;
}
.chips li {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500;
}

/* ---------- results ---------- */
.results { display: grid; gap: 16px; margin-top: 32px; text-align: start; }
.results[hidden] { display: none; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.results-head h2 { font-size: 18px; }
.results-head span { color: var(--muted); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.result { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 20px; }
.result-media { min-width: 0; }
.thumb {
  position: relative; overflow: hidden;
  aspect-ratio: var(--ratio, 1); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
}
.badge {
  position: absolute; inset-inline-start: 8px; bottom: 8px;
  padding: 2px 8px; border-radius: 6px;
  background: var(--primary); color: var(--on-primary);
  font-size: 12px; font-weight: 600;
}
.result-body { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.result-title {
  font-size: 17px; font-weight: 600; line-height: 1.4;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.result-meta { margin-top: 4px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

.group-title {
  margin-bottom: 8px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.options { display: grid; gap: 8px; padding: 0; list-style: none; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 8px; padding-inline: 16px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.option-info { min-width: 0; }
.option-quality { font-weight: 600; font-size: 15px; }
.option-detail { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.option .btn { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: var(--radius-sm); flex: none; }

.more {
  justify-self: start; margin-top: -4px; padding: 6px 0;
  border: 0; background: none; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.more:hover { color: var(--text); }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--error); background: var(--error-bg); color: var(--error);
  font-size: 15px; font-weight: 500;
}
.alert svg { flex: none; margin-top: 2px; }

/* skeleton */
.skeleton .thumb, .sk { animation: pulse 1.4s ease-in-out infinite; }
.sk { height: 14px; border-radius: 6px; background: var(--surface-2); }
.sk-title { height: 20px; width: 80%; }
.sk-line { width: 40%; }
.sk-row { height: 60px; border-radius: var(--radius-sm); }
.loading-text { color: var(--muted); font-size: 14px; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- sections ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--border); }
.section h2 { font-size: clamp(22px, 4vw, 28px); font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.section-lead { max-width: 760px; margin: 8px auto 0; color: var(--muted); text-align: center; }

.steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  max-width: 1100px; margin: 32px auto 0; padding: 0; list-style: none;
}
.step { padding: 24px; }
.step-num {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 16px;
  border-radius: 10px; background: var(--primary); color: var(--on-primary);
  font-weight: 700;
}
.step h3 { font-size: 17px; font-weight: 600; }
.step p { margin-top: 6px; color: var(--muted); font-size: 15px; }

.platforms {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px;
  margin-top: 32px; padding: 0; list-style: none;
}
.platforms li {
  display: grid; place-items: center; min-height: 52px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 15px; font-weight: 500; text-align: center;
}

.faq { display: grid; gap: 10px; margin-top: 32px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 12px 16px;
  font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-inline-end: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq details p { padding: 0 16px 16px; color: var(--muted); }

/* ---------- article cards (home carousel, /artikel/, related) ---------- */
.article-card {
  height: 100%; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.article-card:hover { border-color: var(--text); transform: translateY(-2px); }
.article-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.article-thumb { aspect-ratio: 1200 / 630; background: var(--surface-2); overflow: hidden; }
.article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 18px 20px 20px; text-align: start; }
.article-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.article-tags span {
  padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.article-title { font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; text-align: start; }
.article-excerpt {
  color: var(--muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.article-meta { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; color: var(--muted); font-size: 13px; }
.article-more { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
[dir="rtl"] .article-more svg { transform: scaleX(-1); }

.article-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
  margin-top: 32px; padding: 0; list-style: none;
}

/* ---------- home: articles carousel ---------- */
.carousel { margin-top: 32px; }
.carousel-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 40px) / 3); gap: 20px;
  /* No CSS smooth scrolling here: it stops Chrome from recording LCP. Buttons/auto-advance animate via JS. */
  /* overflow hidden: visitors can't swipe or scroll it; only the auto-advance (app.js) moves it. */
  overflow: hidden; scroll-snap-type: x mandatory;
  padding: 4px 2px 12px; scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; }
.carousel-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.carousel-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.carousel-btn:hover { border-color: var(--text); }
.carousel-btn:disabled { opacity: .4; cursor: default; }
[dir="rtl"] .carousel-btn svg { transform: scaleX(-1); }
.articles-all, .articles-all:hover, .articles-all:active, .articles-all:focus { text-decoration: none; }

/* ---------- article pages ---------- */
.article-page { padding: 32px 0 0; }
.header-cta { justify-self: end; height: 44px; min-height: 44px; padding: 0 18px; font-size: 15px; border-radius: var(--radius-sm); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; color: var(--muted); font-size: 14px; }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--border-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current] { color: var(--text); overflow-wrap: anywhere; }
.post { margin-top: 24px; }
.post-head { display: flex; flex-direction: column; gap: 12px; }
.post-head h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.post-cover { margin: 28px 0 0; }
.post-cover img, .post-figure img {
  width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.post-body { margin-top: 28px; font-size: 17px; line-height: 1.75; }
/* Article text justified (flush left and right); headings stay left-aligned. */
.post-body p, .post-body li { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.post-body > * + * { margin-top: 18px; }
.post-body h2 { margin-top: 40px; font-size: 24px; line-height: 1.3; letter-spacing: -0.01em; }
.post-body h3 { margin-top: 28px; font-size: 19px; line-height: 1.35; }
.post-body ul, .post-body ol { padding-inline-start: 24px; }
.post-body li + li { margin-top: 8px; }
.post-body a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.post-body .tip {
  padding: 16px 18px; border: 1px solid var(--border-strong); border-inline-start: 4px solid var(--text);
  border-radius: var(--radius-sm); background: var(--surface);
}
.cta-wrap { margin-top: 48px; }
.post-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding: 24px 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.post-cta h2 { font-size: 20px; }
.post-cta p { color: var(--text); font-size: 17px; font-weight: 600; }
.post-cta .btn { height: 48px; flex: none; }
.share { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.share-label { font-weight: 700; }
button.social { cursor: pointer; }
/* Same 48px gap above and below the "Unduh video…" box; no divider line. */
.related { margin-top: 48px; padding: 0 0 64px; }
.related h2, .list-head h1 { font-size: clamp(22px, 4vw, 28px); font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.list-head { margin-top: 24px; }
/* /artikel/: every category as a label; picking one shows only its articles (article.js) */
.category-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.category-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s;
}
.category-chip:hover { border-color: var(--text); }
.category-chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.article-card[hidden] { display: none; }
@media (max-width: 639px) {
  /* one row that can be swiped sideways instead of several wrapped rows */
  .category-filter {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain;
    margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 4px; scroll-padding-inline: var(--gutter); scrollbar-width: none;
  }
  .category-filter::-webkit-scrollbar { display: none; }
  .category-chip { flex: none; white-space: nowrap; }
}
.list-head h1 { font-size: clamp(28px, 5vw, 40px); }
.article-page > .container > .article-grid { margin-bottom: 64px; }

@media (max-width: 1023px) {
  .carousel-track { grid-auto-columns: calc((100% - 20px) / 2); }
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .post-cta { flex-direction: column; align-items: flex-start; padding: 20px; }
  .post-cta p { font-size: 16px; }
  .carousel-track { grid-auto-columns: 100%; } /* one card at a time, the next one stays hidden */
  .article-excerpt { display: block; -webkit-line-clamp: unset; overflow: visible; } /* full description */
  .article-grid { grid-template-columns: 1fr; }
  .post-body { font-size: 16px; }
  .header-cta { padding: 0 14px; font-size: 14px; }
}

/* ---------- article page: content + "Artikel Populer" sidebar ---------- */
.post-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px;
  align-items: start;
}
.post-main { min-width: 0; }
.popular { position: sticky; top: calc(var(--header-h) + 24px); margin-top: 0; }
.popular h2 { font-size: 18px; font-weight: 700; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.popular-list { display: grid; gap: 4px; margin-top: 8px; padding: 0; list-style: none; counter-reset: popular; }
.popular-item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 10px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
}
.popular-item:hover { background: var(--surface-2); }
.popular-item img { width: 96px; height: 50px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.popular-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.popular-stats { display: flex; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.mini-stat { display: inline-flex; align-items: center; gap: 4px; }
.mini-stat svg { width: 13px; height: 13px; }
.popular-title {
  font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-cover figcaption, .post-figure figcaption {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-top: 10px; text-align: center;
}
.caption-text { color: var(--muted); font-size: 14px; line-height: 1.5; }
.caption-credit { color: var(--muted); font-size: 12px; opacity: .85; }
.caption-credit a { color: inherit; }
.post-body .post-figure { margin: 32px 0; }

/* ---------- views / likes / shares (left) + share buttons (right) ---------- */
.post-stats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border);
}
.stats-left { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stat {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600;
}
.stat-button { cursor: pointer; }
.stat-button:hover { border-color: var(--text); }
.stat-button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.stat-button[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- related ("Artikel Lainnya" left, "Lihat Semua" right) ---------- */
.related-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.related-head h2 { text-align: start; }
.related-head .btn { min-height: 44px; padding: 0 18px; font-size: 15px; border-radius: var(--radius-sm); }
.carousel-controls .btn { min-height: 48px; padding: 0 24px; border-radius: var(--radius-sm); }

@media (max-width: 1023px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .popular { position: static; margin-top: 48px; }
}

/* ---------- footer ---------- */
.footer {
  margin-top: auto;
  padding: 40px 0 calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; }
.footer-brand { max-width: 360px; }
.footer-desc { margin-top: 12px; color: var(--muted); font-size: 14px; }
.footer-contact { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.footer-title { font-size: 15px; font-weight: 700; color: var(--text); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.social {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); background: var(--bg);
  transition: border-color .15s;
}
.social:hover { border-color: var(--text); }
.footer-copy {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); white-space: nowrap;
  color: var(--muted); font-size: 14px; text-align: center;
}
.footer-copy a { color: var(--text); font-weight: 700; text-decoration: none; white-space: nowrap; }

@media (max-width: 720px) {
  .footer { padding-top: 32px; }
  .footer-top { flex-direction: column; gap: 24px; }
  .footer-contact { align-items: flex-start; }
  .footer-copy { margin-top: 24px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 30;
  left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 500; text-align: center;
}
.toast[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .platforms { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  /* Phones: sections take the height of their content again. */
  .screen { min-height: 0; display: block; }
  .hero { padding: 40px 0 28px; }
  .section { padding: 44px 0; }
  .search { flex-direction: column; }
  .btn-primary { width: 100%; }
  .result { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .result-media .thumb { aspect-ratio: 16 / 9; }
  .result-media .thumb img { object-fit: contain; }
  .steps { grid-template-columns: 1fr; }
  .step { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; padding: 20px; }
  .step-num { grid-row: span 2; margin-bottom: 0; }
  .platforms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .nav { display: none; }
  .header-inner { grid-template-columns: 1fr auto; }
}

@media (max-width: 520px) {
  .platforms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips li { font-size: 12px; padding: 5px 10px; }
}

/* Very narrow screens, e.g. Galaxy Z Fold cover display (~280px). */
@media (max-width: 340px) {
  :root { --gutter: max(12px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .field-icon { display: none; }
  .field input { padding-inline-start: 14px; }
  .option { flex-wrap: wrap; padding: 12px; }
  .option .btn { width: 100%; }
  .step { grid-template-columns: 1fr; }
  .step-num { grid-row: auto; margin-bottom: 12px; }
  .platforms li { font-size: 14px; }
}

/* Scripts that need more room above and below the line. */
:lang(th) h1, :lang(lo) h1, :lang(km) h1, :lang(my) h1, :lang(si) h1, :lang(ta) h1, :lang(ml) h1,
:lang(te) h1, :lang(kn) h1, :lang(bn) h1, :lang(hi) h1, :lang(mr) h1, :lang(ne) h1, :lang(ur) h1 { line-height: 1.45; }
/* Letter spacing breaks joined scripts like Arabic. */
[dir="rtl"] *, :lang(th) *, :lang(lo) *, :lang(km) *, :lang(my) * { letter-spacing: normal !important; }

@media (hover: none) {
  .nav a:hover, .field-action:hover { background: transparent; }
  .field-action:hover { background: var(--surface-2); }
  .btn-primary:hover { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* The skip link focuses <main>; it needs no visible ring. */
main:focus { outline: none; }
