/* ==========================================================================
   whilelost.dev — Modern Minimalist Design System
   Benchmark: Paco Coursey (paco.me) & Rauno Freiberg (rauno.me)
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;

  /* Deep Atmospheric Dark Theme */
  --bg-page: #08080a;
  --bg-page-rgb: 8, 8, 10;
  --bg-surface: #0e0f12;
  --bg-surface-hover: #15161b;
  --bg-elevated: #1a1b22;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-muted: rgba(255, 255, 255, 0.04);
  --border-highlight: rgba(255, 255, 255, 0.16);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #8b949e;
  --accent-emerald: #10b981;
  --accent-emerald-dim: rgba(16, 185, 129, 0.15);
  
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.12);
  
  --selection-bg: rgba(16, 185, 129, 0.25);
  --selection-text: #ffffff;
  --focus-ring: #10b981;
  --code-bg: #121318;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px -6px rgba(0, 0, 0, 0.45);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.3), 0 20px 42px -10px rgba(0, 0, 0, 0.65);
  --shadow-dropdown: 0 16px 40px -8px rgba(0, 0, 0, 0.6), 0 4px 16px -2px rgba(0, 0, 0, 0.4);
  
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-page: #fafaf9;
  --bg-page-rgb: 250, 250, 249;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f5f5f4;
  --bg-elevated: #e7e5e4;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-muted: rgba(0, 0, 0, 0.04);
  --border-highlight: rgba(0, 0, 0, 0.16);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-emerald: #059669;
  --accent-emerald-dim: rgba(5, 150, 105, 0.12);
  
  --accent-amber: #d97706;
  --accent-amber-dim: rgba(217, 119, 6, 0.1);
  
  --selection-bg: rgba(5, 150, 105, 0.2);
  --selection-text: #0f172a;
  --focus-ring: #059669;
  --code-bg: #f1f5f9;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -6px rgba(0, 0, 0, 0.07);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.06), 0 20px 40px -10px rgba(0, 0, 0, 0.12);
  --shadow-dropdown: 0 16px 40px -8px rgba(0, 0, 0, 0.12), 0 4px 16px -2px rgba(0, 0, 0, 0.06);
}

/* Browser Surfaces Theming */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  color-scheme: dark light;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background-color: var(--bg-page);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  overflow-x: hidden;
  max-width: 100%;
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Tabular figures for numbers, dates, times */
/* ==========================================================================
   Atmospheric Constellation Star-Track Background (Concept #5)
   ========================================================================== */
.constellation-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
  transition: opacity 0.5s var(--ease-out-expo);
}

.constellation-canvas.is-hidden {
  opacity: 0;
}

.site-header,
.page-shell,
.site-footer {
  position: relative;
  z-index: 1;
}

#constellation-toggle.constellation-active {
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.35);
  background-color: var(--accent-emerald-dim);
}

#constellation-toggle.constellation-active svg circle {
  fill: var(--accent-emerald);
}

.tabular-nums, time, .stat-value, .meta-time, .keyboard-shortcut {
  font-variant-numeric: tabular-nums;
}

/* Scrollbar Theming */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography Hierarchy */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.35;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

p {
  margin-bottom: 1rem;
  max-width: 68ch;
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--text-primary);
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 clamp(1.75rem, 3.8vw, 4.25rem);
}

/* Header & Controls */
.site-header {
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border-muted);
  animation: page-arrive 0.6s var(--ease-out-expo) both;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.85;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-button {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s var(--ease-out-expo);
}

.icon-button:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-highlight);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0) scale(0.96);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.kbd-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  position: absolute;
  bottom: -6px;
  right: -6px;
  line-height: 1;
}

/* Page Shell & Layout Split (Mobile-First Architecture) */
.page-shell {
  padding: clamp(3.25rem, 5vw, 5rem) 0 clamp(5rem, 7vw, 7.5rem);
  flex: 1;
}

/* Mobile-first: single column stacked layout */
.layout-split {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: 100%;
}

.discord-popout-col {
  display: none;
}

