:root {
  --bg: #0A0A0A;
  --bg-alt: #111111;
  --surface: #141414;
  --surface-hover: #1A1A1A;
  --border: #2A2A2A;
  --accent: #FF6B35;
  --accent-text: #FF6B35;
  --text: #FFFFFF;
  --text-muted: #A0A0A0;
  --text-dim: #666666;
  --status-completed: #4ADE80;
  --status-active: #FBBF24;
  --status-discontinued: #F87171;
  --bottom-bar-bg: rgba(10,10,10,0.92);
  --bottom-bar-border: #1A1A1A;
  --overlay-bg: rgba(0,0,0,0.92);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --header-h: 64px;
  --gap: 24px;
  --radius: 8px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #FAFAFA;
  --bg-alt: #F0F0F0;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F5;
  --border: #E0E0E0;
  --accent: #FF6B35;
  --accent-text: #CC4400;
  --text: #1A1A1A;
  --text-muted: #555555;
  --text-dim: #999999;
  --status-completed: #15803D;
  --status-active: #B45309;
  --status-discontinued: #B91C1C;
  --bottom-bar-bg: rgba(250,250,250,0.92);
  --bottom-bar-border: #E0E0E0;
  --overlay-bg: rgba(250,250,250,0.95);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: #fff; }
img { display: block; max-width: 100%; }

/* ===== HEADER ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 800;
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: transparent;
  transition: transform 0.4s var(--ease-out), background 0.3s ease;
}
#header.hidden { transform: translateY(-100%); }
#header.scrolled { background: var(--bottom-bar-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
.header-logo {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.header-logo span { color: var(--accent-text); }
.header-nav { display: flex; align-items: center; gap: 16px; }
#theme-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
#theme-btn:hover { color: var(--text); background: var(--surface-hover); }
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }

/* ===== MAIN GRID ===== */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 40px) var(--gap) 80px;
}

/* ===== GROUP HEADER ===== */
.group-header {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  margin-top: 16px;
}
.group-header:first-child { margin-top: 0; }

/* ===== CARD ===== */
.card {
  position: relative;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.card.revealed { opacity: 1; transform: translateY(0); }
.card:active .card-image { transform: scale(0.98); }

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-alt);
  margin-bottom: 10px;
}
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}
.card:hover .card-image { transform: scale(1.05); }

.card-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.85;
}
.card-icon-inner {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  backdrop-filter: blur(4px);
}

.card-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}
.card-title {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-year {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== DETAIL OVERLAY ===== */
#detail {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--overlay-bg);
  overflow-y: auto;
  display: none;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
#detail.active { display: flex; }

.detail-close {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--text);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}
.detail-close:hover { background: rgba(255,255,255,0.15); }

/* Gallery hero */
.detail-hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 360px;
  max-height: 90vh;
  overflow: hidden;
  flex-shrink: 0;
  background: #000;
}
.detail-gallery {
  display: grid;
  width: 100%;
  height: 100%;
}
.detail-gallery img {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 300ms ease;
}
.detail-gallery img.active { opacity: 1; }

.detail-counter {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 4px 12px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.detail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.3);
  transition: background 0.2s, color 0.2s;
  font-size: 1.25rem;
}
.detail-nav:hover { background: rgba(255,255,255,0.12); color: #fff; }
.detail-nav-prev { left: 20px; }
.detail-nav-next { right: 20px; }

/* Detail content */
.detail-content {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 32px;
  width: 100%;
}

.detail-sidebar { min-width: 0; }
.detail-sidebar-item {
  margin-bottom: 20px;
}
.detail-sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.detail-sidebar-value {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.detail-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(74,222,128,0.12);
  color: var(--status-completed);
}
.detail-status.active { background: rgba(251,191,36,0.12); color: var(--status-active); }
.detail-status.discontinued { background: rgba(248,113,113,0.12); color: var(--status-discontinued); }

.detail-body { min-width: 0; }
.detail-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 16px;
}
.detail-description {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}
.detail-section-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.detail-contributions { margin-bottom: 24px; }
.detail-contributions ul { padding-left: 16px; }
.detail-contributions li {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 4px;
  list-style: disc;
}
.detail-skills { margin-bottom: 24px; }
.detail-skills-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-skill-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

/* Thumbnails */
.detail-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 32px 32px;
  max-width: 1000px;
  margin: 0 auto 64px;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.detail-thumb {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.4;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: opacity 0.2s, border-color 0.2s;
}
.detail-thumb.active { opacity: 1; border-color: var(--accent); }
.detail-thumb:hover { opacity: 0.7; }

