/* ============================================================
   APPS — Rich per-app interior UI
   Each app has a completely distinct character and surface.
   ============================================================ */

/* ============================================================
   SHARED LAYOUT PRIMITIVES
   ============================================================ */

.app-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(240px, 1.8fr) minmax(170px, 0.8fr);
  min-height: 0;
}

.sidebar, .inspector, .content-pane {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
}

.sidebar  { border-right: 1px solid var(--line); }
.inspector { 
  border-left: 1px solid var(--line); 
  word-break: break-word;
  overflow-wrap: anywhere;
}

.pane-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* List / route buttons */
.list-button, .route-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 8px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 110ms ease, border-color 110ms ease, color 110ms ease;
  display: block;
}

.list-button:hover, .list-button.active,
.route-button:hover, .route-button.active {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255,255,255,0.60);
}

/* File tree */
.file-tree { display: grid; gap: 2px; font-family: var(--mono); font-size: 0.76rem; }
.file-tree .depth-1 { padding-left: 14px; }
.file-tree .depth-2 { padding-left: 28px; }

/* Pills */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.pill {
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(30,93,191,0.08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.70rem;
}

/* Cards grid */
.metric-grid, .project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.note-grid { display: grid; gap: 10px; }

.project-card, .note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.project-card {
  transition: transform 140ms ease, border-color 140ms ease;
}

.project-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.note-card {
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 300ms ease, border-color 140ms ease;
  position: relative;
  cursor: pointer;
  z-index: 1;
}

.note-card:hover {
  border-color: var(--line-strong);
}

.note-card.zoomed {
  transform: scale(1.08) !important;
  z-index: 10;
  box-shadow: 0 16px 40px rgba(80,60,0,0.3);
  border-color: rgba(170,140,10,0.6);
}

.metric-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.metric-card span, .project-card span, .note-card span {
  font-size: 0.80rem;
  line-height: 1.5;
  display: block;
  margin-top: 4px;
}

.project-card h3, .note-card h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.1rem;
}

/* Browser */
.browser-bar, .search-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.browser-bar input, .search-bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255,255,255,0.88);
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.84rem;
}

.browser-bar input:focus, .search-bar input:focus {
  outline: none;
  border-color: rgba(30,93,191,0.56);
  box-shadow: 0 0 0 3px rgba(30,93,191,0.12);
}

.browser-page, .search-results { padding: 18px 20px; }

/* Bar chart */
.chart-row { display: grid; gap: 12px; }
.bar-chart  { display: grid; gap: 10px; font-family: var(--mono); }

.bar-item {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  gap: 10px;
  align-items: center;
  font-size: 0.74rem;
}

.bar-track {
  height: 10px;
  border-radius: 3px;
  background: rgba(0,0,0,0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--accent), #5a9cf8);
  border-radius: 2px;
}

/* Network map */
.network-map {
  min-height: 360px;
  position: relative;
  border: 1px solid rgba(100, 140, 255, 0.25);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(108,128,255,0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(108,128,255,0.06) 1px, transparent 1px),
    radial-gradient(circle at center, #101a36, #070c18);
  background-size: 36px 36px, 36px 36px, auto, auto;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
}

.network-node {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(120,180,255,0.6);
  border-radius: 6px;
  background: rgba(12, 22, 48, 0.9);
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #cce0ff;
  box-shadow: 0 0 12px rgba(100, 160, 255, 0.2), 0 4px 12px rgba(0,0,0,0.5);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 0 4px rgba(200, 220, 255, 0.4);
}

.network-node.core {
  color: #ffeba0;
  border-color: rgba(255,220,100,0.8);
  background: rgba(26, 20, 8, 0.95);
  font-weight: 700;
  box-shadow: 0 0 20px rgba(255, 220, 100, 0.3), 0 4px 12px rgba(0,0,0,0.6);
  text-shadow: 0 0 6px rgba(255, 220, 100, 0.6);
}

.network-svg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
}