/* Desktop layout: multi-column split (>= 960px) */
@media (min-width: 960px) {
  .layout-split {
    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);
    gap: clamp(2.5rem, 3.8vw, 4.5rem);
    align-items: stretch;
  }

  .sidebar-col {
    position: relative;
    height: 100%;
    align-self: stretch;
  }

  .sidebar-sticky {
    position: sticky;
    top: 3rem;
  }

  .smooth-follow-active .sidebar-sticky {
    position: relative;
    top: 0;
    will-change: transform;
  }

  .layout-split:has(.discord-card, .instagram-card) {
    grid-template-columns: 285px minmax(0, 1fr) 305px;
  }

  .layout-split:has(.discord-card, .instagram-card) .discord-popout-col {
    display: block;
  }
}

.sidebar-col {
  min-width: 0;
  animation: page-arrive 0.65s var(--ease-out-expo) 0.06s both;
}

.discord-popout-col {
  min-width: 0;
  animation: page-arrive 0.75s var(--ease-out-expo) 0.18s both;
}

.content-col {
  min-width: 0;
  animation: page-arrive 0.7s var(--ease-out-expo) 0.12s both;
}

.discord-popout-sticky {
  position: sticky;
  top: 3rem;
}

.sidebar-sticky {
  position: sticky;
  top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.profile-lockup {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

/* Avatar: Tactile Monogram Stamp */
.avatar-mark {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: linear-gradient(135deg, #1b1c24 0%, #0d0e12 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 4px 14px rgba(0, 0, 0, 0.4);
  position: relative;
  user-select: none;
  transition: transform 0.22s var(--ease-out-expo), border-color 0.2s ease, box-shadow 0.22s ease;
}

.avatar-mark:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.avatar-status-pip {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  border: 2px solid var(--bg-page);
  z-index: 2;
}

.profile-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-titles h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.2rem, 1.55vw, 1.38rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.profile-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.hero-bio {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* Top Contact Bar */
.top-contact-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s var(--ease-out-expo);
}

.contact-chip:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-highlight);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.contact-chip:active {
  transform: translateY(0) scale(0.97);
}

.contact-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.chip-action-indicator {
  width: 11px !important;
  height: 11px !important;
  opacity: 0.45;
  margin-left: -0.1rem;
  transition: opacity 0.15s ease, transform 0.15s var(--ease-out-expo);
}

.contact-chip:hover .chip-action-indicator {
  opacity: 0.95;
}

a.contact-chip:hover .chip-action-indicator {
  transform: translate(1px, -1px);
}

/* Sidebar Ambient Presence: Unified Minimalist Format (Above Bio) */
.sidebar-presence-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: transparent;
  border: none;
}

.presence-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.815rem;
  line-height: 1.45;
}

.presence-list-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.presence-list-icon svg {
  width: 13.5px;
  height: 13.5px;
  stroke-width: 1.75;
}

.presence-list-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.25rem;
}

.presence-primary {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.815rem;
  letter-spacing: -0.01em;
}

.presence-primary.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.presence-secondary {
  color: var(--text-muted);
  font-size: 0.79rem;
  font-weight: 400;
}

.presence-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  transition: color 0.15s ease;
}

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

.presence-link:hover .presence-secondary {
  color: var(--text-secondary);
}

/* Status indicator dot with pulse */
.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-online {
  background-color: var(--accent-emerald, #10b981);
  
}

.status-idle {
  background-color: var(--accent-amber, #f59e0b);
  
}

.status-dnd {
  background-color: #ef4444;
}

.status-offline {
  background-color: var(--text-muted, #8b949e);
}

/* Spotify mini wave bars */
.music-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 12px;
  width: 10px;
  flex-shrink: 0;
}

.music-bars span {
  width: 2px;
  background-color: var(--text-muted);
  border-radius: 1px;
  height: 3px;
  transition: background-color 0.2s ease;
}

.music-bars.playing span {
  background-color: var(--accent-emerald, #10b981);
  animation: music-wave 1.1s cubic-bezier(0.25, 1, 0.5, 1) infinite alternate;
}

.music-bars.playing span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.music-bars.playing span:nth-child(2) { height: 100%; animation-delay: 0.35s; }
.music-bars.playing span:nth-child(3) { height: 60%; animation-delay: 0.2s; }

@keyframes music-wave {
  0% { height: 3px; }
  100% { height: 12px; }
}

/* Content Navigation Filter Tabs */
.content-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 2.25rem;
}

/* Garden Nav Tabs (Tactile Segmented Control) */
.nav-track {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-track::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.38rem 0.88rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s var(--ease-out-expo);
}

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

.nav-pill.active {
  color: var(--text-primary);
  background-color: var(--bg-page);
  border-color: var(--border-muted);
  box-shadow: var(--shadow-subtle);
}

/* Garden Content Modules */
.garden-content {
  padding: 0 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 4.5rem;
}

.garden-sector {
  display: flex;
  flex-direction: column;
  animation: sector-reveal 0.35s var(--ease-out-expo) both;
}

@keyframes sector-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sector-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.35rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-muted);
}

