/* ==========================================================================
   Utterly Superb — Single-Page Homepage & Experiment Index
   Zero-dependency modern CSS (Mobile-first, Light/Dark adaptive)
   ========================================================================== */

:root {
  color-scheme: light dark;
  interpolate-size: allow-keywords;

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

  /* Adaptive Color Palette via light-dark() */
  --bg-page: light-dark(#fafaf9, #0c0a09);
  --bg-surface: light-dark(#ffffff, #161412);
  --bg-surface-hover: light-dark(#f5f5f4, #1f1c1a);
  --bg-surface-open: light-dark(#ffffff, #191715);
  --bg-pill: light-dark(#f0efed, #262320);

  --text-primary: light-dark(#1c1917, #f5f5f4);
  --text-secondary: light-dark(#57534e, #a8a29e);
  --text-muted: light-dark(#78716c, #78716c);

  --border-subtle: light-dark(#e7e5e4, #292524);
  --border-strong: light-dark(#d6d3d1, #44403c);

  --accent: light-dark(#4f46e5, #818cf8);
  --accent-soft: light-dark(rgba(79, 70, 229, 0.08), rgba(129, 140, 248, 0.14));

  /* Layout & Spacing */
  --max-width: 48rem; /* 768px */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: light-dark(
    0 1px 2px rgba(28, 25, 23, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.3)
  );
  --shadow-open: light-dark(
    0 8px 24px -4px rgba(28, 25, 23, 0.07),
    0 10px 28px -6px rgba(0, 0, 0, 0.55)
  );
}

/* Explicit theme override support */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

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

img,
svg {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  background-color: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Page Container
   ========================================================================== */

.page-shell {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
  padding-block: clamp(1.5rem, 5vw, 3.5rem);
  flex: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block-end: 1.5rem;
  border-block-end: 1px solid var(--border-subtle);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.45rem;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.header-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

/* ==========================================================================
   Top Hero Banner & Intro Section
   ========================================================================== */

.hero-banner {
  width: 100%;
  max-width: 100%;
  margin: 1.25rem 0 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-pill);
}

.hero-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.intro {
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
}

.intro-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.intro-lead {
  margin: 0;
  max-width: 60ch;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.125rem);
  text-wrap: pretty;
}

/* ==========================================================================
   Projects Concertina (Accordion) Section
   ========================================================================== */

.projects-section {
  margin-block-start: 0.5rem;
}

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 0.85rem;
}

.section-heading {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.expand-toggle-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0.25rem 0.4rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0.35rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.expand-toggle-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Individual Concertina Item (<details>) */
.project-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: clip;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.project-item:hover {
  border-color: var(--border-strong);
}

.project-item[open] {
  background-color: var(--bg-surface-open);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-open);
}

.project-item--placeholder {
  border-style: dashed;
  opacity: 0.78;
}

.project-item--placeholder:hover,
.project-item--placeholder[open] {
  opacity: 1;
}

/* Summary Row (Trigger) */
.project-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.9rem 1.1rem;
  min-height: 3.75rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.project-summary::-webkit-details-marker {
  display: none;
}

.project-summary:hover {
  background-color: var(--bg-surface-hover);
}

.project-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Project Icon Slot */
.project-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.6rem;
  overflow: hidden;
  display: grid;
  place-items: center;
  background-color: var(--bg-pill);
  border: 1px solid var(--border-subtle);
}

.project-icon img,
.project-icon svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Summary Title + Brief */
.project-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

@media (min-width: 38rem) {
  .project-heading {
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
  }
}

.project-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category Badge + Chevron */
.project-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.project-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background-color: var(--bg-pill);
  color: var(--text-secondary);
}

.project-badge--wip,
.project-tags li.tag-wip {
  background-color: light-dark(#fef3c7, rgba(245, 158, 11, 0.16));
  color: light-dark(#b45309, #fbbf24);
  border: 1px solid light-dark(#fde68a, rgba(245, 158, 11, 0.35));
}

@media (min-width: 30rem) {
  .project-badge {
    display: inline-block;
  }
}

.chevron {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  transition: rotate 0.25s cubic-bezier(0.22, 1, 0.36, 1), color 0.15s ease;
}

.project-item[open] .chevron {
  rotate: 180deg;
  color: var(--text-primary);
}

/* ==========================================================================
   Smooth Concertina Animation via ::details-content
   ========================================================================== */

@supports selector(::details-content) {
  @media (prefers-reduced-motion: no-preference) {
    .project-item::details-content {
      block-size: 0;
      opacity: 0;
      overflow: clip;
      transition:
        block-size 0.3s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.25s ease,
        content-visibility 0.3s ease allow-discrete;
    }

    .project-item[open]::details-content {
      block-size: auto;
      opacity: 1;
    }
  }
}

/* Expanded Content Area */
.project-body {
  padding: 0.25rem 1.1rem 1.25rem;
  border-block-start: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding-block-start: 1.1rem;
}

/* 2-column layout on tablet/desktop only when a media preview is present */
@media (min-width: 40rem) {
  .project-body:has(.project-media) {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

.project-info {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.project-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  text-wrap: pretty;
}

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

.project-tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.35rem;
  background-color: var(--bg-pill);
  color: var(--text-secondary);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-block-start: 0.2rem;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary:hover {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-secondary {
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

/* Screenshot / Media Slot */
.project-media {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill);
}

.project-media img {
  width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-block-start: 3.5rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