.network-svg line {
  stroke: rgba(100, 150, 255, 0.5);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

/* ============================================================
   APP-SPECIFIC INTERIOR — CONSOLE
   Dark CRT. Scanlines. Phosphor green on near-black.
   ============================================================ */

.console-app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--mono);
  color: #a0f0c0;
  background:
    repeating-linear-gradient(0deg, rgba(128,255,160,0.04) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #0a1510 0%, #07100c 100%);
}

.console-tabs {
  display: flex;
  gap: 4px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(64,172,104,0.24);
  background: rgba(0,0,0,0.28);
}

.console-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(64,172,104,0.22);
  border-radius: 5px;
  background: rgba(64,172,104,0.06);
  color: rgba(128,240,160,0.65);
  padding: 4px 6px 4px 10px;
  font-size: 0.70rem;
  font-family: var(--mono);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}

.console-tab.console-tab-new {
  padding: 4px 10px;
  font-size: 1.1rem;
  line-height: 1;
}

.console-tab.active {
  color: #7de8a8;
  background: rgba(64,172,104,0.20);
  border-color: rgba(64,172,104,0.50);
}

.console-tab-close {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(128,240,160,0.4);
  transition: background 100ms ease, color 100ms ease;
}

.console-tab-close svg {
  width: 13px;
  height: 13px;
}

.console-tab-close:hover {
  background: rgba(255,100,100,0.2);
  color: #ff8888;
}

.console-log {
  padding: 12px 16px;
  overflow: auto;
  font-size: 0.80rem;
  line-height: 1.72;
}

