/* styles.css — Jackson Pollock–inspired portfolio */
/* Design notes:
   - Neutral structure with bursts of energetic, splattered color (via canvas).
   - Strong typographic rhythm; ample whitespace to balance the chaos.
   - Cards float above a textural background with subtle glass effect.
*/

:root {
  --bg: #0f0f11;
  --bg-elev: rgba(18, 18, 20, 0.7);
  --text: #f2f2f2;
  --muted: #b9bcc6;
  --accent: #e6b805; /* ochre */
  --accent-2: #c73b2a; /* crimson */
  --accent-3: #37a0d8; /* cerulean */
  --accent-4: #6cc070; /* viridian */
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --container: clamp(16rem, 85vw, 1100px);
  --border: rgba(255, 255, 255, 0.08); /* NEW: default border for dark */
  --sticky-header: linear-gradient(
    180deg,
    rgba(10, 10, 12, 0.7),
    rgba(10, 10, 12, 0.35)
  );
}

/* Light theme override */
:root[data-theme="light"] {
  --bg: #f7f7f8;
  --bg-elev: rgba(255, 255, 255, 0.82);
  --text: #17181a;
  --muted: #4b4f57;
  /* Accents keep the same palette to stay on brand */
  --accent: #e6b805;
  --accent-2: #c73b2a;
  --accent-3: #37a0d8;
  --accent-4: #6cc070;
  --border: rgba(0, 0, 0, 0.12); /* NEW: border for light */
  --sticky-header: none;
}

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

html,
body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Background canvas should sit behind everything */
#pollock-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(
      1200px 800px at 20% -10%,
      #1a1a1c 0%,
      transparent 60%
    ),
    radial-gradient(900px 600px at 110% 20%, #151518 0%, transparent 50%),
    #0f0f11;
}

:root[data-theme="light"] #pollock-canvas {
  background: radial-gradient(
      1200px 800px at 20% -10%,
      #ffffff 0%,
      transparent 60%
    ),
    radial-gradient(900px 600px at 110% 20%, #eef0f4 0%, transparent 50%),
    #f7f7f8;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: var(--sticky-header);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.75rem;
}

.logo {
  display: inline-grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #0b0b0c;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 8px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  margin: 6px auto;
  width: 22px;
  background: var(--text);
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.85;
}
.nav a:hover,
.nav a:focus {
  opacity: 1;
  text-decoration: underline;
}

/* Hero */
.hero {
  min-height: clamp(60vh, 75vh, 86vh);
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: min(12vh, 8rem);
}

.hero-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  padding: clamp(1.2rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.5px;
}

.subtitle {
  margin: 0.5rem 0 1.5rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-decoration: none;
  color: var(--text);
  transition: transform 150ms ease, background 200ms ease, box-shadow 200ms ease;
  margin: 0.25rem;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #0b0b0c;
  border: none;
  box-shadow: var(--shadow);
}
.btn.ghost {
  background: var(--border);
}

/* Sections */
section {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.25rem);
  margin: 0 0 1rem 0;
  letter-spacing: -0.3px;
}

/* Work grid */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(0.75rem, 2vw, 1rem);
}

.card {
  grid-column: span 6;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: clip;
  transform: translateY(6px);
  transition: transform 200ms ease, box-shadow 200ms ease,
    border-color 200ms ease;
}
.card:hover {
  transform: translateY(0);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.card:focus-within {
  border-color: rgba(255, 255, 255, 0.2);
}

.card-body {
  padding: clamp(1rem, 3vw, 1.25rem);
}

.card h3 {
  margin: 0 0 0.25rem 0;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
}

.card p {
  color: var(--muted);
  margin: 0.25rem 0 0.75rem 0;
}
/* Cards with media — image always on top */
.card.has-media {
  display: block; /* stack */
}

.card.has-media .card-media {
  position: relative;
  aspect-ratio: 16 / 9; /* consistent banner height */
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* on-brand, slight crop if needed */
  transform: scale(1);
  transition: transform 200ms ease;
}

.card.has-media:hover .card-media img {
  transform: scale(1.02); /* subtle lift on hover */
}

.link {
  color: var(--accent-3);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.link.small {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* About */
.about .about-content {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(1rem, 3vw, 2rem);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow);
}

.traits {
  list-style: "•  ";
  margin: 0;
  padding-left: 1ch;
  color: var(--muted);
}
.traits li {
  margin: 0.25rem 0;
}

/* Contact */
.contact-form {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow);
  max-width: 720px;
}

.form-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
label {
  color: var(--muted);
  font-size: 0.95rem;
}
input,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}
input:focus,
textarea:focus {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(55, 160, 216, 0.25);
}
.form-hint {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  text-align: center;
  color: var(--muted);
}
.site-footer .container {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  translate: 0 12px;
  transition: opacity 600ms ease, translate 600ms ease;
}
.reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

/* Floating action buttons (sticky corners) */
.fab {
  position: fixed;
  z-index: 9999;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  pointer-events: none; /* contain clicks to inner button */
}
.fab-left {
  left: 16px;
}
.fab-right {
  right: 16px;
}

.fab-btn {
  pointer-events: auto;
  inline-size: 48px;
  block-size: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 18px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease,
    border-color 160ms ease;
}
.fab-btn:hover {
  transform: translateY(-1px);
}
.fab-btn[aria-pressed="true"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #0b0b0c;
}

/* Smooth theme transition */
html.theme-transition body,
html.theme-transition .site-header,
html.theme-transition .site-footer,
html.theme-transition .hero-content,
html.theme-transition .card,
html.theme-transition .about .about-content,
html.theme-transition .contact-form,
html.theme-transition .nav ul,
html.theme-transition input,
html.theme-transition textarea,
html.theme-transition .post,
html.theme-transition .aside-card,
html.theme-transition .toc,
html.theme-transition #pollock-canvas,
html.theme-transition #bg-canvas {
  transition: background-color 320ms ease, color 320ms ease,
    border-color 320ms ease, background 320ms ease;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html.theme-transition body,
  html.theme-transition .site-header,
  html.theme-transition .site-footer,
  html.theme-transition .hero-content,
  html.theme-transition .card,
  html.theme-transition .about .about-content,
  html.theme-transition .contact-form,
  html.theme-transition .nav ul,
  html.theme-transition input,
  html.theme-transition textarea,
  html.theme-transition .post,
  html.theme-transition .aside-card,
  html.theme-transition .toc,
  html.theme-transition #pollock-canvas,
  html.theme-transition #bg-canvas {
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .fab-left {
    left: 12px;
  }
  .fab-right {
    right: 12px;
  }
  .fab-btn {
    inline-size: 44px;
    block-size: 44px;
    font-size: 16px;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .grid .card {
    grid-column: span 12;
  }
  .about .about-content {
    grid-template-columns: 1fr;
  }
  .nav-toggle {
    display: inline-block;
  }
  .nav ul {
    position: absolute;
    right: 1rem;
    top: 60px;
    background: var(--bg-elev);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: none;
    flex-direction: column;
    gap: 0.5rem;
  }
  .nav[data-open="true"] ul {
    display: flex;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .reveal {
    transition: none !important;
  }
}

/* Tag filter toolbar */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
}

.tag-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease,
    border-color 160ms ease;
}
.tag-chip:hover {
  transform: translateY(-1px);
}
.tag-chip.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #0b0b0c;
  border-color: transparent;
}

/* Tag pills on cards */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--border);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Hidden state for filtered cards (accessible) */
.card[hidden] {
  display: none !important;
}