.sector-title {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin: 0;
}

.sector-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Works & Experiments List */
.works-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.5rem;
}

.work-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.65rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease-out-expo), box-shadow 0.25s var(--ease-out-expo), border-color 0.2s ease, background-color 0.2s ease;
}

.work-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.work-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background-color: var(--bg-surface-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.work-card:hover::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.work-title-link {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: -0.015em;
}

.work-title-link svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.25;
  opacity: 0.65;
  transition: transform 0.25s var(--ease-out-expo), opacity 0.2s ease, color 0.2s ease;
}

.work-card:hover .work-title-link svg {
  transform: translate(3px, -3px);
  opacity: 1;
  color: var(--accent-emerald);
}

.work-year {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--code-bg);
  border: 1px solid var(--border-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.work-desc {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.64;
  margin-bottom: auto;
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0.45rem;
}

.tag-badge {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  background: var(--code-bg);
  border: 1px solid var(--border-muted);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.work-card:hover .tag-badge {
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
}

/* Writing & Notes List */
.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.95rem 0;
  border-bottom: 1px dashed var(--border-muted);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.writing-item:last-child {
  border-bottom: none;
}

.writing-item:hover .writing-title {
  color: var(--text-primary);
  text-decoration: underline;
}

.writing-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.writing-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Setup & Hardware Spec Grid */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.5rem;
}

.machine-spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.65rem 1.75rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease-out-expo), box-shadow 0.25s var(--ease-out-expo), border-color 0.2s ease;
}

.machine-spec-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
}

.machine-spec-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.machine-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-muted);
}

.machine-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  letter-spacing: -0.015em;
}

.machine-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.machine-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-emerald);
  padding: 0.22rem 0.6rem;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 5px;
  background: var(--accent-emerald-dim);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.spec-table {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.spec-row {
  display: grid;
  grid-template-columns: 85px 1fr;
  align-items: baseline;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-muted);
}

.spec-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.spec-row dt {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.spec-row dd {
  color: var(--text-primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.spec-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 400;
  margin-left: 0.35rem;
}

/* Signals & Connect */
.connect-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.email-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
}

.email-address {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.copy-button {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

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

.copy-button svg {
  width: 13px;
  height: 13px;
}

.signals-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  font-size: 0.9rem;
}

.signals-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.signals-links a:hover {
  color: var(--text-primary);
}

.pgp-snippet {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-muted);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Site Footer */
.site-footer {
  margin-top: auto;
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--border-muted);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-kbd-hint {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  padding: 0;
}

.footer-kbd-hint:hover {
  color: var(--text-primary);
}

.kbd-key {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Modal & Reader Drawers */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-dropdown);
  padding: 1.75rem;
  position: relative;
  transform: scale(0.97) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-muted);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shortcuts-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.35rem 0;
}

.shortcut-desc {
  color: var(--text-secondary);
}

/* Reader View Modal */
.reader-modal {
  max-width: 660px;
  padding: 2.25rem;
}

.reader-progress {
  position: sticky;
  top: -2.25rem;
  left: -2.25rem;
  right: -2.25rem;
  height: 3px;
  background: var(--border-muted);
  margin-bottom: 1.5rem;
}

