/* ============================================================
   Abdurahiman Eleyedath Puthanveettil — abdurahiman.com
   Dark / techy personal-brand site
   ============================================================ */

:root {
  --bg: #0a0e14;
  --bg-alt: #0f151d;
  --surface: #131a23;
  --surface-2: #161f2a;
  --border: #223040;
  --text: #e7edf3;
  --text-dim: #93a4b8;
  --text-faint: #5c6b7e;
  --accent: #38e8c6;
  --accent-2: #7c9cff;
  --accent-soft: rgba(56, 232, 198, 0.12);
  --danger-glow: rgba(56, 232, 198, 0.35);
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  background-position: center top;
}

/* Sitewide ambient portrait background — same photo on every page,
   heavily blended into the dark theme so text stays fully readable. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(180deg, rgba(10,14,20,0.55) 0%, rgba(10,14,20,0.78) 55%, var(--bg) 92%),
    url('../img/profile.jpg');
  background-size: cover, cover;
  background-position: top center, top 8% center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  filter: grayscale(0.3) contrast(1.02) brightness(0.95);
  opacity: 0.65;
  pointer-events: none;
}
@media (max-width: 700px) {
  body::before { background-attachment: scroll, scroll; opacity: 0.5; }
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; color: var(--text); }

p { color: var(--text-dim); margin: 0 0 16px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.accent { color: var(--accent); }
.accent-2 { color: var(--accent-2); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 20, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.02em;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.cursor {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav {
  display: flex;
  gap: 28px;
}
.nav a {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  position: relative;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 12px 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  transition: all 0.18s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #04120f;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { box-shadow: 0 0 24px var(--danger-glow); transform: translateY(-1px); }
.btn-ghost {
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: scale(0.96); }

/* ---------- Hero ---------- */
.hero {
  padding: 90px 0 70px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 18px;
}
.hero-sub {
  max-width: 620px;
  font-size: 1.08rem;
}
.hero-cta { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

.hero-flex {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 40px;
  align-items: center;
}

.headline-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
}
.headline-pills span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  background: rgba(124, 156, 255, 0.08);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ---------- Photo frame ---------- */
.hero-photo { display: flex; justify-content: center; position: relative; }
.photo-frame {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 1 / 1.08;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(56,232,198,0.08), 0 24px 60px rgba(0,0,0,0.45);
}
.photo-frame::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: 0;
  border-radius: 22px;
  padding: 2px;
  background: conic-gradient(from var(--spin, 0deg), var(--accent), var(--accent-2), transparent 40%, var(--accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 6s linear infinite;
  opacity: 0.7;
}
@keyframes spin { to { --spin: 360deg; } }
@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.photo-frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.photo-frame.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-frame.no-photo::after {
  content: 'AEP';
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}
/* ---------- Resume-style small photo ---------- */
.resume-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--surface);
  margin-bottom: 20px;
  flex-shrink: 0;
}
.resume-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.resume-photo.lg { width: 128px; height: 128px; }
.resume-photo.no-photo::after {
  content: 'AEP';
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}

.frame-tag {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 2;
}

.glow-blob {
  position: absolute;
  width: 520px;
  height: 520px;
  right: -160px;
  top: -160px;
  background: radial-gradient(circle, rgba(56,232,198,0.16), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
  animation: floaty 8s ease-in-out infinite;
  z-index: 0;
}
@keyframes floaty {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 20px) scale(1.06); }
}

/* ---------- Stats ---------- */
.stats { padding: 46px 0; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.stat { text-align: left; }
.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent);
  font-weight: 700;
}
.stat-label { font-size: 0.82rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Sections ---------- */
.section { padding: 80px 0; border-bottom: 1px solid var(--border); }
.section-tight { padding: 56px 0; }
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
  margin-right: 10px;
  vertical-align: middle;
}
.two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 56px;
  align-items: start;
}

