/* ======================================================
   KaptenWeb v2 — Stylesheet
   Design: Space Grotesk + DM Sans, light/dark, CSS vars
====================================================== */

/* --- TOKENS --- */
:root {
  --accent:     #3B82F6;
  --accent-rgb: 59,130,246;
  --accent2:    #F97316;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;
  --nav-h:     68px;
  --container: 1100px;
  --ease:      cubic-bezier(.4,0,.2,1);
}

/* --- DARK (default) --- */
:root,
[data-theme="dark"] {
  --bg:         #070E1C;
  --bg-alt:     #0C1628;
  --bg-card:    #101F38;
  --border:     rgba(59,130,246,.12);
  --border-hover: rgba(59,130,246,.35);
  --text:       #EBF0FB;
  --text-muted: #6B84AD;
  --text-dim:   #2E4060;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
}

/* --- LIGHT --- */
[data-theme="light"] {
  --bg:         #F8FAFF;
  --bg-alt:     #EEF3FC;
  --bg-card:    #FFFFFF;
  --border:     #DDE7F8;
  --border-hover: rgba(59,130,246,.5);
  --text:       #0D1829;
  --text-muted: #5C6E8A;
  --text-dim:   #B0BFDA;
  --shadow:     0 4px 24px rgba(30,60,120,.08);
}

/* System preference */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F8FAFF; --bg-alt: #EEF3FC; --bg-card: #FFFFFF;
    --border: #DDE7F8; --border-hover: rgba(59,130,246,.5);
    --text: #0D1829; --text-muted: #5C6E8A; --text-dim: #B0BFDA;
    --shadow: 0 4px 24px rgba(30,60,120,.08);
  }
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}
img  { max-width: 100%; display: block; }
a    { color: inherit; text-decoration: none; }
ul   { list-style: none; }

/* --- CONTAINER --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ======================================================
   NAVBAR
====================================================== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 200;
  background: rgba(7,14,28,.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
[data-theme="light"] .navbar {
  background: rgba(248,250,255,.88);
}
.navbar.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  display: flex; align-items: center;
  justify-content: space-between; height: 100%;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.2rem;
  letter-spacing: -.03em;
}
.logo em { color: var(--accent); font-style: normal; }

.nav-links {
  display: flex; align-items: center; gap: 32px;
}
.nav-links a {
  font-size: .88rem; font-weight: 500;
  color: var(--text-muted);
  transition: color .15s;
}
.nav-links a:hover { color: var(--text); }

.nav-right {
  display: flex; align-items: center; gap: 10px;
}

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  font-size: 1rem; transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Nav CTA */
.nav-cta {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius-sm);
  font-size: .85rem !important;
  font-weight: 600 !important;
  transition: opacity .2s !important;
}
.nav-cta:hover { opacity: .88 !important; }

/* Hamburger */
.hamburger {
  display: none; flex-direction: column;
  gap: 5px; width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--radius-sm);
}
.hamburger span {
  display: block; width: 100%; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ======================================================
   BUTTONS
====================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: .88rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .15s, opacity .2s;
  border: 1px solid transparent;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.2);
}

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text); border-color: var(--border-hover);
  background: rgba(var(--accent-rgb),.06);
}

/* ======================================================
   HERO
====================================================== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center;
  overflow: hidden; padding-top: var(--nav-h);
}
.hero-dots {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(var(--accent-rgb),.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 100%);
}
.hero-inner {
  position: relative; z-index: 1;
  padding: 80px 0 120px;
  max-width: 740px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem; color: var(--accent);
  letter-spacing: .08em; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: '';
  display: block; width: 24px; height: 1px;
  background: var(--accent);
}
.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6.5vw, 4.8rem);
  font-weight: 700; line-height: 1.08;
  letter-spacing: -.04em; margin-bottom: 28px;
}
.hero-headline .hl-accent {
  color: var(--accent);
}
.cursor {
  color: var(--accent); animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.hero-sub {
  font-size: 1.1rem; color: var(--text-muted);
  line-height: 1.8; max-width: 540px; margin-bottom: 40px;
}
.hero-actions {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}

/* ======================================================
   SECTIONS
====================================================== */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }

.section-label {
  font-family: var(--font-mono);
  font-size: .75rem; color: var(--accent);
  letter-spacing: .06em; margin-bottom: 12px;
  display: block;
}
.section-label::before { content: '/* '; }
.section-label::after  { content: ' */'; opacity: .5; }

