/* ============================================
   ILHAMJR.COM — Global Stylesheet
   Design: Dark Elegant / Warm Steel
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---- Tokens ---- */
:root {
  /* Colors */
  --bg:         #0d0d0d;
  --surface:    #151515;
  --surface2:   #202020;
  --border:     #2a2a2a;
  --text:       #f0f0f0;
  --text-muted: #b0b0b0;
  --accent:     #8ab4bd;
  --accent2:    #d4b88a;
  --success:    #22bb33;
  --danger:     #ef3131;
  --warning:    #f0ad4e;
  --hover:      rgba(255,255,255,0.05);

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --text-xs:  0.8rem;
  --text-sm:  0.9rem;
  --text-md:  1.05rem;
  --text-lg:  1.5rem;
  --text-xl:  2.25rem;
  --text-h1:  2.75rem;
  --text-h2:  2rem;
  --text-h3:  1.65rem;

  /* Layout */
  --page-padding: 0 10%;
  --radius:    5px;
  --radius-lg: 10px;
  --radius-xl: 20px;
  --transition: 0.25s ease;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg:         #f4f3ef;
  --surface:    #ffffff;
  --surface2:   #eceae6;
  --border:     #ccc9c4;
  --text:       #111110;
  --text-muted: #4a4848;
  --accent:     #2d7080;
  --accent2:    #7a5530;
  --hover:      rgba(0,0,0,0.04);
}
[data-theme="light"] .navbar {
  background: rgba(244, 243, 239, 0.92);
}
[data-theme="light"] .mobile-menu {
  background: rgba(244, 243, 239, 0.98);
}
[data-theme="light"] .hero-image-frame::after {
  background: linear-gradient(to bottom, transparent 60%, rgba(244,243,239,0.65));
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; overflow-x: hidden; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  background: rgba(20, 20, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.navbar-brand span { color: var(--accent2); }
.brand-logo-img {
  height: 34px;
  width: auto;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--accent2);
  border-radius: 4px;
  font-size: 0.95em;
  color: var(--accent2);
  flex-shrink: 0;
}
.navbar-links {
  display: flex;
  gap: 8px;
  list-style: none;
}
.navbar-links a {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text);
  background: var(--surface2);
}
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.navbar-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  z-index: 998;
}
.mobile-backdrop.open { display: block; }
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72%;
  max-width: 280px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 20px 28px 40px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  visibility: hidden;
}
.mobile-menu.open {
  transform: translateX(0);
  visibility: visible;
}
.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mobile-menu a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--accent2); }
.mobile-menu-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  transition: var(--transition);
}
.mobile-menu-close:hover { color: var(--text); }

/* ---- Page Wrapper ---- */
.page-wrapper {
  padding-top: 65px;
  flex: none;
  width: 100%;
  display: block;
}

/* ---- Full-width Section Layout ---- */
.page-section {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 60px 0;
}
.page-section-alt { background: var(--surface2); }
.page-section-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .page-section { padding: 36px 0; }
  .page-section-inner { padding: 0 20px; }
}

/* ---- Section ---- */
.section {
  width: 100%;
  padding: 80px 10%;
}

/* ---- Cards Container (shared with index.html) ---- */
.cards-container {
  padding: 24px 10% 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.feature-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  width: 100%;
}
.section-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.section-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.7;
}

/* ---- Section alt background ---- */
.section-alt {
  background: var(--surface);
}

/* ---- Divider ---- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.btn-primary {
  background: var(--accent2);
  color: var(--bg);
}
.btn-primary:hover { background: #d4b892; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(123,158,166,0.06); }

/* ---- Card ---- */
.card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: var(--transition);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* ---- Skill Tag ---- */
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.875rem;
  color: var(--text);
  z-index: 9999;
  transition: transform 0.3s ease;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Footer ---- */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 10% 32px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.footer-brand-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.footer-social {
  display: flex;
  gap: 8px;
}
.footer-social a {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  transition: var(--transition);
}
.footer-social a:hover { border-color: var(--accent2); color: var(--accent2); }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.footer-col a:hover { color: var(--text); }
.footer-divider { height: 1px; background: var(--border); margin-bottom: 24px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { color: var(--text-muted); transition: var(--transition); }
.footer-legal a:hover { color: var(--text); }
@media (max-width: 768px) {
  footer { padding: 40px 20px 28px; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .footer-legal { justify-content: center; }
}

/* ---- Theme Toggle ---- */
.theme-dropdown { position: relative; }
.theme-toggle-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 100px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.theme-toggle-pill:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
.theme-icon {
  display: none;
  width: 15px;
  height: 15px;
  color: var(--accent2);
}
.theme-chevron {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}
.theme-dropdown.open .theme-chevron { transform: rotate(180deg); }
.theme-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  min-width: 130px;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  z-index: 200;
}
.theme-dropdown.open .theme-dropdown-menu { display: flex; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-family: var(--font-body);
  transition: var(--transition);
  width: 100%;
  text-align: left;
}
.theme-option svg { flex-shrink: 0; }
.theme-option:hover { background: var(--surface2); color: var(--text); }
.theme-option.active { color: var(--text); }
.theme-option.active svg { color: var(--accent2); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .navbar-hamburger { display: flex; }
  .navbar { padding: 12px 20px; }
  .section { padding: 60px 5%; }
  footer { padding: 40px 5% 28px; }
}

/* ---- Search Bar ---- */
.search-wrap { margin-bottom: 32px; }
.search-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 380px;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); background: var(--surface); }
.search-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-family: var(--font-mono);
}

