/* Components */

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 500;
  line-height: var(--leading-tight);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

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

.text-sm {
  font-size: var(--text-xs);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__name {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
}

.nav__links {
  display: flex;
  gap: var(--space-6);
}

.nav__link {
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav__link:hover {
  color: var(--text);
}

.nav__link--active {
  color: var(--text);
}

/* Depth Indicator - Simple Version */
.depth {
  position: fixed;
  left: var(--space-6);
  top: 50%;
  transform: translateY(-50%);
  display: none; /* Hidden - using driver tree instead */
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.depth__bar {
  width: 2px;
  height: 40px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.depth__fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--text);
  transition: height var(--transition-base);
}

.depth__label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* Driver Tree - Persistent Left Panel */
.driver-tree {
  position: fixed;
  left: var(--space-6);
  /* Align with main content top (site-main padding + section padding) */
  top: calc(var(--space-8) + var(--space-8));
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--text-muted);
  z-index: 100;
}

.driver-tree__root {
  color: var(--text);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.driver-tree__branches {
  padding-left: 0;
}

.driver-tree__branch {
  position: relative;
  padding-left: var(--space-4);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

/* Tree lines */
.driver-tree__branch::before {
  content: '├─';
  position: absolute;
  left: 0;
  color: var(--border);
}

.driver-tree__branch:last-child::before {
  content: '└─';
}

/* Active state */
.driver-tree__branch--active {
  color: var(--text);
}

.driver-tree__branch--active::before {
  color: var(--text);
}

/* Sub-branches */
.driver-tree__sub {
  padding-left: var(--space-4);
  margin-left: var(--space-4);
  border-left: 1px solid var(--border);
  display: none;
}

.driver-tree__branch--active .driver-tree__sub {
  display: block;
}

.driver-tree__leaf {
  position: relative;
  padding-left: var(--space-3);
  color: var(--text-muted);
}

.driver-tree__leaf::before {
  content: '├─';
  position: absolute;
  left: 0;
  color: var(--border);
}

.driver-tree__leaf:last-child::before {
  content: '└─';
}

.driver-tree__leaf--active {
  color: var(--text);
}

.driver-tree__leaf--active::before {
  color: var(--text);
}

/* Tree links */
.driver-tree a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.driver-tree a:hover {
  color: var(--accent);
}

/* Hide on mobile */
@media (max-width: 900px) {
  .driver-tree {
    display: none;
  }
}

/* Location Path - Subtle back navigation */
.location {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.location__link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.location__link:hover {
  color: var(--text);
}

/* First link gets the back arrow */
.location__back {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: color var(--transition-fast);
}

.location__back:hover {
  color: var(--text);
}

.location__back:first-child::before {
  content: '←';
}

.location__sep {
  color: var(--border);
}

.location__current {
  color: var(--text);
}

/* Cards - Portfolio */
.card {
  position: relative;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-base);
}

/* Layered Depth Effect */
.card::before,
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--bg-subtle);
  transition: transform var(--transition-base), opacity var(--transition-base);
  z-index: -1;
}

.card::before {
  opacity: 0.6;
}

.card::after {
  opacity: 0.3;
}

.card:hover {
  transform: translateY(-2px);
}

.card:hover::before {
  transform: translate(4px, 4px);
}

.card:hover::after {
  transform: translate(8px, 8px);
}

.card__image {
  aspect-ratio: 16 / 10;
  background: var(--border);
  overflow: hidden;
}

.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__content {
  padding: var(--space-4);
}

.card__title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.card__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.card__metrics {
  display: flex;
  gap: var(--space-4);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric__value {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1;
}

.metric__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card__cta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.card:hover .card__cta {
  color: var(--text);
}

.card__cta::after {
  content: '→';
  transition: transform var(--transition-fast);
}

.card:hover .card__cta::after {
  transform: translateX(4px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.btn:hover {
  opacity: 0.85;
}

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

.btn--secondary:hover {
  border-color: var(--text);
  opacity: 1;
}

/* Links */
.link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.link:hover {
  color: var(--accent);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-8) 0;
}

/* Tags */
.tag {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  background: var(--bg-subtle);
  border-radius: 2px;
}

/* Responsive navigation */
@media (max-width: 600px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .nav__links {
    gap: var(--space-4);
  }

  .depth {
    display: none;
  }
}