.section-header { margin-bottom: 52px; }
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700; letter-spacing: -.03em;
  line-height: 1.15; max-width: 480px;
}

/* ======================================================
   SERVICES
====================================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 32px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.card-icon, .card-icon-emoji { font-size: 2rem; margin-bottom: 18px; line-height: 1; display: block; }
.card .icon-img { width: 40px; height: 40px; object-fit: contain; margin-bottom: 18px; display: block; }
/* Iconify icons dalam service card */
.card-icon.iconify { font-size: 0; width: 40px; height: 40px; margin-bottom: 18px; display: inline-block; }
.card-icon svg { width: 40px; height: 40px; }
.card h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.05rem; margin-bottom: 10px; letter-spacing: -.01em;
}
.card p { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

/* ======================================================
   ABOUT
====================================================== */
.about-body {
  font-size: 1.06rem; color: var(--text-muted);
  line-height: 1.85; max-width: 620px; margin-bottom: 32px;
}
.skills { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  padding: 6px 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 100px; font-size: .8rem; font-weight: 500;
  color: var(--text-muted); transition: border-color .2s, color .2s;
}
.skill-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ======================================================
   PORTFOLIO
====================================================== */
.portfolio-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.p-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
  transition: border-color .2s, transform .2s;
}
.p-card:hover { border-color: var(--border-hover); transform: translateY(-3px); }
.p-card-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 18px;
}
.p-num {
  font-family: var(--font-mono); font-size: .8rem;
  color: var(--accent); font-weight: 700;
}
.p-tag {
  font-size: .7rem; font-weight: 600; padding: 3px 10px;
  background: rgba(var(--accent-rgb),.1);
  border: 1px solid rgba(var(--accent-rgb),.2);
  border-radius: 100px; color: var(--accent);
}
.p-card h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1rem; margin-bottom: 8px; letter-spacing: -.01em;
}
.p-card p { font-size: .88rem; color: var(--text-muted); line-height: 1.65; }

/* ======================================================
   CONTACT
====================================================== */
.contact-inner { max-width: 580px; }
.contact-body {
  font-size: 1.05rem; color: var(--text-muted);
  line-height: 1.8; margin-bottom: 36px;
}
.contact-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ======================================================
   FOOTER
====================================================== */
.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.footer-logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: .95rem;
}
.footer-logo em { color: var(--accent); font-style: normal; }
.footer p { font-size: .8rem; color: var(--text-dim); }

/* ======================================================
   BLOG — LISTING
====================================================== */
.blog-hero {
  padding: calc(var(--nav-h) + 64px) 0 64px;
}
.blog-hero h1 {
  font-family: var(--font-display); font-size: clamp(2rem,4vw,3rem);
  font-weight: 700; letter-spacing: -.035em; margin-bottom: 12px;
}
.blog-hero p { font-size: 1rem; color: var(--text-muted); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px; padding-bottom: 96px;
}
.blog-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: border-color .2s, transform .2s;
  display: flex; flex-direction: column;
}
.blog-card:hover { border-color: var(--border-hover); transform: translateY(-3px); }
.blog-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.blog-tag {
  font-size: .7rem; font-weight: 600; padding: 3px 9px;
  background: rgba(var(--accent-rgb),.1);
  border: 1px solid rgba(var(--accent-rgb),.2);
  border-radius: 100px; color: var(--accent);
  letter-spacing: .02em;
}
.blog-card h2 {
  font-family: var(--font-display); font-size: 1.1rem;
  font-weight: 600; letter-spacing: -.02em;
  line-height: 1.35; margin-bottom: 10px;
  color: var(--text);
  transition: color .15s;
}
.blog-card:hover h2 { color: var(--accent); }
.blog-card p { font-size: .88rem; color: var(--text-muted); line-height: 1.7; flex: 1; }
.blog-card-meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .78rem; color: var(--text-dim);
}
.blog-card-meta a {
  margin-left: auto; color: var(--accent); font-weight: 600;
  font-size: .82rem; transition: gap .15s;
}
.blog-card-meta a:hover { text-decoration: underline; }