.term-line { white-space: pre-wrap; margin: 0; }
.term-line.command { color: #7de8a8; }
.term-line.output  { color: #c0f0d0; }
.term-line.system  { color: #60c8ff; font-style: italic; }

.console-input-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px 16px;
  border-top: 1px solid rgba(64,172,104,0.22);
  background: rgba(0,0,0,0.28);
}

.prompt {
  color: #50d890;
  font-family: var(--mono);
  font-size: 0.80rem;
  white-space: nowrap;
}

.console-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d0f8e4;
  outline: 0;
  font-family: var(--mono);
  font-size: 0.80rem;
  caret-color: #7de8a8;
}

/* ============================================================
   APP-SPECIFIC — FILES
   Warm amber file explorer. Sidebar like a document cabinet.
   ============================================================ */

.window.app-files .sidebar {
  background: linear-gradient(180deg, #fff9e0, #f7eecc);
  border-right-color: rgba(180,130,40,0.28);
}

.window.app-files .sidebar .pane-title { color: #8a5c10; }

.window.app-files .list-button { color: #6a4820; }

.window.app-files .list-button:hover,
.window.app-files .list-button.active {
  background: linear-gradient(180deg, #ffe8a0, #ffd050);
  border-color: rgba(170,110,20,0.40);
  color: #3a1e00;
}

.window.app-files .content-pane {
  background: linear-gradient(180deg, #fffef8, #f9f4e6);
  color: #2e1e04;
}

.window.app-files .manifest {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(160,120,40,0.24);
  color: #3a2800;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.80rem;
}

.window.app-files .doc h2 { color: #3a2000; }
.window.app-files .doc p  { color: #7a5828; }

/* ============================================================
   APP-SPECIFIC — BROWSER
   Clean white document surface. Blue chrome.
   ============================================================ */

.window.app-browser .browser-bar {
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  border-bottom-color: rgba(24,100,200,0.18);
}

.window.app-browser .browser-bar input {
  background: rgba(240,248,255,0.90);
  border-color: rgba(24,100,200,0.24);
}

.window.app-browser .browser-page {
  background: #ffffff;
  color: #0e2040;
}

.window.app-browser .doc h2 { color: #0a1e40; }
.window.app-browser .doc p  { color: #2a4870; }

.window.app-browser .route-button:hover,
.window.app-browser .route-button.active {
  background: rgba(24,100,200,0.08);
  border-color: rgba(24,100,200,0.28);
  color: #0a2050;
}

/* ============================================================
   APP-SPECIFIC — PROJECTS
   Editorial warm ivory. Typographic hierarchy.
   ============================================================ */

.window.app-projects .sidebar {
  background: linear-gradient(180deg, #fffdf0, #f8f0d4);
  border-right-color: rgba(170,100,30,0.22);
}

.window.app-projects .sidebar .pane-title { color: #7a4808; }

.window.app-projects .list-button { color: #6a4020; font-size: 0.80rem; }
.window.app-projects .list-button small { color: #a07840; font-size: 0.72rem; display: block; margin-top: 2px; }

.window.app-projects .list-button:hover,
.window.app-projects .list-button.active {
  background: linear-gradient(180deg, #fff0c8, #ffe090);
  border-color: rgba(170,110,20,0.36);
  color: #3a1a00;
}

.window.app-projects .content-pane {
  background: linear-gradient(180deg, #fffdf3, #faf0d8);
  color: #2e1a04;
}

.window.app-projects .doc h2 { color: #3a1e04; font-size: clamp(1.8rem, 3.5vw, 3.4rem); }
.window.app-projects .doc p  { color: #6a4020; }

.window.app-projects .pill {
  background: rgba(180,110,20,0.12);
  border-color: rgba(170,100,20,0.30);
  color: #8a5010;
}

.window.app-projects .inspector { border-left-color: rgba(170,100,30,0.20); }
.window.app-projects .inspector .pane-title { color: #7a4808; }

/* ============================================================
   APP-SPECIFIC — METRICS
   Dark analytical navy. Data-dense. Cyan accents.
   ============================================================ */

.window.app-metrics .content-pane {
  background: linear-gradient(180deg, #0c1c30, #081420);
  color: #a8d4f8;
}

.window.app-metrics .doc h2 {
  color: #7dd4ff;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
}

.window.app-metrics .doc h3 { color: #60b8f0; font-size: 1.15rem; }

.window.app-metrics .metric-card {
  background: linear-gradient(180deg, rgba(80,158,240,0.18), rgba(48,110,200,0.10));
  border: 1px solid rgba(80,158,240,0.30);
  color: #d0ecff;
}

.window.app-metrics .metric-card strong {
  color: #7dd4ff;
  font-size: 2.8rem;
}

.window.app-metrics .metric-card span { color: #7aaace; }

.window.app-metrics .bar-item { color: #7aaace; }

.window.app-metrics .bar-track { background: rgba(80,158,240,0.12); }

.window.app-metrics .bar-fill {
  background: linear-gradient(90deg, #2890e0, #60c8ff);
}

/* ============================================================
   APP-SPECIFIC — NETWORK
   Deep indigo. Blueprint grid. Glowing nodes.
   ============================================================ */

.window.app-network .content-pane {
  background: linear-gradient(180deg, #10182e, #0c1228);
  color: #a0b8ff;
  padding: 16px;
}

.window.app-network .doc h2 {
  color: #88aaff;
  font-size: clamp(1.4rem, 2.8vw, 2.4rem);
}

.window.app-network .doc p { color: #7090cc; }

/* ============================================================
   APP-SPECIFIC — SEARCH
   Warm parchment. Discovery-focused. Amber accents.
   ============================================================ */

.window.app-search .search-bar {
  background: linear-gradient(180deg, #fffcf0, #f8f2e0);
  border-bottom-color: rgba(160,110,40,0.22);
}

.window.app-search .search-results {
  background: linear-gradient(180deg, #fffdf7, #f9f4ea);
  color: #2e1a04;
  padding: 14px 16px;
}

.window.app-search .result-button { color: #6a4020; }
.window.app-search .result-button strong { color: #2e1a04; }
.window.app-search .result-button span   { color: #9a7040; }

.window.app-search .result-button:hover {
  background: rgba(255,240,200,0.70);
  border-color: rgba(160,110,40,0.28);
}

/* ============================================================
   APP-SPECIFIC — RESUME
   Print-clean white. Slate headings. Professional.
   ============================================================ */

.window.app-resume .content-pane {
  background: #ffffff;
  color: #0e1e40;
  padding: 24px 28px;
}

.window.app-resume .doc h2 {
  color: #0a1830;
  font-size: clamp(1.8rem, 3.5vw, 3.2rem);
  border-bottom: 2px solid rgba(60,80,160,0.18);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.window.app-resume .doc h3 { color: #1a3060; font-size: 1.15rem; }
.window.app-resume .doc p  { color: #2a4070; line-height: 1.7; }

.window.app-resume .metric-card {
  background: linear-gradient(180deg, #f4f8ff, #eaf2ff);
  border-color: rgba(60,80,160,0.18);
  color: #0e2040;
}

.window.app-resume .metric-card strong {
  color: #1a50b0;
  font-size: 1.4rem;
}

.window.app-resume .pill {
  background: rgba(60,80,160,0.08);
  border-color: rgba(60,80,160,0.24);
  color: #1a3a90;
}

.resume-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.resume-pdf {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  display: block;
}

.resume-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
  color: #3050a0;
  font-size: 0.88rem;
  opacity: 0.8;
}

/* ============================================================
   APP-SPECIFIC — NOTES
   Warm sticky yellow. Handwritten feel. Slight rotation.
   ============================================================ */

.window.app-notes .content-pane {
  background: linear-gradient(180deg, #fffcd0, #fff9a0);
  color: #2e2800;
  padding: 18px;
}

.window.app-notes .doc h2 {
  color: #3a2c00;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.window.app-notes .note-card {
  background: linear-gradient(180deg, #fffce8, #fffad0);
  border-color: rgba(170,140,10,0.36);
  color: #3a2c00;
  box-shadow: 2px 2px 8px rgba(100,80,0,0.12);
}

.window.app-notes .note-card:nth-child(odd)  { transform: rotate(-0.3deg); }
.window.app-notes .note-card:nth-child(even) { transform: rotate(0.25deg); }

.window.app-notes .note-card h3 { color: #3a2800; font-family: var(--serif); }
.window.app-notes .note-card span { color: #7a6020; }

/* ============================================================
   APP-SPECIFIC — CONTACT
   Blush rose. Communication panel. Soft and warm.
   ============================================================ */

.window.app-contact .content-pane {
  background: linear-gradient(180deg, #fff4f8, #ffebf2);
  color: #2e0618;
  padding: 20px;
}

.window.app-contact .doc h2 {
  color: #3e0820;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
}

.window.app-contact .doc p  { color: #8a3050; }

.window.app-contact .project-card {
  background: linear-gradient(180deg, #fff0f4, #ffe6ef);
  border-color: rgba(200,80,130,0.28);
  color: #2e0618;
}

.window.app-contact .project-card:hover {
  background: linear-gradient(180deg, #ffe8f0, #ffd8e8);
  border-color: rgba(200,80,130,0.50);
}

.window.app-contact .project-card h3 { color: #3e0820; display: flex; align-items: center; }
.window.app-contact .project-card span { color: #9a4060; }

.contact-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  stroke: #8a3050;
}

.window.app-contact .pill {
  background: linear-gradient(180deg, #ffd8ea, #ffbad8);
  border-color: rgba(200,80,130,0.36);
  color: #5a0e30;
}

/* ============================================================
   DOCUMENT SHARED STYLES (used across light apps)
   ============================================================ */

.doc h2, .doc h3 {
  font-family: var(--serif);
  line-height: 1.05;
  margin: 0 0 12px;
  text-wrap: balance;
}

.doc h2 { font-size: clamp(1.8rem, 4vw, 3.6rem); }
.doc h3 { font-size: 1.3rem; margin-top: 18px; }

.doc p { max-width: 66ch; line-height: 1.7; margin: 0 0 12px; }

.doc code, .manifest { font-family: var(--mono); font-size: 0.80rem; }

.manifest {
  border-radius: 6px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow: auto;
  margin-top: 10px;
}

/* ============================================================
   CONTAINER QUERIES — Window interior responsiveness
   ============================================================ */

@container (max-width: 860px) {
  .app-layout {
    grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr) !important;
    grid-template-rows: 1fr auto !important;
  }

  .inspector {
    display: block !important;
    grid-column: 1 / -1 !important;
    border-left: 0 !important;
    border-top: 1px solid var(--line) !important;
    max-height: 200px;
  }
  
  .metric-grid, .project-grid { grid-template-columns: 1fr; }
  .bar-item { grid-template-columns: 90px 1fr 46px; font-size: 0.70rem; }
}

@container (max-width: 560px) {
  .app-layout { 
    grid-template-columns: 1fr !important; 
    grid-template-rows: auto 1fr auto !important;
  }

  .sidebar, .inspector {
    display: block !important;
    border: 0 !important;
    grid-column: 1 / -1 !important;
    max-height: 160px;
  }
  
  .sidebar { border-bottom: 1px solid var(--line) !important; }
  .inspector { border-top: 1px solid var(--line) !important; }

  .content-pane { padding: 10px 12px; }
  .doc h2 { font-size: clamp(1.3rem, 6cqi, 2rem); }
  .console-input-row { grid-template-columns: 1fr; gap: 3px; }
  .prompt { font-size: 0.72rem; }
}

/* ============================================================
   CUSTOM SCROLLBARS PER APP
   Matches the aesthetic identity of each application.
   ============================================================ */

.window.app-console *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(64,172,104,0.5), rgba(64,172,104,0.7));
  border-color: rgba(64,172,104,0.1);
}
.window.app-console *::-webkit-scrollbar-thumb:hover { background: rgba(64,172,104,0.9); }

.window.app-files *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c4a060, #a87e38);
  border-color: rgba(255,250,240,0.6);
}
.window.app-files *::-webkit-scrollbar-thumb:hover { background: #966c28; }

.window.app-browser *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7caadf, #4e85cc);
  border-color: rgba(255,255,255,0.6);
}
.window.app-browser *::-webkit-scrollbar-thumb:hover { background: #4078bf; }

.window.app-projects *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e4a860, #d08030);
  border-color: rgba(255,253,243,0.6);
}
.window.app-projects *::-webkit-scrollbar-thumb:hover { background: #b06010; }

.window.app-metrics *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #60c8ff, #2890e0);
  border-color: rgba(12,28,48,0.8);
}
.window.app-metrics *::-webkit-scrollbar-thumb:hover { background: #1a7ab8; }

.window.app-network *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7090cc, #4860e0);
  border-color: rgba(16,24,46,0.8);
}
.window.app-network *::-webkit-scrollbar-thumb:hover { background: #3048a0; }

.window.app-search *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #d8bc88, #b89048);
  border-color: rgba(255,253,247,0.6);
}
.window.app-search *::-webkit-scrollbar-thumb:hover { background: #987028; }

.window.app-notes *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e4c840, #d0a010);
  border-color: rgba(255,252,208,0.6);
}
.window.app-notes *::-webkit-scrollbar-thumb:hover { background: #b08000; }

.window.app-contact *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e490b0, #d05080);
  border-color: rgba(255,244,248,0.6);
}
.window.app-contact *::-webkit-scrollbar-thumb:hover { background: #b03060; }

.window.app-resume *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8a9fc0, #5a74a0);
  border-color: rgba(255,255,255,0.6);
}
.window.app-resume *::-webkit-scrollbar-thumb:hover { background: #405a80; }
