/* ------------------------------------------------------------------
   Adi Yulianto — portfolio
   ------------------------------------------------------------------ */

:root {
  --radius: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --x: 50%;
  --y: 30%;
}

/* Themes ------------------------------------------------------------- */
/* Dark is the default; light applies when chosen, or when the OS prefers
   light and the visitor hasn't picked a theme (data-theme unset). */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-raised: rgba(148, 163, 184, 0.06);
  --text: #94a3b8;
  --text-strong: #e2e8f0;
  --text-muted: #64748b;
  --accent: #f5b942;
  --accent-rgb: 245, 185, 66;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --border: rgba(148, 163, 184, 0.14);
  --header-bg: rgba(11, 18, 32, 0.8);
  --thumb-bg: rgba(148, 163, 184, 0.05);
  --spot-alpha: 0.08;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-raised: rgba(15, 23, 42, 0.04);
  --text: #475569;
  --text-strong: #0f172a;
  --text-muted: #64748b;
  --accent: #b45309;
  --accent-rgb: 180, 83, 9;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --border: rgba(15, 23, 42, 0.12);
  --header-bg: rgba(248, 250, 252, 0.85);
  --thumb-bg: rgba(15, 23, 42, 0.03);
  --spot-alpha: 0.06;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f8fafc;
    --bg-raised: rgba(15, 23, 42, 0.04);
    --text: #475569;
    --text-strong: #0f172a;
    --text-muted: #64748b;
    --accent: #b45309;
    --accent-rgb: 180, 83, 9;
    --accent-soft: rgba(var(--accent-rgb), 0.1);
    --border: rgba(15, 23, 42, 0.12);
    --header-bg: rgba(248, 250, 252, 0.85);
    --thumb-bg: rgba(15, 23, 42, 0.03);
    --spot-alpha: 0.06;
  }
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: rgba(var(--accent-rgb), 0.3); color: var(--text-strong); }

a { color: var(--text-strong); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent); }
strong { color: var(--text-strong); font-weight: 500; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { margin: 0; color: var(--text-strong); }
p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }

/* Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; color: var(--bg); }

/* Cursor spotlight --------------------------------------------------- */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(600px at var(--x) var(--y), rgba(var(--accent-rgb), var(--spot-alpha)), transparent 80%);
}
.spotlight.is-on { opacity: 1; }

