/* ========================================
   Zarif Aziz — Personal Site
   Inspired by Parsed.com aesthetics
   ======================================== */

/* ---------- CSS Variables ---------- */
:root {
  --bg: #ffffff;
  --bg-subtle: #f9f9f8;
  --text: #1c1917;
  --text-muted: #78716c;
  --accent: #292524;
  --accent-hover: #44403c;
  --link: #78716c;
  --link-hover: #1c1917;
  --border: #e7e5e4;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

/* ---------- Layout ---------- */
.container {
  display: flex;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Sidebar Navigation ---------- */
.sidebar {
  width: 160px;
  flex-shrink: 0;
  padding: 4.5rem 2rem 4.5rem 3rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.logo {
  font-family: 'Space Grotesk', var(--font-sans);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 3rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav a {
  padding: 0.4rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
}

/* ---------- Main Content ---------- */
.main {
  flex: 1;
  padding: 4.5rem 0 6rem 5rem;
  max-width: 640px;
  border-left: 1px solid var(--border);
  margin-left: 0;
  padding-left: 5rem;
}

/* ---------- Sections ---------- */
.section {
  margin-bottom: 5rem;
}

.section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ---------- Hero / Now Section ---------- */
.hero-title {
  font-family: var(--font-serif);
  font-size: 3.25rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

.hero-title .muted {
  color: var(--text-muted);
}

.hero-description {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 0.75rem;
}

.hero-location {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

/* ---------- List Items (Writing, Projects, Tools) ---------- */
.item-list {
  list-style: none;
}

.item-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.item-list li:first-child {
  border-top: 1px solid var(--border);
}

.item-list a,
.item-list .item-title {
  color: var(--text);
  font-size: 0.95rem;
}

.item-list a:hover {
  color: var(--accent-hover);
}

.item-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.item-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* More link */
.more-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.more-link:hover {
  color: var(--text);
}

.more-link::after {
  content: ' →';
  transition: transform 0.2s ease;
}

/* ---------- Footer Links ---------- */
.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.social-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.social-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.social-links a:hover {
  color: var(--text);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
    padding: 0 1.5rem;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 2rem 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .logo {
    margin-bottom: 0;
    font-size: 1.5rem;
  }

  .nav {
    flex-direction: row;
    gap: 1.5rem;
  }

  .main {
    padding: 2rem 0 4rem;
    max-width: 100%;
    border-left: none;
    padding-left: 0;
  }

  .hero-title {
    font-size: 2.25rem;
  }

}

@media (max-width: 600px) {
  .sidebar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .nav {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .item-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .hero-title {
    font-size: 1.85rem;
  }
}

/* ---------- Section Header with Animation Icon ---------- */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-header .section-title {
  margin-bottom: 0;
}

/* ---------- Animated Section Icons ---------- */
.section-anim {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}


/* ── Writing section — typing cursor with lines ── */
.anim-writing {
  background: #1c1917;
}

.anim-writing div:nth-child(1),
.anim-writing div:nth-child(2),
.anim-writing div:nth-child(3) {
  position: absolute;
  left: 10px;
  height: 1.5px;
  border-radius: 1px;
  background: #78716c;
}

.anim-writing div:nth-child(1) {
  top: 14px;
  width: 28px;
  animation: typeReveal 2.5s ease-in-out infinite;
}

.anim-writing div:nth-child(2) {
  top: 22px;
  width: 20px;
  animation: typeReveal 2.5s ease-in-out infinite 0.5s;
}

.anim-writing div:nth-child(3) {
  top: 30px;
  width: 24px;
  animation: typeReveal 2.5s ease-in-out infinite 1s;
}

.anim-writing::after {
  content: '';
  position: absolute;
  top: 13px;
  left: 10px;
  width: 1.5px;
  height: 10px;
  background: #d6d3d1;
  animation: cursorBlink 1s step-end infinite, cursorMove 2.5s ease-in-out infinite;
}

@keyframes typeReveal {
  0% { width: 0; opacity: 0; }
  20% { opacity: 0.6; }
  50% { width: 28px; opacity: 0.6; }
  80% { opacity: 0.3; }
  100% { opacity: 0.6; }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes cursorMove {
  0% { left: 10px; top: 13px; }
  33% { left: 38px; top: 13px; }
  34% { left: 10px; top: 21px; }
  66% { left: 30px; top: 21px; }
  67% { left: 10px; top: 29px; }
  100% { left: 34px; top: 29px; }
}

/* ── Projects section — spinning 3D cube wireframe ── */
.anim-projects {
  background: #0a0a0a;
  perspective: 120px;
}

.anim-projects div {
  position: absolute;
  border: 1px solid #57534e;
  background: transparent;
}

.anim-projects div:nth-child(1) {
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: cubeRotate 8s linear infinite;
  transform-style: preserve-3d;
}

.anim-projects div:nth-child(2) {
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-color: #78716c;
  animation: cubeRotate 8s linear infinite reverse;
}

.anim-projects div:nth-child(3) {
  width: 26px;
  height: 26px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-color: #44403c;
  animation: cubeRotate 12s linear infinite;
  opacity: 0.5;
}

@keyframes cubeRotate {
  0% { transform: translate(-50%, -50%) rotate(0deg); border-radius: 0; }
  25% { border-radius: 2px; }
  50% { transform: translate(-50%, -50%) rotate(180deg); border-radius: 50%; }
  75% { border-radius: 2px; }
  100% { transform: translate(-50%, -50%) rotate(360deg); border-radius: 0; }
}

/* ---------- Motion One Reveal ---------- */
/* Elements start hidden, Motion One animates them in */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
}

.item-list li {
  transition: background 0.2s ease, transform 0.2s ease;
}

.item-list li:hover {
  background: var(--bg-subtle);
}

/* No-JS fallback: if script doesn't load, show content */
@media (scripting: none) {
  [data-reveal] { opacity: 1; transform: none; }
}
