:root {
  --bg: #050505;
  --bg-elevated: #0d0d0d;
  --text: #f5f5f5;
  --muted: #a0a0a0;
  --accent: #ffffff;
  --border: #252525;
  --shadow-soft: 0 0 0 1px #111, 0 18px 40px rgba(0, 0, 0, 0.8);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #151515 0, #050505 50%, #000 100%);
  color: var(--text);
  font-family: var(--font-mono);
}

body {
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 1.5rem 1.1rem;
}

.shell {
  margin: 0 auto;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 960px; /* default for small/medium screens */
  background: radial-gradient(
    circle at top left,
    #111 0,
    #060606 55%,
    #000 100%
  );
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 1.75rem 1.5rem 1.5rem;
}

/* Header */
.site-header {
  margin: 0 auto;
  width: 100%;
  max-width: 960px; /* match shell default */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.65);
}

.site-nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  font-size: 0.75rem;
  text-decoration: none;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 0.32rem 0.7rem;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.4);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  border-color: var(--border);
  outline: none;
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 1.8rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 1.85rem;
  margin: 0;
  margin-bottom: 0.4rem;
}

.hero-subtitle {
  margin: 0;
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

.hero-sub-links {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-sub-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.hero-sub-links a:hover,
.hero-sub-links a:focus-visible {
  border-bottom-style: solid;
  outline: none;
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

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

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #f5f5f5;
  border-color: #f5f5f5;
  outline: none;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: #666;
  outline: none;
}

/* Grid / cards */
.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.grid--narrow {
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
  padding: 1rem 1rem 0.9rem;
}

.card--highlight {
  border: 1px solid #444;
}

.card-title {
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.card-body {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.card-list {
  margin: 0.1rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.card-list li + li {
  margin-top: 0.18rem;
}

/* Projects */
.project-block {
  border-radius: 12px;
  border: 1px solid #333;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.7rem;
  background: rgba(0, 0, 0, 0.5);
}

.project-title {
  font-size: 0.9rem;
  margin: 0 0 0.25rem;
}

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

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.project-meta span {
  border-radius: var(--radius-pill);
  border: 1px solid #333;
  padding: 0.16rem 0.55rem;
}

.project-list {
  margin: 0.1rem 0 0.4rem;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.project-link {
  font-size: 0.78rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  color: var(--accent);
}

.project-link:hover,
.project-link:focus-visible {
  border-bottom-style: solid;
  outline: none;
}

/* Footer */
.site-footer {
  margin-top: 1.1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0.1rem 0;
}

/* Links */
a {
  color: var(--accent);
}

/* Layout tweaks */
@media (min-width: 720px) {
  .shell {
    padding: 2rem 2rem 1.9rem;
  }

  .hero-title {
    font-size: 2.1rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .grid {
    grid-template-columns: 2fr 1.5fr;
  }

  .grid--narrow {
    grid-template-columns: 1fr;
  }
}

/* Wider screens – use 75% of viewport width */
@media (min-width: 960px) {
  .shell,
  .site-header {
    max-width: 75vw;
  }
}

/* Overlay / modal for detailed project views */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.overlay--open {
  display: block;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
}

.overlay-dialog {
  position: relative;
  z-index: 1001;
  max-width: 880px;
  margin: 2rem auto;
  padding: 1.4rem 1.3rem 1.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: radial-gradient(
    circle at top left,
    #141414 0,
    #060606 55%,
    #000 100%
  );
  box-shadow: var(--shadow-soft);
  max-height: calc(100vh - 4rem);
  overflow: auto;
  font-size: 0.85rem;
}

.overlay-title {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.overlay-tagline {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.overlay-section {
  margin-bottom: 0.9rem;
}

.overlay-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.overlay-section p {
  margin: 0 0 0.4rem;
  color: var(--text);
}

.overlay-section ul {
  margin: 0.1rem 0 0.4rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.overlay-diagram {
  margin: 0.3rem 0 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid #333;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.78rem;
  overflow-x: auto;
}

.overlay-diagram code {
  font-family: var(--font-mono);
  white-space: pre;
}

/* Demo reel video inside overlay */
.overlay-video-wrapper {
  margin: 0.4rem 0 0.8rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #333;
  background: #000;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}

.overlay-video {
  display: block;
  width: 100%;
  height: auto;
}

.overlay-close {
  position: absolute;
  top: 0.3rem;
  right: 0.5rem;
  border: 1px solid #333;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.7);
  color: var(--muted);
  padding: 0.1rem 0.55rem 0.2rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.overlay-close:hover,
.overlay-close:focus-visible {
  color: var(--text);
  border-color: #666;
  outline: none;
}

/* Full-width card inside .grid (span both columns on desktop) */
.card--full {
  grid-column: 1 / -1;
}

/* Make project-link behave nicely as a button trigger */
.project-link--button {
  border-bottom: none;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid #333;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.project-link--button:hover,
.project-link--button:focus-visible {
  border-color: #666;
  outline: none;
}

/* Small-screen overlay spacing */
@media (max-width: 720px) {
  .overlay-dialog {
    margin: 1rem 0.5rem;
    max-height: calc(100vh - 2rem);
    padding: 1.1rem 1rem 1rem;
  }
}

/* Light theme overrides */
:root[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --accent: #111827;
  --border: #d1d5db;
  --shadow-soft: 0 0 0 1px rgba(15, 23, 42, 0.06),
    0 18px 40px rgba(15, 23, 42, 0.12);
}

/* Light theme backgrounds / surfaces */
:root[data-theme="light"] body {
  background: radial-gradient(
    circle at top,
    #ffffff 0,
    #e5e7eb 50%,
    #d1d5db 100%
  );
}

:root[data-theme="light"] .shell {
  background: radial-gradient(
    circle at top left,
    #ffffff 0,
    #f3f4f6 55%,
    #e5e7eb 100%
  );
}

:root[data-theme="light"] .site-logo {
  background: rgba(255, 255, 255, 0.9);
  border-color: #e5e7eb;
  color: #4b5563;
}

:root[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .card--highlight {
  border-color: #e5e7eb;
}

:root[data-theme="light"] .project-block {
  background: rgba(255, 255, 255, 0.95);
  border-color: #e5e7eb;
}

:root[data-theme="light"] .project-meta span {
  border-color: #e5e7eb;
}

:root[data-theme="light"] .site-footer {
  border-top-color: #e5e7eb;
}

:root[data-theme="light"] a {
  color: #111827;
}

/* Buttons in light theme */
:root[data-theme="light"] .btn-primary {
  background: #111827;
  color: #f9fafb;
  border-color: #111827;
}

:root[data-theme="light"] .btn-primary:hover,
:root[data-theme="light"] .btn-primary:focus-visible {
  background: #0f172a;
  border-color: #0f172a;
}

:root[data-theme="light"] .btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border-color: #e5e7eb;
}

:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .btn-ghost:focus-visible {
  border-color: #9ca3af;
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
}

.theme-toggle-icon {
  font-size: 0.85rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
  border-color: #666;
  outline: none;
}

/* Light mode appearance for toggle */
:root[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.9);
  border-color: #d1d5db;
  color: #4b5563;
}

/* Keep header layout tidy with toggle */
@media (max-width: 600px) {
  .site-header {
    flex-wrap: wrap;
    justify-content: space-between;
  }
}

/* Light theme: overlay */
:root[data-theme="light"] .overlay-backdrop {
  background: rgba(15, 23, 42, 0.25); /* softer, less ominous */
  backdrop-filter: blur(4px);
}

:root[data-theme="light"] .overlay-dialog {
  background: radial-gradient(
    circle at top left,
    #ffffff 0,
    #f3f4f6 55%,
    #e5e7eb 100%
  );
  border-color: #e5e7eb;
}

:root[data-theme="light"] .overlay-diagram {
  background: rgba(243, 244, 246, 0.95); /* light grey */
  border-color: #e5e7eb;
}

/* light theme: demo video wrapper */
:root[data-theme="light"] .overlay-video-wrapper {
  border-color: #e5e7eb;
  background: #000;
}

:root[data-theme="light"] .overlay-close {
  background: rgba(255, 255, 255, 0.9);
  border-color: #d1d5db;
  color: #4b5563;
}

:root[data-theme="light"] .overlay-close:hover,
:root[data-theme="light"] .overlay-close:focus-visible {
  border-color: #9ca3af;
  color: #111827;
}

/* === Demo reel overlay: bigger, responsive video === */

/* Let the demo overlay grow wider on larger screens */
#demo-overlay .overlay-dialog {
  max-width: min(1100px, 90vw);
}

/* Give the video a proper stage */
#demo-overlay .overlay-video-wrapper {
  width: 100%;
  margin: 1rem 0 1.2rem;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #333;
  background: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
}

/* Make Vimeo iframe fill the width and keep 16:9 */
#demo-overlay .overlay-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* Light theme: project-link button trigger */
:root[data-theme="light"] .project-link--button {
  background: rgba(255, 255, 255, 0.95);
  border-color: #e5e7eb;
  color: #111827;
}

:root[data-theme="light"] .project-link--button:hover,
:root[data-theme="light"] .project-link--button:focus-visible {
  border-color: #9ca3af;
}

/* Light theme: nav + hero badge */
:root[data-theme="light"] .site-nav a {
  background: rgba(255, 255, 255, 0.9);
  border-color: #e5e7eb;
  color: #4b5563;
}

:root[data-theme="light"] .site-nav a:hover,
:root[data-theme="light"] .site-nav a:focus-visible {
  border-color: #9ca3af;
  color: #111827;
}

:root[data-theme="light"] .hero-badge {
  background: rgba(255, 255, 255, 0.95);
  border-color: #e5e7eb;
  color: #6b7280;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