.reader-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-emerald);
  transition: width 0.1s linear;
}

.reader-content {
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.reader-content p {
  margin-bottom: 1.25rem;
}

.reader-content blockquote {
  border-left: 2px solid var(--accent-emerald);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-primary);
  font-style: italic;
}

/* Ambient Audio Visualizer */
.audio-waves {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 12px;
}

.wave-bar {
  width: 2px;
  height: 100%;
  background-color: var(--text-muted);
  border-radius: 1px;
}

.audio-active .wave-bar:nth-child(1) {
  animation: wave 1.1s ease-in-out infinite alternate;
  background-color: var(--accent-emerald);
}

.audio-active .wave-bar:nth-child(2) {
  animation: wave 0.8s ease-in-out 0.2s infinite alternate;
  background-color: var(--accent-emerald);
}

.audio-active .wave-bar:nth-child(3) {
  animation: wave 1.3s ease-in-out 0.4s infinite alternate;
  background-color: var(--accent-emerald);
}

@keyframes wave {
  0% { height: 20%; }
  100% { height: 100%; }
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-dropdown);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Discord Profile Popout Simulation Card */
.discord-card {
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.65rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  position: relative;
  user-select: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.discord-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.discord-card-banner {
  height: 105px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #1e1f22;
  image-rendering: -webkit-optimize-contrast;
  position: relative;
}

.discord-card-body {
  padding: 0 0.4rem 0.4rem;
  position: relative;
}

.discord-avatar-wrapper {
  position: relative;
  margin-top: -34px;
  margin-left: 0.4rem;
  margin-bottom: 0.65rem;
  display: inline-block;
}

.discord-avatar-frame {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 5px solid #111214;
  background: #111214;
  position: relative;
  overflow: visible;
}

.discord-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.discord-decoration-img {
  position: absolute;
  top: -12%;
  left: -12%;
  width: 124%;
  height: 124%;
  pointer-events: none;
}

.discord-status-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3.5px solid #111214;
  background-color: #80848e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.discord-status-badge.status-online {
  background-color: #23a55a;
}

.discord-status-badge.status-idle {
  background-color: #f0b232;
}

.discord-status-badge.status-dnd {
  background-color: #f23f43;
}

.discord-status-badge.status-dnd::after {
  content: "";
  width: 7px;
  height: 2px;
  background: #111214;
  border-radius: 1px;
}

.discord-status-badge.status-offline {
  background-color: #80848e;
}

/* Time Difference Pill (Top Right) */
.discord-time-pill {
  position: absolute;
  top: 0.65rem;
  right: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.discord-clock-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #dbdee1;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.discord-tz-diff {
  font-size: 0.72rem;
  color: #949ba4;
  letter-spacing: -0.01em;
}

/* Names */
.discord-names {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.65rem;
}

.discord-display-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.discord-display-name {
  color: #f2f3f5;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.discord-pronoun-badges {
  font-size: 0.75rem;
  color: #949ba4;
  font-weight: 500;
}

.discord-handle-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.discord-handle {
  color: #949ba4;
  font-size: 0.8rem;
}

.discord-device-icon {
  color: #949ba4;
  display: inline-flex;
  align-items: center;
}

/* Custom Status Bubble */
.discord-status-bubble {
  color: #dbdee1;
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.2rem 0;
  word-break: break-word;
}

.discord-card-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0.75rem 0;
}

/* Spotify inside Discord Card */
.discord-card-spotify {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.discord-spotify-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #1ed760;
}

.discord-spotify-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.discord-spotify-art-wrap {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}

.discord-spotify-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.discord-spotify-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.discord-spotify-title {
  color: #f2f3f5;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discord-spotify-artist {
  color: #949ba4;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Watermark */
.discord-watermark-art {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  pointer-events: none;
  color: #949ba4;
  line-height: 0;
}

/* ==========================================================================
   Social Profile Popout Tabs & Instagram Simulation
   ========================================================================== */

/* Social Popout Segmented Tabs Switcher */
.social-popout-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 3px;
  margin-bottom: 0.75rem;
  gap: 4px;
}

.social-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1;
  user-select: none;
}