/* Layout ------------------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

@media (min-width: 768px) {
  .page { padding: 5rem 3rem; }
}

@media (min-width: 1024px) {
  .page {
    display: flex;
    justify-content: space-between;
    gap: 4rem;
    padding: 0 6rem;
  }
  .sidebar {
    position: sticky;
    top: 0;
    width: 48%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6rem 0;
  }
  .content {
    width: 52%;
    padding: 6rem 0;
  }
}

/* Sidebar ------------------------------------------------------------ */
.name {
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.name a { color: inherit; }

.headline {
  margin-top: 0.75rem;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 1rem;
  max-width: 20rem;
  line-height: 1.6;
}

.sidebar { margin-bottom: 3rem; }
@media (min-width: 1024px) { .sidebar { margin-bottom: 0; } }

.nav { display: none; }

@media (min-width: 1024px) {
  .nav { display: block; margin-top: 4rem; }
  .nav li + li { margin-top: 0.15rem; }
  .nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .nav-line {
    display: inline-block;
    width: 2rem;
    height: 1px;
    margin-right: 1rem;
    background: currentColor;
    transition: width 0.2s ease, background-color 0.2s ease;
  }
  .nav a:hover,
  .nav a:focus-visible,
  .nav a.active { color: var(--text-strong); }
  .nav a:hover .nav-line,
  .nav a:focus-visible .nav-line,
  .nav a.active .nav-line { width: 4rem; }
  .nav a.active .nav-line { background: var(--accent); }
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 2rem;
}

.socials {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.socials a { display: block; color: var(--text); }
.socials a:hover { color: var(--accent); }
.icon { display: block; width: 24px; height: 24px; }

/* Theme toggle: sits after the socials, set off by a thin divider */
.theme-toggle {
  display: grid;
  place-items: center;
  padding: 0 0 0 1.25rem;
  border: 0;
  border-left: 1px solid var(--border);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle .icon { transition: transform 0.3s ease; }
.theme-toggle:hover .icon { transform: rotate(-15deg); }

/* Show the icon for the theme you'd switch TO */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* Sections ----------------------------------------------------------- */
.section {
  margin-bottom: 4rem;
  scroll-margin-top: 4rem;
}

@media (min-width: 768px) { .section { margin-bottom: 6rem; } }
@media (min-width: 1024px) { .section { margin-bottom: 9rem; scroll-margin-top: 6rem; } }

.section-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -1.5rem 1.75rem;
  padding: 1rem 1.5rem;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section-num {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8em;
  font-weight: 500;
  letter-spacing: 0;
}
.section-num::after { content: "."; }

/* Trailing rule that fills the rest of the row */
.section-heading::after {
  content: "";
  flex: 1;
  align-self: center;
  max-width: 16rem;
  height: 1px;
  margin-left: 0.5rem;
  background: linear-gradient(to right, var(--border), transparent);
}

@media (min-width: 768px) {
  .section-header { margin: 0 -3rem 2rem; padding: 1.1rem 3rem; }
}

@media (min-width: 1024px) {
  /* Static, larger heading on desktop (the sidebar nav already tracks position) */
  .section-header {
    position: static;
    margin: 0 0 2.5rem;
    padding: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .section-heading { font-size: 1.6rem; }
  .section-heading::after { max-width: none; }
}

.section-intro { margin-bottom: 2rem; }

/* Cards (experience / projects / education) -------------------------- */
.cards > li + li { margin-top: 3rem; }

.card {
  position: relative;
  display: grid;
  gap: 0.5rem;
  transition: opacity 0.2s ease;
}

@media (min-width: 640px) {
  .card {
    grid-template-columns: 9rem 1fr;
    gap: 2rem;
  }
}

/* Hover surface + sibling dimming on devices that can hover */
@media (min-width: 1024px) and (hover: hover) {
  .card::before {
    content: "";
    position: absolute;
    inset: -1rem -1.5rem;
    z-index: -1;
    border-radius: var(--radius);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }
  .card:hover::before {
    background: var(--bg-raised);
    box-shadow: inset 0 1px 0 0 var(--border);
  }
  .cards:hover > .card:not(:hover) { opacity: 0.5; }
  .card:hover .card-title,
  .card:hover .card-title a { color: var(--accent); }
}

.card-meta {
  padding-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.6;
}

.card-title {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  transition: color 0.2s ease;
}

/* Whole card becomes the click target when a link exists */
.card-link::after {
  content: "";
  position: absolute;
  inset: -1rem -1.5rem;
  border-radius: var(--radius);
}

.icon-arrow {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  vertical-align: -0.1em;
  transition: transform 0.2s ease;
}
.card:hover .icon-arrow,
.card-link:focus-visible .icon-arrow { transform: translate(2px, -2px); }

.card-sub {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card-text {
  margin: 0.6rem 0 0;
  font-size: 0.92rem;
}

.card-list {
  margin-top: 0.6rem;
  font-size: 0.92rem;
}
.card-list li {
  position: relative;
  padding-left: 1.1rem;
}
.card-list li + li { margin-top: 0.3rem; }
.card-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Project thumbnail placeholder (initial letter) */
.thumb {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 9rem;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: 6px;
  background:
    radial-gradient(circle at 30% 20%, rgba(var(--accent-rgb), 0.18), transparent 60%),
    var(--thumb-bg);
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
@media (max-width: 639px) { .thumb { max-width: 6rem; font-size: 1.2rem; } }

/* Tags --------------------------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tag {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
}

/* Facts grid --------------------------------------------------------- */
.facts {
  display: grid;
  gap: 2rem;
  margin-top: 3.5rem;
}
@media (min-width: 640px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .fact-wide { grid-column: 1 / -1; }
}
.fact h3 {
  margin-bottom: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.fact > ul:not(.tags) > li { font-size: 0.92rem; }
.fact > ul:not(.tags) > li + li { margin-top: 0.25rem; }
.fact .tags { margin-top: 0; }

/* Footer ------------------------------------------------------------- */
.footer {
  max-width: 28rem;
  padding-bottom: 4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer a { color: var(--text); font-weight: 500; }
.footer a:hover { color: var(--accent); }
.footer p { margin-bottom: 0.5rem; }