/* ===== INFO OVERLAY ===== */
#info {
  position: fixed;
  inset: 0;
  z-index: 850;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg);
}
#info.active { display: flex; }
.info-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 560px;
  width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.info-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 1.125rem;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.info-close:hover { background: var(--border); color: var(--text); }
.info-header { padding-right: 32px; }
.info-section {
  margin-bottom: 28px;
  clear: both;
}
.info-section h2 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.info-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.info-role {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-text);
  margin-bottom: 12px;
}
.info-about p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 12px;
}
.info-about p:last-child { margin-bottom: 0; }
.info-skill-group { margin-bottom: 12px; }
.info-skill-group h3 {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.info-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.info-skill-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}
.info-edu-item { margin-bottom: 16px; }
.info-edu-item:last-child { margin-bottom: 0; }
.info-edu-item h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1px;
}
.info-edu-item p { font-size: 0.75rem; color: var(--text-muted); }
.info-edu-item .info-edu-detail {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.info-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.8125rem;
}
.info-contact-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 64px;
  flex-shrink: 0;
}
.info-contact-value { color: var(--text-muted); word-break: break-all; }

/* ===== BOTTOM BAR ===== */
#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bottom-bar-bg);
  border-top: 1px solid var(--bottom-bar-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  padding: 0 12px;
}
.bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  transition: color 0.2s;
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.bar-btn:hover { color: var(--text-muted); }
.bar-btn.active { color: var(--accent-text); }
.bar-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent-text);
  border-radius: 1px 1px 0 0;
}
.bar-btn .abbr { display: none; }

/* ===== PROGRAM ICONS ===== */
.card-icon-inner--government::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}
.card-icon-inner--healthcare {
  position: relative;
}
.card-icon-inner--healthcare::before,
.card-icon-inner--healthcare::after {
  content: '';
  position: absolute;
  background: var(--accent);
}
.card-icon-inner--healthcare::before {
  width: 4px;
  height: 16px;
  border-radius: 1px;
}
.card-icon-inner--healthcare::after {
  width: 16px;
  height: 4px;
  border-radius: 1px;
}
.card-icon-inner--entertainment::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 18px solid var(--accent);
}
.card-icon-inner--hospitality::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.card-icon-inner--residential {
  position: relative;
}
.card-icon-inner--residential::before {
  content: '';
  position: absolute;
  top: 4px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 8px solid var(--accent);
}
.card-icon-inner--residential::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 14px;
  height: 9px;
  border: 2px solid var(--accent);
  border-top: none;
  border-radius: 0 0 2px 2px;
}
.card-icon-inner--commercial::before {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  transform: rotate(45deg);
  border-radius: 2px;
}
.card-icon-inner--career {
  font-size: 18px;
  line-height: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  #grid { grid-template-columns: repeat(2, 1fr); gap: 20px; padding-left: 20px; padding-right: 20px; }
  #header { padding: 0 20px; }
  .detail-content { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px; }
  .detail-hero { height: 50vh; min-height: 300px; }
  .detail-nav { display: none; }
  .detail-thumbs { padding: 0 20px 24px; }
}
@media (max-width: 600px) {
  #grid { grid-template-columns: 1fr; gap: 16px; padding-left: 16px; padding-right: 16px; }
  #header { padding: 0 16px; }
  .card-title { font-size: 0.8125rem; }
  .card-year { font-size: 0.625rem; }
  .detail-hero { height: 40vh; min-height: 240px; }
  .detail-content { padding: 24px 16px; }
  .detail-title { font-size: 1.375rem; }
  .detail-thumbs { padding: 0 16px 20px; }
  .detail-thumb { width: 52px; height: 52px; }
  .bar-btn { padding: 0 8px; font-size: 0.625rem; }
  .bar-btn .full { display: none; }
  .bar-btn .abbr { display: inline; }
  .header-logo { font-size: 1rem; }
}
@media (max-width: 359px) {
  .bar-btn { padding: 0 6px; font-size: 0.5625rem; }
  #theme-btn { font-size: 0.75rem; padding: 0 6px; }
  .nav-link { font-size: 0.75rem; padding: 0 6px; }
}
@media (pointer: coarse) {
  .card { min-height: 44px; }
  .bar-btn { min-height: 44px; }
  .detail-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card { opacity: 1; transform: none; }
  .card-image { transform: none !important; }
  .card:hover .card-image { transform: none !important; }
  .detail-gallery img { transition: none !important; }
  .detail-close, .detail-nav, .detail-thumb { transition: none !important; }
}