.social-tab-btn:hover {
  color: var(--text-primary);
}

.social-tab-btn.is-active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.social-tab-btn:focus-visible {
  outline: 2px solid var(--accent-emerald);
  outline-offset: 1px;
}

/* Instagram Profile Card Simulation */
.instagram-card {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.85rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  position: relative;
  user-select: none;
  transition: border-color 0.2s ease;
}

.instagram-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Instagram Top Bar */
.ig-card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
}

.ig-card-handle-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ig-card-username {
  color: #f5f5f5;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ig-card-open-link {
  color: #a8a8a8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.ig-card-open-link:hover {
  color: #ffffff;
}

/* Header & Story Ring */
.ig-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.ig-story-avatar-wrap {
  flex-shrink: 0;
}

.ig-story-ring {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  padding: 2.5px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #000000;
  overflow: hidden;
  background: #1a1a1a;
}

.ig-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Stats Row */
.ig-stats-row {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-around;
}

.ig-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.ig-stat-val {
  color: #f5f5f5;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ig-stat-lbl {
  color: #a8a8a8;
  font-size: 0.72rem;
  letter-spacing: -0.01em;
}

/* Bio Section */
.ig-card-bio-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.8rem;
}

.ig-display-name {
  color: #f5f5f5;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
}

.ig-bio-text {
  color: #dbdbdb;
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0;
}

.ig-bio-link {
  color: #3897f0;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.ig-bio-link:hover {
  text-decoration: underline;
}

/* Action Buttons */
.ig-actions-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.ig-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  line-height: 1.2;
}

.ig-btn-primary {
  background: #0074cc;
  color: #ffffff;
}

.ig-btn-primary:hover {
  background: #0066b2;
}

.ig-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

.ig-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Micro Posts Grid Kicker */
.ig-grid-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #a8a8a8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.55rem;
}

/* Photo Grid */
.ig-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 0.75rem;
}

.ig-grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  background: #16181d;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.ig-grid-item.thumb-dev {
  background: linear-gradient(135deg, #18202c 0%, #0d1219 100%);
}

