/* ==========================================================================
   Joseph Obaje: portfolio styles
   Light theme by default; dark theme via [data-theme="dark"] or the OS setting.
   ========================================================================== */

:root {
  --bg: #fff;
  --bg-alt: #f4f7f6;
  --surface: #fff;
  --text: #15201e;
  --muted: #4a5a57;
  --border: #dbe4e2;
  --primary: #0f766e;
  --primary-strong: #0b5f58;
  --on-primary: #fff;
  --accent: #b45309;
  --tag-bg: #e6f2f0;
  --tag-text: #0b5f58;
  --error: #b42318;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 16px rgb(16 24 40 / 6%);
  --radius: 14px;
  --max-width: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1412;
    --bg-alt: #121c1a;
    --surface: #16211f;
    --text: #e7efed;
    --muted: #a3b3b0;
    --border: #26332f;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --on-primary: #04201c;
    --accent: #fbbf24;
    --tag-bg: #173430;
    --tag-text: #99f6e4;
    --error: #fda29b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1412;
  --bg-alt: #121c1a;
  --surface: #16211f;
  --text: #e7efed;
  --muted: #a3b3b0;
  --border: #26332f;
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --on-primary: #04201c;
  --accent: #fbbf24;
  --tag-bg: #173430;
  --tag-text: #99f6e4;
  --error: #fda29b;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);

  color-scheme: dark;
}

/* Base ------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--primary-strong);
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
}

h3 {
  font-size: 1.15rem;
}

ul {
  padding: 0;
}

.container {
  width: min(100% - 2.5rem, var(--max-width));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  color: var(--on-primary);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.9rem;
}

.nav-menu {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  list-style: none;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.nav-menu a:hover,
.nav-menu a[aria-current="true"] {
  background: var(--tag-bg);
  color: var(--tag-text);
}

.nav-toggle,
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle {
  display: none;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle[aria-pressed="true"] .icon-sun {
  display: block;
}

.theme-toggle[aria-pressed="true"] .icon-moon {
  display: none;
}

@media (width <= 760px) {
  .nav-toggle {
    display: inline-grid;
    order: 2;
  }

  .theme-toggle {
    order: 1;
  }

  .nav-menu {
    position: absolute;
    inset: 4rem 0 auto;
    display: none;
    flex-direction: column;
    padding: 0.75rem 1.25rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .nav-menu.is-open {
    display: flex;
  }
}

/* Hero ------------------------------------------------------------------- */

.hero {
  padding: clamp(4rem, 10vw, 7.5rem) 0 clamp(3.5rem, 8vw, 6rem);
  background:
    radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 70%),
    radial-gradient(40rem 20rem at -10% 110%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 1.5rem + 3.2vw, 3.75rem);
  letter-spacing: -0.02em;
  max-width: 18ch;
}

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

.lead {
  max-width: 60ch;
  font-size: 1.2rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-strong);
  color: var(--on-primary);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--text);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  list-style: none;
  font-weight: 500;
}

/* Sections --------------------------------------------------------------- */

.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-intro {
  max-width: 65ch;
  color: var(--muted);
  margin-top: 0;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 2rem;
}

.about-body p:first-child {
  margin-top: 0;
}

@media (width <= 760px) {
  .about {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Tags ------------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  list-style: none;
}

.tags li {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.9rem;
  font-weight: 500;
}

.tags-sm li {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
}

/* Skills ----------------------------------------------------------------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.skill-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Projects --------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.filter-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--primary);
}

.filter-btn[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1.25rem;
  margin: 0;
  list-style: none;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover,
.project-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.project-card[hidden] {
  display: none;
}

.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.project-thumb-placeholder {
  display: grid;
  place-items: center;
  font-size: 4rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 30%, transparent), color-mix(in srgb, var(--accent) 25%, transparent));
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
}

.project-body h3 {
  margin: 0;
}

.project-body h3 a {
  color: var(--text);
  text-decoration: none;
}

/* Make the whole card clickable while keeping a single, labelled link. */
.project-body h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.project-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.project-body .tags {
  margin-top: auto;
}

.more-link {
  margin-top: 2rem;
  font-weight: 600;
}

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

.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 2.5rem;
  align-items: start;
}

.contact-list {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  list-style: none;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.contact-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field textarea {
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline-offset: 0;
}

.field [aria-invalid="true"] {
  border-color: var(--error);
}

.field-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--error);
  font-size: 0.875rem;
}

.contact-form .btn {
  justify-self: start;
}

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

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.footer-inner p {
  margin: 0;
}

/* Motion ----------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Print ------------------------------------------------------------------ */

@media print {
  .site-header,
  .filters,
  .contact-form,
  .hero-actions {
    display: none;
  }
}

/* Hero terminal card ----------------------------------------------------- */

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}

.hero-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid #1f2d2a;
  border-radius: var(--radius);
  background: #0b1513;
  box-shadow: 0 20px 50px rgb(4 32 28 / 25%);
}

.hero-card-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  background: #13211e;
}

.hero-card-bar span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #f87171;
}

.hero-card-bar span:nth-child(2) {
  background: #fbbf24;
}

.hero-card-bar span:nth-child(3) {
  background: #34d399;
}

.hero-card pre {
  margin: 0;
  padding: 1.1rem 1.25rem 1.4rem;
  overflow-x: auto;
  color: #d1e7e2;
  font: 0.92rem/1.7 ui-monospace, "Cascadia Code", "Source Code Pro", menlo, consolas, monospace;
}

.hero-card .prompt {
  color: #2dd4bf;
  font-weight: 700;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background: #2dd4bf;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (width <= 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}
