/* =========================================================
   FAHRUL RIDHO — AUTOMATION ENGINEERING PORTFOLIO
   Design language: industrial control-panel / schematic
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Color */
  --bg: #0B0E11;
  --bg-alt: #0E1216;
  --surface: #12161B;
  --surface-2: #161B21;
  --border: #232931;
  --border-strong: #2E353F;
  --text: #E8EDF2;
  --text-muted: #8B98A5;
  --text-faint: #576270;
  --accent: #E8A33D;        /* signal amber — indicator light */
  --accent-soft: rgba(232, 163, 61, 0.12);
  --accent-strong: #F2B75A;
  --run: #4ADE80;           /* PLC "RUN" status green, used sparingly */

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --max-width: 1180px;
  --gutter: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --nav-height: 76px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 640px) {
  :root { --gutter: 20px; }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #0B0E11;
  padding: 10px 16px;
  z-index: 999;
  font-family: var(--font-mono);
  font-size: 13px;
}
.skip-link:focus { left: 12px; top: 12px; }

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

/* ---------- Utility ---------- */
.section {
  padding: 110px 0;
  position: relative;
  border-top: 1px solid var(--border);
}
.section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section__eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 14px;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  margin-bottom: 48px;
  letter-spacing: -0.01em;
}

.dot-sep { color: var(--accent); margin: 0 6px; }

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 14px 26px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--accent);
  color: #0B0E11;
}
.btn--primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.btn--small { padding: 10px 16px; font-size: 12.5px; }
.btn--large { padding: 17px 34px; font-size: 15px; margin-top: 40px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(11, 14, 17, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.navbar.is-scrolled {
  border-bottom-color: var(--border);
  background: rgba(11, 14, 17, 0.92);
}
.navbar__inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar__logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar__logo-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 400;
}
.navbar__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-link__addr {
  font-size: 10.5px;
  color: var(--text-faint);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: var(--accent); }
.nav-link.is-active .nav-link__addr { color: var(--accent); }
.nav-link--cta {
  border: 1px solid var(--border-strong);
  color: var(--text);
  margin-left: 8px;
}
.nav-link--cta:hover { border-color: var(--accent); }

.navbar__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
}
.navbar__toggle span {
  display: block;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.navbar__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.navbar__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.hero__grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 20%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}
.hero__inner {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px var(--gutter);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
  width: 100%;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--run);
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: 100px;
}
.eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--run);
  box-shadow: 0 0 8px var(--run);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.hero__headline {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 10px;
}
.hero__subheadline {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 26px;
}
.hero__desc {
  max-width: 520px;
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 36px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 40px;
}
.hero__socials {
  display: flex;
  gap: 14px;
}
.hero__socials a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.hero__socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Signature hero visual: schematic signal-path diagram */
.hero__visual { display: flex; align-items: center; justify-content: center; }
.signal-diagram { width: 100%; max-width: 460px; height: auto; }
.signal-diagram .path {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.4;
}
.signal-diagram .pulse {
  fill: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent));
}
.signal-diagram .node circle {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1.4;
}
.signal-diagram .node--core circle {
  fill: var(--surface-2);
  stroke: var(--accent);
  stroke-width: 1.6;
}
.signal-diagram .node__icon {
  stroke: var(--text-muted);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.signal-diagram .node--core .node__icon,
.signal-diagram .node--core .node__chip {
  stroke: var(--accent);
}
.signal-diagram .node__chip {
  fill: none;
  stroke-width: 1.4;
}
.signal-diagram .node__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--text-faint);
  letter-spacing: 0.04em;
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}
.scroll-cue span {
  width: 3px;
  height: 6px;
  background: var(--accent);
  border-radius: 2px;
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(10px); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 60px;
  align-items: start;
}
.about__text {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 60ch;
}
.about__specs {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.spec {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.spec:last-child { border-bottom: none; }
.spec dt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.spec dd { font-weight: 500; text-align: right; }

/* ---------- Projects ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -20px rgba(0,0,0,0.6), 0 0 0 1px var(--border-strong);
}
.project-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.project-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-card__thumb-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: var(--text-faint);
  background:
    linear-gradient(135deg, var(--surface-2) 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(225deg, var(--surface-2) 25%, transparent 25%) -8px 0/16px 16px,
    var(--bg-alt);
}
.project-card__thumb--fallback img { display: none; }
.project-card__thumb--fallback .project-card__thumb-fallback { display: flex; }
.project-card__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.project-card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.project-card__desc {
  color: var(--text-muted);
  font-size: 14.5px;
  flex: 1;
}
.tag-list, .skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-list li {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(232, 163, 61, 0.25);
  padding: 5px 10px;
  border-radius: 4px;
}
.project-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.skill-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
}
.skill-block__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--text);
}
.skill-block__title i { color: var(--accent); font-size: 15px; }
.skill-tags li {
  font-size: 13.5px;
  color: var(--text-muted);
  padding: 9px 0;
  border-top: 1px dashed var(--border);
  width: 100%;
}
.skill-tags li:first-child { border-top: none; }

/* ---------- Experience / Timeline ---------- */
.timeline {
  position: relative;
  border-left: 1px solid var(--border);
  margin-left: 8px;
  padding-left: 34px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-bottom: 60px;
}
.timeline__item { position: relative; }
.timeline__marker {
  position: absolute;
  left: -41.5px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline__year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.timeline__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 6px 0 6px;
}
.timeline__desc { color: var(--text-muted); font-size: 14.5px; max-width: 60ch; }

.education-card {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 28px;
}
.education-card__icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.education-card__title { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.education-card__degree { color: var(--text-muted); font-size: 14.5px; margin-top: 2px; }
.education-card__years { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-top: 6px; }

/* ---------- Contact ---------- */
.section--contact {
  position: relative;
  text-align: center;
  overflow: hidden;
}
.section--contact .section__eyebrow,
.section--contact .section__title { position: relative; }
.section--contact .section__title { margin-bottom: 16px; }
.contact__desc {
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0 auto 48px;
  position: relative;
}
.contact__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.contact-card i { font-size: 22px; color: var(--accent); margin-bottom: 4px; }
.contact-card span { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.contact-card small { color: var(--text-faint); font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
}
.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer p { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); }
.footer__links { display: flex; gap: 16px; }
.footer__links a { color: var(--text-muted); font-size: 15px; transition: color 0.2s var(--ease); }
.footer__links a:hover { color: var(--accent); }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s var(--ease);
  z-index: 90;
}
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__visual { order: -1; max-width: 340px; margin: 0 auto; }
  .about__grid { grid-template-columns: 1fr; gap: 36px; }
  .skills__grid { grid-template-columns: repeat(2, 1fr); }
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .navbar__nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(11, 14, 17, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: stretch;
    padding: 12px var(--gutter) 24px;
    border-bottom: 1px solid var(--border);
    gap: 2px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .navbar__nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-link { padding: 14px 4px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav-link--cta { margin-left: 0; border: none; }
  .navbar__toggle { display: flex; }
}

@media (max-width: 640px) {
  .section { padding: 76px 0; }
  .projects__grid { grid-template-columns: 1fr; }
  .skills__grid { grid-template-columns: 1fr; }
  .contact__grid { grid-template-columns: 1fr; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { justify-content: center; }
  .about__specs { font-size: 14px; }
  .spec { padding: 14px 16px; }
  .education-card { flex-direction: column; text-align: center; }
}

@media (max-width: 400px) {
  .hero__name { font-size: 44px; }
}