.ig-grid-item.thumb-design {
  background: linear-gradient(135deg, #261b2c 0%, #130d17 100%);
}

.ig-grid-item.thumb-photo {
  background: linear-gradient(135deg, #14241d 0%, #0c1410 100%);
}

.ig-grid-placeholder {
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.ig-grid-item:hover .ig-grid-placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.ig-grid-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ig-grid-item:hover .ig-grid-overlay,
.ig-grid-item:focus-visible .ig-grid-overlay {
  opacity: 1;
}

/* Footer Link */
.ig-card-footer {
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
}

.ig-footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #a8a8a8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.ig-footer-cta:hover {
  color: #f5f5f5;
}

/* Page Arrival Keyframes */
@keyframes page-arrive {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Discord Status Badge */
.discord-status-badge.status-online {
  background-color: #23a55a;
}

/* Responsive Breakpoints & Ergonomic Layout Adaptation */
@media (max-width: 1279px) and (min-width: 960px) {
  .layout-split {
    grid-template-columns: 280px 1fr;
    gap: 3rem;
  }

  .discord-popout-col {
    grid-column: 1;
    margin-top: 1.5rem;
  }

  .discord-popout-sticky {
    position: static;
  }
}

/* Touch and Coarse Pointer Adaptation (Phones & Tablets) */
@media (pointer: coarse), (hover: none) {
  /* Hide keyboard key badges on mobile touch devices */
  .kbd-badge {
    display: none !important;
  }

  /* Expand touch target envelope to meet 44px ergonomics */
  .icon-button {
    width: 40px;
    height: 40px;
  }

  .icon-button::before {
    content: "";
    position: absolute;
    inset: -4px;
  }

  /* Prevent sticky hover styles on touch screens */
  .work-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-subtle) !important;
    border-color: var(--border-subtle) !important;
  }

  .work-card:active,
  .machine-spec-card:active {
    transform: scale(0.985);
    background-color: var(--bg-surface-hover);
  }

  /* Persistent outbound link affordance */
  .work-title-link svg {
    opacity: 0.85;
  }

  .work-card:hover .work-title-link svg {
    transform: none;
  }

  /* Footer touch trigger */
  .footer-kbd-hint {
    padding: 0.5rem 0.95rem;
    min-height: 40px;
    gap: 0.35rem;
  }

  .footer-kbd-hint kbd {
    display: none;
  }
}

/* Tablet & Mobile Single-Column Collapse */
@media (max-width: 959px) {
  .layout-split {
    display: flex !important;
    flex-direction: column !important;
    gap: 2.25rem !important;
    width: 100% !important;
  }

  .discord-popout-col {
    margin-top: 2rem;
  }

  .sidebar-sticky,
  .discord-popout-sticky {
    position: static;
  }

  .page-shell {
    padding: 2rem 0 3.5rem;
  }

  .content-nav {
    position: sticky;
    top: 0;
    background: rgba(var(--bg-page-rgb), 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 25;
    padding: 0.75rem 0;
    margin: 0 -1.75rem 1.85rem;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
    border-bottom: 1px solid var(--border-muted);
  }
}

/* Mobile Devices (Phones <= 640px) */
@media (max-width: 640px) {
  .container {
    padding: 0 max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
  }

  .site-header {
    padding: max(1.35rem, env(safe-area-inset-top)) 0 1rem;
  }

  .brand {
    font-size: 0.92rem;
  }

  .header-controls {
    gap: 0.35rem;
  }

  /* Profile lockup */
  .profile-lockup {
    gap: 0.85rem;
    align-items: center;
  }

  .avatar-mark {
    width: 48px;
    height: 48px;
    font-size: 1rem;
    border-radius: 12px;
  }

  .profile-titles {
    min-width: 0;
    flex: 1;
  }

  .profile-titles h1 {
    font-size: clamp(1.2rem, 5vw, 1.38rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
  }

  .profile-sub {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .hero-bio {
    font-size: 0.92rem;
    line-height: 1.62;
  }

  /* Symmetrical 2x2 Ergonomic Thumb Grid */
  .top-contact-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    width: 100%;
  }

  .contact-chip {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.65rem;
    font-size: 0.81rem;
    min-height: 42px;
    border-radius: 9px;
  }

  /* Centered, full-touch Segmented Navigation */
  .content-nav {
    margin: 0 -1.15rem 1.65rem;
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    display: flex;
    justify-content: center;
  }

  .nav-track {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-between;
    padding: 3px;
  }

  .nav-pill {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.82rem;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Full-width Cards & Ergonomic Paddings */
  .works-list,
  .setup-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .work-card,
  .machine-spec-card {
    padding: 1.25rem 1.15rem;
    border-radius: 11px;
  }

  .work-title-link {
    font-size: 1.02rem;
  }

  .work-desc {
    font-size: 0.89rem;
    line-height: 1.58;
  }

  .sector-header {
    margin-bottom: 1.15rem;
    padding-bottom: 0.55rem;
  }

  .sector-title {
    font-size: 1.35rem;
  }

  /* Modal on Mobile: Responsive Drawer */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 82vh;
    padding: 1.5rem 1.25rem max(1.75rem, env(safe-area-inset-bottom));
  }

  /* Footer Adaptation */
  .site-footer {
    padding: 2.25rem 0 max(2rem, calc(1.5rem + env(safe-area-inset-bottom)));
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.85rem;
    text-align: center;
    align-items: center;
  }
}

/* Ultra-Compact Screens (<= 360px: iPhone SE, Galaxy Z Fold) */
@media (max-width: 360px) {
  .container {
    padding: 0 0.85rem;
  }

  .top-contact-bar {
    grid-template-columns: 1fr;
  }

  .avatar-mark {
    width: 44px;
    height: 44px;
  }

  .profile-titles h1 {
    font-size: 1.18rem;
  }
}

/* Purposeful Reduced Motion Path */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .work-card:hover,
  .machine-spec-card:hover,
  .avatar-mark:hover,
  .work-card:hover .work-title-link svg,
  .icon-button:hover,
  .contact-chip:hover {
    transform: none !important;
  }
}
