/* -- Nav -- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s var(--ease), padding 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  border-bottom-color: var(--rule-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 22px;
  gap: 32px;
}
.nav.is-scrolled .nav-inner {
  padding-top: 14px;
  padding-bottom: 14px;
}
.nav-mark {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.nav-mark-sub {
  position: relative;
  top: -2px;
  color: var(--accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-link {
  font-family: var(--mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  position: relative;
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-link:hover::after,
.nav-link.is-current::after { transform: scaleX(1); }
.nav-link--cta {
  margin-left: 12px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0.04em;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-link--cta::after { display: none; }
.nav-link--cta:hover {
  background: var(--ink);
  color: var(--paper);
}

/* -- Footer -- */
.foot {
  margin-top: 160px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.foot-marquee {
  overflow: hidden;
  border-bottom: 1px solid var(--rule-soft);
  padding: 22px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(28px, 4vw, 56px);
  color: var(--ink);
  white-space: nowrap;
}
.foot-marquee-track {
  display: inline-flex;
  animation: marqueeSlide 38s linear infinite;
}
.foot-marquee-track span { padding-right: 1.2em; }
@keyframes marqueeSlide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.foot-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-top: 64px;
  padding-bottom: 48px;
}
.foot-col { min-width: 0; }
.foot-mail {
  font-size: clamp(22px, 2.6vw, 38px);
  letter-spacing: -0.02em;
  display: inline-block;
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  transition: color 0.25s var(--ease);
  overflow-wrap: anywhere;
}
.foot-mail:hover { color: var(--accent); }
.foot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.foot-list a {
  font-family: var(--sans);
  font-size: var(--t-md);
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
}
.foot-list a:hover { color: var(--accent); }
.foot-meta {
  font-size: var(--t-sm);
  color: var(--ink-mute);
  line-height: 1.6;
  margin: 0;
  max-width: 32ch;
}

@media (max-width: 900px) {
  .nav-links { gap: 16px; }
  .nav-link--cta { display: none; }
  .foot-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .nav-mark { flex-direction: column; gap: 2px; align-items: flex-start; }
  .nav-mark .serif { font-size: 16px; }
  .nav-mark-sub { display: block; font-size: 7px; letter-spacing: 0.08em; top: 0; opacity: 0.85; }
  .nav-link[href="mailto:phil@thephilberg.com"] { display: none; } /* in footer on mobile */
  .foot-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* -- Mobile hardening for chrome -- */
@media (max-width: 600px) {
  /* nav-mark must not shrink; nav-links gets remaining space and scrolls */
  .nav-mark { flex-shrink: 0; }
  .nav-links {
    flex: 1;
    min-width: 0;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-end;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link {
    white-space: nowrap;
    font-size: 13px;
  }
  /* Hide the dev tweaks panel button on mobile */
  .tweaks-launcher, .tweaks-panel { display: none !important; }
}

/* -- Logo wall -- */
.logo-wall {
  padding: clamp(64px, 10vh, 120px) 0;
  border-top: 1px solid var(--rule);
}
.logo-wall-head {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}
.logo-wall-h {
  margin: 0;
  font-size: clamp(22px, 2.8vw, 40px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.logo-wall-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 52px 56px;
  align-items: center;
  justify-items: center;
}
.logo-tile {
  width: 100%;
  height: 44px;
  background-color: var(--ink-mute);
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
  transition: background-color 0.3s var(--ease), opacity 0.3s var(--ease);
  opacity: 0.7;
  cursor: default;
}
.logo-tile:hover {
  background-color: var(--accent);
  opacity: 1;
}


@media (max-width: 1100px) {
  .logo-wall-grid { grid-template-columns: repeat(5, 1fr); gap: 40px 44px; }
}
@media (max-width: 780px) {
  .logo-wall-grid { grid-template-columns: repeat(4, 1fr); gap: 32px; }
  .logo-tile { height: 36px; }
}
@media (max-width: 480px) {
  .logo-wall-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .logo-tile { height: 30px; }
}

/* -- Theme toggle -- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin-left: 8px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  transform: rotate(15deg);
}
.theme-toggle-icon {
  font-size: 14px;
  line-height: 1;
}

/* Dark theme adjustments for chrome */
[data-theme="dark"] .nav { background: rgba(15, 14, 11, 0.86); }
[data-theme="dark"] .nav.is-scrolled { background: rgba(15, 14, 11, 0.94); }
