/* Base Theme */
:root {
  --bg: #0b0d10;
  --surface: #12161b;
  --text: #e7edf3;
  --muted: #a3b1c2;
  --brand: #7c4dff;
  --brand-2: #00e5ff;
  --card: #12161b;
  --card-border: #1e2630;
  --tag-bg: #1a2230;
  --link: #9ad5ff;
  --success: #2ecc71;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124,77,255,0.15), transparent 40%),
              radial-gradient(800px 400px at 110% 10%, rgba(0,229,255,0.12), transparent 40%),
              var(--bg);
  line-height: 1.6;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11,13,16,0.6);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0.5rem;
}
.id-block { display: flex; align-items: center; gap: 0.75rem; }
.id-block h1 { margin: 0; font-size: 1.75rem; }
.logo { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--card-border); object-fit: cover; }
#tagline { margin: 0.2rem 0 0; color: var(--muted); }
.contact a { color: var(--link); text-decoration: none; margin-right: 1rem; }
.contact a:hover { text-decoration: underline; }

.site-nav a {
  color: var(--text);
  text-decoration: none;
  margin-left: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid transparent;
}
.site-nav a:hover {
  border-color: var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

/* Cards */
.card {
  margin: 1.2rem auto;
  padding: 1.2rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.card h2 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon next to section headings */
.section-icon {
  display: inline-block;
  border-radius: 4px;
  /* Improve visibility on gradients/dark backgrounds while respecting alpha */
  filter: drop-shadow(0 0 0.5px rgba(0,0,0,0.6)) drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

/* Grid for projects */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.project {
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Make square cards; height follows width */
  aspect-ratio: 1 / 1;
}
.project h3 { margin-top: 0; font-size: 1.1rem; }
.project a { color: var(--link); }
.project .keywords { margin-top: auto; }

/* Project with background image */
.project.has-bg {
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}
/* Hover overlay to darken the image only on hover */
.project.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 160ms ease;
  pointer-events: none;
}
.project.has-bg:hover::before,
.project.has-bg:focus-within::before {
  background: rgba(0,0,0,0.45);
}
/* Hide text by default; reveal on hover */
.project.has-bg h3,
.project.has-bg p,
.project.has-bg .tags {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.project.has-bg:hover h3,
.project.has-bg:hover p,
.project.has-bg:hover .tags,
.project.has-bg:focus-within h3,
.project.has-bg:focus-within p,
.project.has-bg:focus-within .tags {
  opacity: 1;
  transform: translateY(0);
}
.project.has-bg .tags span {
  border-color: rgba(255,255,255,0.22);
}
.project.has-bg .view-btn {
  border-color: rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.3);
}

/* Full-card cover link to make whole card clickable */
.project .project-cover {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  /* Put overlay above content to capture clicks */
  z-index: 5;
  /* No visible content */
  color: transparent;
  text-indent: -9999px;
}
.project .project-cover:focus {
  outline: 2px solid var(--brand-2);
  outline-offset: -2px;
}
.project:hover { border-color: var(--brand-2); }

/* Touch devices: always show text; optional mild overlay for readability */
@media (hover: none) {
  .project.has-bg::before {
    background: rgba(0,0,0,0.25);
  }
  .project.has-bg h3,
  .project.has-bg p,
  .project.has-bg .tags {
    opacity: 1;
    transform: none;
  }
}

/* Lists */
#work-list .job { margin-bottom: 1rem; }
#work-list .job h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
#work-list ul { margin: 0.5rem 0 0 1rem; }

#education-list .edu { margin-bottom: 0.8rem; }

.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li { background: var(--tag-bg); border: 1px solid var(--card-border); padding: 0.35rem 0.6rem; border-radius: 999px; color: var(--text); }

/* Footer */
.site-footer { color: var(--muted); border-top: 1px solid var(--card-border); margin-top: 2rem; }
.site-footer .container { padding: 2rem 0.5rem 2.4rem; }
#footer-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }

/* Utilities */
.muted { color: var(--muted); }
.hidden { display: none; }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
}
.btn-lg { padding: 0.65rem 1rem; font-weight: 600; }
.btn:hover { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(0,229,255,0.15) inset; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal.hidden { display: none; }
.modal-dialog {
  width: min(640px, 96vw);
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

/* Form */
.form { display: grid; gap: 0.8rem; margin-top: 0.5rem; }
.form-row { display: grid; gap: 0.35rem; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #0f141a;
  color: var(--text);
}
.form-actions { display: flex; align-items: center; gap: 0.8rem; }

/* Responsive tweaks */
@media (max-width: 720px) {
  .header-inner { grid-template-columns: 1fr; }
  .site-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .site-nav a { margin: 0; }
}
