/* ============================================================
   Dandy Maulana — profile
   Minimal, editorial. Light + dark, system-aware.
   ============================================================ */

:root {
  --bg: #fcfcfb;
  --text: #1c1c1a;
  --text-2: #6d6b65;
  --text-3: #9c9890;
  --border: #e8e6e1;
  --rule: #ece9e4;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211;
    --text: #eae7e1;
    --text-2: #a29e95;
    --text-3: #6f6c64;
    --border: #2a2825;
    --rule: #242220;
  }
}

:root[data-theme="dark"] {
  --bg: #131211;
  --text: #eae7e1;
  --text-2: #a29e95;
  --text-3: #6f6c64;
  --border: #2a2825;
  --rule: #242220;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3.5rem, 12vw, 7rem) clamp(1.4rem, 6vw, 2.25rem) 4rem;
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- intro ---------- */

.intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.intro__lede {
  margin-top: 1rem;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  line-height: 1.55;
  color: var(--text);
  max-width: 32ch;
}

.intro__meta {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  color: var(--text-2);
}

/* ---------- sections ---------- */

.section {
  margin-top: clamp(2.75rem, 8vw, 4.25rem);
}

.section__label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-3);
  margin-bottom: 1.4rem;
}

/* ---------- prose ---------- */

.prose p + p {
  margin-top: 1.05rem;
}

.prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-underline-offset: 2px;
}
.prose a:hover {
  text-decoration-color: currentColor;
}

/* ---------- entry lists (work / education / links) ---------- */

.entries {
  list-style: none;
}

.entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--rule);
}
.entry:last-child {
  border-bottom: 1px solid var(--rule);
}

.entry__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.entry__title {
  font-weight: 500;
  color: var(--text);
}

.entry__sub {
  font-size: 0.9rem;
  color: var(--text-2);
}

.entry__meta {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

a.entry__title {
  text-decoration: none;
}
a.entry__title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entries--links .entry__meta {
  color: var(--text-3);
}

/* ---------- footer ---------- */

.footer {
  margin-top: clamp(3rem, 9vw, 5rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--text-3);
}

/* ---------- theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-3);
}
.theme-toggle svg {
  display: block;
}

/* ---------- focus / selection ---------- */

a:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
  .entry {
    flex-direction: column;
    gap: 0.3rem;
  }
  .entry__meta {
    text-align: left;
    order: -1;
    font-size: 0.82rem;
    color: var(--text-3);
  }
  .entries--links .entry__meta {
    order: 0;
  }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }
  * {
    transition: none !important;
  }
}