/* ======================================================
   BLOG — SINGLE POST
====================================================== */
.post-header {
  padding: calc(var(--nav-h) + 64px) 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.post-header .blog-card-tags { margin-bottom: 20px; }
.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700; letter-spacing: -.04em;
  line-height: 1.15; margin-bottom: 20px; max-width: 780px;
}
.post-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: .82rem; color: var(--text-muted); align-items: center;
}
.post-meta span::before { content: '· '; }
.post-meta span:first-child::before { content: ''; }

/* Post content typography */
.post-content { max-width: 720px; margin-bottom: 64px; }
.post-content p  { font-size: 1.05rem; line-height: 1.85; margin-bottom: 1.5em; color: var(--text); }
.post-content h2 {
  font-family: var(--font-display); font-size: 1.55rem;
  font-weight: 700; letter-spacing: -.03em;
  margin: 2.2em 0 .8em; color: var(--text);
}
.post-content h3 {
  font-family: var(--font-display); font-size: 1.15rem;
  font-weight: 600; margin: 1.8em 0 .6em;
}
.post-content ul, .post-content ol {
  margin: 1em 0 1.5em 1.4em;
}
.post-content li { margin-bottom: .4em; font-size: 1.02rem; line-height: 1.7; }
.post-content strong { font-weight: 600; color: var(--text); }
.post-content em { color: var(--text-muted); }
.post-content a { color: var(--accent); text-decoration: underline; }
.post-content pre {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px;
  overflow-x: auto; margin: 1.5em 0;
  font-family: var(--font-mono); font-size: .85rem;
  line-height: 1.6;
}
.post-content code {
  font-family: var(--font-mono); font-size: .88em;
  background: rgba(var(--accent-rgb),.1); padding: 2px 6px;
  border-radius: 4px; color: var(--accent);
}
.post-content pre code { background: none; padding: 0; color: var(--text); }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px; margin: 1.5em 0;
  color: var(--text-muted); font-style: italic;
}

.post-nav {
  display: flex; justify-content: space-between;
  padding: 28px 0; border-top: 1px solid var(--border);
  margin-bottom: 64px;
}
.post-nav a {
  font-size: .88rem; color: var(--accent); font-weight: 500;
}

/* ======================================================
   LINKS PAGE (LinkBio)
====================================================== */
.links-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.links-inner {
  width: 100%; max-width: 440px;
}
.links-profile {
  text-align: center; margin-bottom: 36px;
}
.links-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 16px;
  border: 3px solid var(--border);
}
.links-avatar-placeholder {
  width: 88px; height: 88px; border-radius: 50%;
  background: rgba(var(--accent-rgb),.15);
  border: 3px solid rgba(var(--accent-rgb),.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin: 0 auto 16px;
}
.links-name {
  font-family: var(--font-display); font-size: 1.3rem;
  font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px;
}
.links-title { font-size: .88rem; color: var(--text-muted); margin-bottom: 10px; }
.links-bio   { font-size: .9rem; color: var(--text-muted); line-height: 1.65; }

.links-list  { display: flex; flex-direction: column; gap: 12px; }
.link-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem; font-weight: 500;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  cursor: pointer;
}
.link-btn:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.link-btn .link-icon { font-size: 1.25rem; flex-shrink: 0; }
.link-btn .link-title { flex: 1; }
.link-btn .link-arrow {
  color: var(--text-dim); font-size: .9rem; transition: transform .2s;
}
.link-btn:hover .link-arrow { transform: translateX(3px); }

.links-footer {
  text-align: center; margin-top: 36px;
  font-size: .75rem; color: var(--text-dim);
}
.links-footer a { color: var(--accent); }

/* ======================================================
   BLOG EMPTY STATE
====================================================== */
.empty-state {
  text-align: center; padding: 80px 0 96px; color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-display); font-size: 1.2rem;
  font-weight: 600; margin-bottom: 8px; margin-top: 16px;
}

/* ======================================================
   UTILS
====================================================== */
.fade-in {
  opacity: 0; transform: translateY(16px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.fade-in.visible { opacity: 1; transform: none; }

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    display: none; position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: var(--bg); flex-direction: column;
    align-items: center; justify-content: center;
    gap: 32px; border-top: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1.1rem; }

  .hero-inner  { padding: 48px 0 80px; }
  .section     { padding: 64px 0; }
  .services-grid, .portfolio-grid { grid-template-columns: 1fr; }
  .section-header { margin-bottom: 36px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-actions, .contact-links, .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .fade-in { transition: none; opacity: 1; transform: none; }
  * { transition-duration: .01ms !important; }
}
