/* =====================================================
   Ahilan Bhattacharya — Portfolio
   Plain HTML/CSS. One stylesheet, two themes:
   - light (default): beige background, black text
   - dark (toggle):   grey/black background, green text
   Theme is switched by setting data-theme="dark" on <html>
   (see script.js). No frameworks, no build step.
   ===================================================== */

:root {
  --bg: #f2ead6;
  --text: #111111;
  --line: rgba(0, 0, 0, 0.15);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg: #0e0f0e;
  --text: #39ff33;
  --line: rgba(57, 255, 51, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

[data-theme="dark"] body {
  font-family: var(--font-mono);
}

a {
  color: inherit;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.7;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  opacity: 1;
}

.site-nav a[aria-current="page"] {
  opacity: 1;
  font-weight: 700;
  border-bottom-color: currentColor;
}

/* Dark mode toggle */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.4rem;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s ease;
}

[data-theme="dark"] .toggle-thumb {
  transform: translateX(14px);
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  min-width: 2.6em;
  text-align: left;
}

/* ---------- Shared page bits ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
  margin: 0 0 1rem;
}

/* ---------- Hero (About Me / landing page) ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  max-width: 18ch;
}

[data-theme="dark"] .hero h1 {
  text-shadow: 0 0 16px rgba(57, 255, 51, 0.35);
}

.hero .lede {
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 55ch;
  opacity: 0.8;
  margin: 0;
}

/* ---------- Generic inner page (Blogs / Projects / Contact) ---------- */

.page {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

.page h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 2.5rem;
}

.entry {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}

.entry:last-of-type {
  border-bottom: 1px solid var(--line);
}

.entry .when {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  opacity: 0.6;
  padding-top: 0.2rem;
}

.entry h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.entry p {
  margin: 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

.entry .tag {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  opacity: 0.7;
}

.empty-note {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  opacity: 0.6;
  font-size: 0.92rem;
}

/* ---------- Contact page ---------- */

.contact-list {
  display: flex;
  flex-direction: column;
}

.contact-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.contact-list a:last-child {
  border-bottom: 1px solid var(--line);
}

.contact-list a:hover {
  opacity: 0.6;
}

.contact-list .platform {
  font-size: 1.35rem;
  font-weight: 700;
}

.contact-list .handle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  opacity: 0.65;
  white-space: nowrap;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ---------- Accessibility ---------- */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .header-inner {
    padding: 1rem 1.25rem;
  }

  .site-nav {
    gap: 1.1rem;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .contact-list a {
    flex-direction: column;
    gap: 0.3rem;
  }
}
