/* ============================================================
   BASE.CSS — Reset, Global Styles, Typography Foundation
   KKN Digital Journal "JEJAK"
   ============================================================ */

/* ── GOOGLE FONTS IMPORT ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,700;1,400;1,700&family=Lora:ital,wght@0,400;0,500;1,400&family=Inter:wght@300;400;500;600&family=Cormorant+Garamond:ital,wght@1,300;1,400;1,500&display=swap');

/* ── MODERN RESET ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── SELECTION ────────────────────────────────────────────── */
::selection {
  background-color: var(--accent-sage);
  color: var(--bg-surface);
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-sage);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-sage-muted);
}

/* ── IMAGES & MEDIA ───────────────────────────────────────── */
img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  /* Analog-warm photo treatment — subtle, tidak berlebihan */
  filter: contrast(1.04) brightness(0.98) saturate(0.93);
  transition: filter var(--duration-normal) var(--ease-out);
}

/* ── LINKS ────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

/* ── LISTS ────────────────────────────────────────────────── */
ul, ol {
  list-style: none;
}

/* ── BUTTONS (base reset) ─────────────────────────────────── */
button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

/* ── TYPOGRAPHY GLOBAL ────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  font-weight: 700;
  color: var(--text-primary);
}

p {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

/* ── LAYOUT UTILITIES ─────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--px-mobile);
  padding-right: var(--px-mobile);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--px-tablet);
    padding-right: var(--px-tablet);
  }
}

@media (min-width: 1280px) {
  .container {
    padding-left: var(--px-desktop);
    padding-right: var(--px-desktop);
  }
}

.prose-container {
  max-width: var(--max-width-prose);
  margin-left: auto;
  margin-right: auto;
}

/* ── SECTION BASE ─────────────────────────────────────────── */
section {
  position: relative;
  overflow: hidden;
}

/* ── FOCUS VISIBLE (Accessibility) ───────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent-sage);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ── ANIMATION BASE: Scroll Reveal ───────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 450ms; }
.reveal-delay-5 { transition-delay: 600ms; }

/* ── DARK SECTION BASE ────────────────────────────────────── */
.section-dark {
  background-color: var(--bg-dark);
  color: var(--text-on-dark);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4 {
  color: var(--text-on-dark);
}

.section-dark p {
  color: var(--text-on-dark-subtle);
}

/* ── SECTION LABEL (chapter indicator, samping kiri) ─────── */
.section-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent-sage);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.section-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background-color: var(--accent-sage);
  flex-shrink: 0;
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  width: 48px;
  height: 2px;
  background: linear-gradient(to right, var(--accent-sage), transparent);
  border: none;
  margin: var(--space-8) 0;
}

/* ── REDUCED MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