/* ---------- Terminal / quote block ---------- */
.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 0 28px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(56, 232, 198, 0.06);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.terminal-bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}
.terminal-bar span:nth-child(1) { background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal-bar p {
  margin: 0 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.terminal-quote {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--text);
  padding: 28px 28px 6px;
  margin: 0;
  min-height: 90px;
  transition: opacity 0.4s ease;
}
.terminal-sign {
  font-family: var(--font-mono);
  color: var(--accent);
  padding: 0 28px;
  margin: 0;
  font-size: 0.9rem;
}

/* ---------- Pills / lists ---------- */
.pill-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.pill-list li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
}

.link-arrow { font-family: var(--font-mono); font-size: 0.9rem; }

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card h3 { margin-bottom: 8px; }
.card p { font-size: 0.92rem; margin-bottom: 0; }
.card .card-icon { color: var(--accent); font-family: var(--font-mono); font-size: 0.8rem; margin-bottom: 10px; display: block; }

/* ---------- Timeline (Experience) ---------- */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 42px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.role-title { color: var(--text); font-family: var(--font-mono); font-size: 1.05rem; margin-bottom: 2px; }
.role-meta { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-2); margin-bottom: 10px; }
.role-desc { font-size: 0.95rem; }
.role-desc ul { margin: 10px 0 0; padding-left: 18px; }
.role-desc li { margin-bottom: 6px; }

/* ---------- Quote grid (Writing page) ---------- */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 22px 24px;
}
.quote-card p.q { font-family: var(--font-mono); color: var(--text); font-size: 1rem; margin-bottom: 10px; }
.quote-card p.sign { color: var(--text-faint); font-size: 0.82rem; margin: 0; font-family: var(--font-mono); }

.post-list { display: flex; flex-direction: column; gap: 18px; }
.post-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}
.post-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-faint); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 36px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 26px;
  text-align: left;
}
.contact-card .label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 10px; }
.contact-card .value { font-size: 1.05rem; color: var(--text); }

/* ---------- Banner (Contact page) ---------- */
.banner-img {
  width: 100%;
  aspect-ratio: 1536 / 1024;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  margin: 28px 0 0;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
@media (max-width: 700px) {
  /* The full banner has small embedded text that's unreadable at phone width —
     crop in on the portrait side instead of shrinking the whole graphic. */
  .banner-img {
    aspect-ratio: 4 / 5;
    object-position: 80% 20%;
  }
}

/* ---------- Footer ---------- */
.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.footer-social a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.site-footer { padding: 34px 0; }
.footer-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-wrap p { margin: 0; font-size: 0.85rem; color: var(--text-faint); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d1.in { transition-delay: 0.08s; }
.reveal.d2.in { transition-delay: 0.16s; }
.reveal.d3.in { transition-delay: 0.24s; }
.reveal.d4.in { transition-delay: 0.32s; }

/* ---------- Callout / mission box ---------- */
.callout {
  background: linear-gradient(135deg, rgba(56,232,198,0.08), rgba(124,156,255,0.05));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  position: relative;
}
.callout p {
  color: var(--text);
  font-size: 1.05rem;
  margin: 0;
}
.callout .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ---------- Research list ---------- */
.research-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.research-list li {
  font-size: 0.92rem;
  color: var(--text-dim);
  padding-left: 18px;
  position: relative;
}
.research-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ---------- Page header (inner pages) ---------- */
.page-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--border); }
.page-hero .eyebrow { margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; gap: 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .quote-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .hero-flex { grid-template-columns: 1fr; }
  .hero-photo { order: -1; margin-bottom: 8px; }
  .glow-blob { width: 340px; height: 340px; right: -100px; top: -100px; }
}

@media (max-width: 700px) {
  .nav {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    flex-direction: column;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.32s ease, opacity 0.28s ease, transform 0.28s ease, padding 0.32s ease;
  }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--border); width: 100%; }
  .nav a:last-child { border-bottom: none; }
  .nav.open { max-height: 320px; opacity: 1; transform: translateY(0); padding: 10px 24px 18px; }
  .nav-toggle { display: flex; z-index: 60; }
  .nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.active span:nth-child(2) { opacity: 0; }
  .nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-toggle span { transition: transform 0.22s ease, opacity 0.22s ease; }
}
