/**
 * Base — element defaults, the typographic hierarchy, and a handful of
 * primitives (buttons, fields, badges) that every preset reuses.
 *
 * Nothing here targets a page or a preset by name; anything specific lives in
 * its own stylesheet so components stay isolated.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keeps in-page anchors clear of the sticky header. */
  scroll-padding-top: calc(var(--sp-16) + var(--sp-2));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* Quiet dark scrollbar — chrome should disappear into the page. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #2e3138; }

/* Reset the elements the app actually uses, rather than a blanket reset. */
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul {
  margin: 0;
}

ol, ul {
  padding: 0;
  list-style: none;
}

img, svg, video, iframe {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--blue-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

::selection {
  background: rgba(47, 111, 208, 0.4);
  color: #fff;
}

/* ---------------------------------------------------------------- headings */

/**
 * The hierarchy is size + weight + measure. `text-wrap: balance` on headings
 * stops the one-word last line that makes a title look accidental; `pretty` on
 * body copy avoids orphans without changing the line count.
 */
.h-hero,
.h1,
.h2,
.h3 {
  font-weight: var(--fw-bold);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-tight);
  text-wrap: balance;
  color: var(--text-bright);
}

.h-hero { font-size: var(--fs-4xl); }
.h1 { font-size: var(--fs-3xl); }
.h2 { font-size: var(--fs-2xl); line-height: var(--lh-snug); }
.h3 { font-size: var(--fs-xl); font-weight: var(--fw-semi); line-height: var(--lh-snug); }

/* Reading copy. `--w-prose` keeps the measure near 68 characters even when the
   container is wider (e.g. inside a two-column preset). */
.prose {
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text);
  max-width: 68ch;
}

.prose + .prose {
  margin-top: var(--sp-4);
}

/* A citation inside running text — the link to Shopee's own documentation that
   an article's "mengikuti dokumentasi resmi" claim rests on. It is underlined at
   rest, unlike interface links: inside a paragraph, colour alone is the one
   signal a reader with colour-vision deficiency does not get, and this is the
   only place where missing the link means missing the source. */
.prose__link,
.list__item .prose__link,
.table td .prose__link,
.table th .prose__link {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-normal);
  color: var(--text-2);
  max-width: 54ch;
  text-wrap: pretty;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--blue-bright);
}

.caption {
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  color: var(--text-3);
}

.meta {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.muted { color: var(--text-3); }
.numeric { font-variant-numeric: tabular-nums; }

/* Visible only to assistive tech — used for live-region announcements. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  letter-spacing: -0.01em;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.btn:hover:not(:disabled) { border-color: #333845; background: var(--surface); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(180deg, var(--blue-hover) 0%, var(--blue) 100%);
  border-color: var(--blue);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4a88e2 0%, var(--blue-hover) 100%);
  border-color: var(--blue-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--shadow-md);
}

.btn--sm { min-height: 34px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); }
.btn--block { width: 100%; }

/* Square icon-only control; keeps the 44px tap target without a wide box. */
.icon-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field {
  display: grid;
  gap: var(--sp-2);
}

.field > span {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--text-2);
}

.input,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
}

.textarea { resize: vertical; }
.input:focus, .textarea:focus { outline: none; border-color: var(--blue); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
}

.badge--accent {
  color: var(--blue-bright);
  background: var(--blue-dim);
  border-color: var(--blue-line);
}

/* ------------------------------------------------------------------ layout */

.stack {
  display: grid;
  gap: var(--stack);
  align-content: start;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}

.container {
  width: 100%;
  max-width: var(--w-reading);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide { max-width: var(--w-wide); }

/**
 * Card — the shell every content block sits in, so each topic reads as a tidy,
 * self-contained unit with one consistent inner padding.
 */
.card {
  padding: var(--pad-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--inset-top);
}

.card > * + * { margin-top: var(--sp-4); }

/* Divider used inside cards and lists. */
.rule {
  height: 1px;
  background: var(--line-soft);
}

/*
 * Simulation banner. Deliberately plain and unmissable: it is a statement of
 * fact about the build, not a design element, and it must not be mistaken for
 * a dismissible notification.
 */
.envbar {
  padding: var(--sp-2) var(--sp-4);
  background: var(--blue-dim);
  border-bottom: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  text-align: center;
}

.envbar strong { color: var(--fg); }