/* ---- Posts Grid (Projects Page) ---- */
.projects-header { margin-bottom: 48px; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.post-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.post-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.post-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.post-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.post-title {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.post-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.75;
  flex: 1;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.post-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--accent2);
  transition: var(--transition);
  margin-top: 4px;
}
.post-link:hover { gap: 10px; }

/* ---- Article (Guide Pages) ---- */
.article-wrap {
  padding: 50px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-muted); transition: var(--transition); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { opacity: 0.4; }
.article-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 12px 0 16px;
}
.article-meta {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.article-body {
  overflow-wrap: break-word;
  word-wrap: break-word;
  min-width: 0;
}
.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin: 44px 0 16px;
  color: var(--text);
}
.article-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
}
.article-body p {
  font-size: 0.93rem;
  line-height: 1.9;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.article-body p strong,
.article-body li strong { color: var(--text); font-weight: 600; }
.article-body ul,
.article-body ol { padding-left: 22px; margin-bottom: 20px; }
.article-body li {
  font-size: 0.93rem;
  line-height: 1.9;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.article-body a { color: var(--accent2); }
.article-body a:hover { text-decoration: underline; }
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.83em;
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
  overflow-wrap: break-word;
  word-break: break-all;
}
.code-block {
  background: #1a1a1a;
  border: 1px solid #383838;
  border-radius: 10px;
  margin: 18px 0;
  overflow: hidden;
}
.code-block::before {
  content: '';
  display: block;
  height: 36px;
  background: #2d2d2d;
  border-bottom: 1px solid #383838;
  background-image:
    radial-gradient(circle at 14px 50%, #ff5f57 6px, transparent 6px),
    radial-gradient(circle at 34px 50%, #febc2e 6px, transparent 6px),
    radial-gradient(circle at 54px 50%, #28c840 6px, transparent 6px);
}
.code-block pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #d4d4d4;
  line-height: 1.75;
  margin: 0;
  padding: 16px 22px;
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-sizing: border-box;
}
.note-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 22px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.75;
  overflow-wrap: break-word;
  word-break: break-word;
}
.note-box strong { color: var(--text); }
.warning-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 22px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.75;
  overflow-wrap: break-word;
  word-break: break-word;
}
.warning-box strong { color: var(--text); }
.note-box code,
.warning-box code {
  word-break: break-all;
  white-space: pre-wrap;
}
.step-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.step-list > li {
  display: flex;
  gap: 18px;
  margin-bottom: 28px;
  color: var(--text-muted);
}
.step-num {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 30px;
  padding-top: 1px;
}
.step-num span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.step-body { flex: 1; min-width: 0; }
.step-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.step-body p { font-size: 0.875rem; margin-bottom: 8px; }
.step-body ul { margin-bottom: 8px; }
.step-body li { font-size: 0.875rem; }
.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.5;
}
.article-table thead tr {
  background: var(--surface2);
}
.article-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.article-table td {
  padding: 10px 14px;
  color: var(--text);
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.article-table tbody tr:last-child td { border-bottom: none; }
.article-table tbody tr:hover { background: var(--surface2); }
.article-table td code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-muted);
  transition: var(--transition);
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.article-back:hover { color: var(--accent2); }
@media (max-width: 768px) {
  .cards-container { padding: 16px 5% 40px; gap: 12px; }
  .posts-grid { grid-template-columns: 1fr; }
  .article-wrap { padding: 28px 20px 48px; }
}

/* ---- Mobile overflow prevention ---- */
@media (max-width: 768px) {
  .page-wrapper,
  .cards-container,
  .feature-card,
  .article-wrap,
  .article-body { max-width: 100%; }

  .article-body p,
  .article-body li,
  .article-body h2,
  .article-body h3,
  .article-body h4 {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .code-block pre {
    white-space: pre;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}
