/*
 * The Uplink section. Uplink is its own app, so its window is drawn as Uplink draws itself: Inter, its
 * bar and crumbs, the linked-folder bar, the transfer tray with the pixel meter, and its dialogs
 * (Linked folder, History, Undo), ported from Uplink's src/features and its own site. Every class in
 * the window starts with u- so nothing here meets Lantern's mocks. Lantern's window beside it uses
 * Lantern's own parts (bubble, trail, the deploy card in site.css).
 */
@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ── the head: the name, the line, and where to get it ── */
.up-sec { justify-content: flex-start; }
.up-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 48px; }
.up-intro { display: flex; flex-direction: column; gap: 22px; }
.up-intro .h2 { margin: 0; }
.up-intro .lead { max-width: 33em; }
.up-eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 500; color: var(--text-2); }
.up-mark { display: inline-block; width: 20px; height: 20px; }
.up-mark svg { width: 100%; height: 100%; overflow: visible; }
.up-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; padding-bottom: 4px; }
.up-buy .up-cta { margin: 0; }

/* ── the three tabs: each one a line that fills while its part plays ── */
.up-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin: 56px 0 24px; }
.up-tab { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 0 0 4px; border-radius: 4px; }
.up-prog { position: relative; display: block; align-self: stretch; width: 100%; height: 2px; margin-bottom: 14px; background: var(--line-2); overflow: hidden; }
.up-prog i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--text); }
.up-tab b { font-size: 20px; font-weight: 500; letter-spacing: -0.012em; color: var(--text-3); transition: color var(--d-3); }
.up-tab > span:last-child { font-size: 15.5px; line-height: 1.45; color: var(--text-4); transition: color var(--d-3); max-width: 25em; }
.up-tab:hover b { color: var(--text-2); }
.up-tab[aria-selected='true'] b { color: var(--text); }
.up-tab[aria-selected='true'] > span:last-child { color: var(--text-2); }
.up-tab[aria-selected='false'] .up-prog i { width: 0 !important; transition: none !important; }

/* ── the desk: Uplink's own dither field behind the windows ── */
.up-desk { position: relative; border-radius: 28px; overflow: hidden; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); isolation: isolate; }
:root[data-theme='light'] .up-desk { background: var(--bg); }
.up-field { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: -1; }
.up-desk .scaler { position: relative; width: 100%; }
.up-desk .scaler > * { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.up-scene { width: 1240px; height: 760px; }
.up-scene .cursor { z-index: 20; }
.up-scene .click-ring { z-index: 19; box-shadow: 0 0 0 1.5px rgb(var(--text-rgb) / 0.6), 0 0 0 3px rgb(var(--bg-rgb) / 0.4); }

/* Two layouts: Uplink alone, centred; or Uplink to the right and smaller, with Lantern in front. */
.uw {
  --heart-k: #000; --heart-r: #fe0000; --heart-d: #9c0000; --heart-off: rgb(var(--text-rgb) / 0.3);
  position: absolute; left: 70px; top: 30px; width: 1100px; height: 700px; border-radius: 14px; overflow: hidden;
  background: var(--bg); box-shadow: var(--shadow-app); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px; line-height: 1.35; color: var(--text); transform-origin: 100% 0; transition: transform 900ms var(--ease-out); isolation: isolate;
  -webkit-font-smoothing: antialiased;
}
/* Uplink always wears the other theme from the page, so the two sit in contrast: a dark Uplink on the
   light page, a light one on the dark page. Only the window's own tokens swap (its shadow follows the page). */
:root[data-theme='light'] .uw {
  --bg: #070708; --sheet: #0c0c0e; --panel: #121214; --panel-2: #18181b; --panel-3: #1f1f23;
  --fill-1: rgb(255 255 255 / 0.035); --fill-2: rgb(255 255 255 / 0.06); --fill-3: rgb(255 255 255 / 0.09); --fill-4: rgb(255 255 255 / 0.125);
  --line: rgb(255 255 255 / 0.06); --line-2: rgb(255 255 255 / 0.09); --line-3: rgb(255 255 255 / 0.15);
  --text-rgb: 242 241 238; --bg-rgb: 7 7 8; --sheet-rgb: 12 12 14;
  --text: #f2f1ee; --text-2: #d6d4ce; --text-3: #a6a49e; --text-4: #85837c; --text-inverse: #0a0a0b;
  --amber: oklch(0.84 0.135 82); --red: oklch(0.71 0.175 24); --green: oklch(0.8 0.15 150);
  --shadow-pop: 0 12px 32px -12px rgb(0 0 0 / 0.75), 0 0 0 1px rgb(0 0 0 / 0.35);
  --glass: rgb(14 14 16 / 0.72);
  color-scheme: dark;
}
:root[data-theme='dark'] .uw {
  --bg: #e6e3dd; --sheet: #eeebe5; --panel: #f4f2ed; --panel-2: #f8f6f2; --panel-3: #fbfaf7;
  --fill-1: rgb(38 32 24 / 0.04); --fill-2: rgb(38 32 24 / 0.065); --fill-3: rgb(38 32 24 / 0.095); --fill-4: rgb(38 32 24 / 0.13);
  --line: rgb(38 32 24 / 0.085); --line-2: rgb(38 32 24 / 0.12); --line-3: rgb(38 32 24 / 0.19);
  --text-rgb: 28 27 25; --bg-rgb: 230 227 221; --sheet-rgb: 238 235 229;
  --text: #1c1b19; --text-2: #45433e; --text-3: #5a5750; --text-4: #6b675f; --text-inverse: #f4f2ee;
  --amber: oklch(0.64 0.15 72); --red: oklch(0.56 0.19 25); --green: oklch(0.56 0.14 150);
  --shadow-pop: 0 14px 34px -14px rgb(60 45 25 / 0.28), 0 0 0 1px rgb(60 45 25 / 0.07);
  --glass: rgb(244 242 237 / 0.78);
  background: var(--sheet);
  color-scheme: light;
}
.up-scene[data-layout='lantern'] .uw { transform: translate(50px, 91px) scale(0.74); }
.lw {
  position: absolute; left: 20px; top: 150px; width: 392px; z-index: 5; border-radius: 14px; overflow: hidden; background: var(--sheet);
  box-shadow: var(--shadow-app); font-size: 13px; color: var(--text);
  opacity: 0; transform: translateX(-24px) scale(0.98); transition: opacity 420ms var(--ease), transform 700ms var(--ease-out); pointer-events: none;
}
:root[data-theme='light'] .lw { background: var(--panel-2); }
.up-scene[data-layout='lantern'] .lw { opacity: 1; transform: none; }
.lw-head { display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.lw-head b { font-weight: 500; font-size: 14px; }
.lw-glyph { display: inline-flex; }
.lw-proj { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--fill-2); font-size: 12px; color: var(--text-3); }
.lw-body { display: flex; flex-direction: column; gap: 12px; padding: 20px 18px 20px; }
.lw-body .bubble { font-size: 13px; }
.lw-trail li { height: 24px; font-size: 12.5px; }
.lw-trail li code { font-size: 11px; }
.lw-card:empty { display: none; }
.lw-card .mbtn { white-space: nowrap; }

/* Saves on this Mac, as upload on save sees them: they stack up at the desk's lower left. */
.up-saves { position: absolute; left: 22px; bottom: 30px; z-index: 6; display: flex; flex-direction: column; gap: 8px; width: 318px; }
.up-save { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line-2); animation: up-save-in 460ms var(--ease-out) both; }
.up-save .who { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--fill-2); flex: none; color: var(--text-2); }
.up-save .who .ic { width: 14px; height: 14px; }
.up-save .txt { min-width: 0; flex: 1; }
.up-save .txt b { font-weight: 500; font-size: 13.5px; }
.up-save .txt span { display: block; font-size: 12px; color: var(--text-3); }
.up-save .st { font-size: 12px; color: var(--text-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.up-save .st .ic { width: 12px; height: 12px; color: var(--green); }
.up-save.old { opacity: 0.6; transition: opacity 400ms; }
.up-save.out { animation: up-save-out 360ms var(--ease) both; }
@keyframes up-save-out { to { opacity: 0; transform: translateY(-8px) scale(0.97); } }
@keyframes up-save-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* ══════════ the Uplink window ══════════ */
.uw .ic { width: 15px; height: 15px; fill: currentColor; flex: none; }
.uw .u-dim { color: var(--text-3); }
.u-bar { position: relative; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px; }
.u-crumbs { display: flex; align-items: center; gap: 10px; }
.u-crumbs .u-dim, .u-end .u-dim { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13.5px; }
.u-crumbs b { font-weight: 600; font-size: 13.5px; }
.u-sep { width: 1px; height: 18px; background: var(--line-3); margin: 0 4px; }
.u-live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px oklch(0.8 0.15 150 / 0.12); flex: none; }
.u-proto { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 7px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12px; font-weight: 500; color: var(--text-3); }
.uw .u-proto .ic { width: 12px; height: 12px; }
.u-heart { display: inline-block; width: 17px; height: 17px; margin: 0 2px; }
.u-heart svg { width: 100%; height: 100%; overflow: visible; display: block; }
.u-icbtn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--text-3); transition: background-color 160ms, color 160ms; }
.u-icbtn.hover { background: var(--fill-2); color: var(--text); }
.u-head { display: flex; align-items: center; gap: 14px; height: 78px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.u-back { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14px; font-weight: 540; }
.u-title { font-size: 23px; font-weight: 660; letter-spacing: -0.02em; line-height: 1.1; }
.u-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 13px; color: var(--text-3); }
.uw .u-sub .ic { width: 13px; height: 13px; }
.uw .u-sub .chev { width: 11px; height: 11px; opacity: 0.6; }
.u-tools { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.u-btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 8px; font-weight: 550; font-size: 13px; white-space: nowrap; transition: background-color 160ms, color 160ms, transform 120ms var(--ease-out), box-shadow 160ms; }
.u-solid { background: var(--text); color: var(--text-inverse); }
.u-ghost { background: var(--fill-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.u-sm { height: 28px; }
.u-xs { height: 26px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.uw .u-xs .ic { width: 12px; height: 12px; }
.u-btn.hover { transform: translateY(-1px); box-shadow: 0 0 0 3px rgb(var(--text-rgb) / 0.14); }
.u-btn.press { transform: scale(0.96); }

/* The linked-folder bar */
.u-link { display: flex; align-items: center; gap: 9px; height: 46px; margin: 0 18px; border-bottom: 1px solid var(--line); }
.u-route { display: inline-flex; align-items: center; gap: 9px; height: 30px; margin-left: -6px; padding: 0 6px; border-radius: 7px; transition: background-color 160ms; }
.u-route .ic { color: var(--text-3); width: 14px; height: 14px; }
.u-route.hover { background: var(--fill-2); }
.u-note { margin-left: 8px; transition: color 200ms; }
.u-note.lit { color: var(--text-2); }
.u-link [data-sync-btn] { margin-left: auto; }
.u-dash { position: relative; width: 30px; height: 2px; background: radial-gradient(circle, var(--text-2) 1px, transparent 1.3px) 0 50% / 5px 2px repeat-x; animation: u-march 900ms linear infinite; }
.u-dash::after { content: ''; position: absolute; right: -3px; top: -2.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
@keyframes u-march { to { background-position: 5px 50%; } }

/* The folder's files */
.u-thead, .u-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 80px 170px 140px; gap: 12px; align-items: center; }
.u-thead { height: 38px; padding: 0 26px; font-size: 12.5px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.u-thead > span:first-child { grid-column: span 2; display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.uw .u-thead .ic { width: 11px; height: 11px; }
.u-thead > span:nth-child(2) { text-align: right; }
.u-tbl { padding: 6px 8px; }
.u-row { height: 34px; padding: 0 18px; border-radius: 8px; font-size: 13.5px; transition: background-color 600ms; }
.u-row > span:nth-child(3) { text-align: right; }
.uw .u-row .fold { color: var(--text-3); }
.u-row.gone { display: none; }
.u-row.fresh { animation: u-fresh 1.6s var(--ease) both; }
.u-row.leaving { animation: u-leave 520ms var(--ease) both; }
@keyframes u-fresh { 0%, 30% { background: var(--fill-4); } 100% { background: transparent; } }
@keyframes u-leave { to { opacity: 0; transform: translateX(-8px); } }

/* Dialogs over a scrim */
.u-scrim { position: absolute; inset: 0; z-index: 3; background: rgb(0 0 0 / 0.5); opacity: 0; transition: opacity 260ms var(--ease); pointer-events: none; }
:root[data-theme='dark'] .u-scrim { background: rgb(60 45 25 / 0.2); }
.u-scrim.on { opacity: 1; }
.u-dlg { position: absolute; left: 50%; top: 50%; z-index: 4; padding: 22px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line-2); opacity: 0; transform: translate(-50%, -47%) scale(0.98); transition: opacity 240ms var(--ease), transform 340ms var(--ease-out); pointer-events: none; }
.u-dlg.on { opacity: 1; transform: translate(-50%, -50%); }
.u-dlg-title { font-size: 16px; font-weight: 630; letter-spacing: -0.01em; }
.u-dlg-sub { margin-top: 3px; }
.u-dlg-desc { margin: 6px 0 16px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.u-dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.u-footnote { margin-right: auto; font-size: 12.5px; }
.u-unlink { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 13.5px; }
.uw .u-unlink .ic { width: 13px; height: 13px; }
/* Linked folder */
.u-dlg-link { width: 470px; }
.u-lab { margin: 12px 0 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.u-field { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 5px 0 12px; border-radius: 9px; background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13.5px; }
.u-switch-row { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.u-switch-row > div { flex: 1; }
.u-sw-title { font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.u-switch-row .u-dim { font-size: 12.5px; }
.u-switch { position: relative; width: 36px; height: 22px; border-radius: 999px; background: var(--fill-4); flex: none; transition: background-color 200ms; }
.u-switch i { position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: transform 240ms var(--ease-out); }
.u-switch.on { background: var(--text); }
.u-switch.on i { transform: translateX(14px); background: var(--bg); }
/* History */
.u-dlg-hist { width: 600px; }
.u-dlg-sub + .u-hrec { margin-top: 14px; }
.u-hline { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 4px; }
.u-hdot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); flex: none; }
.u-hkind { width: 88px; flex: none; font-size: 14px; font-weight: 600; }
.u-hsum { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-hsum b { font-weight: 600; color: var(--text); }
.u-hwhen { font-size: 12.5px; white-space: nowrap; }
.u-hfiles { margin: 0 0 6px 23px; padding: 10px 14px; border-radius: 10px; background: var(--fill-1); font-size: 13px; line-height: 1.7; }
.u-hchecks { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.u-hchecks span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.uw .u-hchecks .ic { width: 12px; height: 12px; color: var(--green); }
.u-hfoot { margin: 12px 0 0; font-size: 12.5px; }
/* Undo */
.u-dlg-undo { width: 470px; }
.u-ulist { margin-top: 16px; padding: 6px; border-radius: 10px; background: var(--fill-1); }
.u-urow { display: grid; grid-template-columns: 16px auto 1fr; gap: 10px; align-items: center; height: 32px; padding: 0 10px; font-size: 13.5px; }
.u-urow > span:last-child { text-align: right; font-size: 12.5px; }
.u-umark { display: grid; place-items: center; color: var(--text-3); }
.uw .u-umark .ic { width: 12px; height: 12px; }

/* The transfer tray */
.u-tray { position: absolute; left: 50%; bottom: 20px; z-index: 2; width: 540px; padding: 13px 16px 14px; border-radius: 14px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line-2); opacity: 0; transform: translate(-50%, 24px); transition: opacity 260ms var(--ease), transform 380ms var(--ease-out); }
.u-tray.on { opacity: 1; transform: translate(-50%, 0); }
.u-tray-line { display: flex; align-items: center; gap: 10px; }
.u-tray-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.u-tray-text b { font-size: 14px; font-weight: 600; }
.u-tray-text .u-dim { overflow: hidden; text-overflow: ellipsis; }
.u-tray-bytes { font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.u-tray-ic { display: grid; place-items: center; width: 16px; height: 16px; flex: none; }
.u-tray-ic.run::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 1.6px solid var(--line-3); border-top-color: var(--text); animation: u-spin 0.8s linear infinite; }
.u-tray-ic.ok { border-radius: 50%; background: var(--text); color: var(--text-inverse); }
.uw .u-tray-ic.ok .ic { width: 10px; height: 10px; }
@keyframes u-spin { to { transform: rotate(360deg); } }
.u-meter { display: block; width: 100%; height: 6px; margin-top: 11px; color: var(--text); image-rendering: pixelated; }
.u-tray:not(.running) .u-meter { display: none; }
.u-checks:empty { display: none; }
.u-checks { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.u-checks div { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); animation: u-in 300ms var(--ease-out) both; }
.uw .u-checks .ic { width: 12px; height: 12px; color: var(--green); }
.u-checks .wait::before { content: ''; width: 9px; height: 9px; margin: 0 1px; border-radius: 50%; border: 1.4px solid var(--line-3); border-top-color: var(--text-2); animation: u-spin 0.8s linear infinite; }
.u-tray-acts { display: none; margin-top: 10px; }
.u-tray-acts.on { display: flex; animation: u-in 300ms var(--ease-out) both; }
@keyframes u-in { from { opacity: 0; transform: translateY(3px); } }

/* ── narrower screens ── */
@media (max-width: 1000px) {
  .up-head { grid-template-columns: 1fr; gap: 28px; }
  .up-buy { align-items: flex-start; }
  .up-tabs { gap: 18px; }
  .up-tab b { font-size: 17px; }
  .up-tab > span:last-child { font-size: 14px; }
}
@media (max-width: 640px) {
  .up-tabs { grid-template-columns: 1fr; gap: 6px; margin: 40px 0 18px; }
  .up-tab { padding: 0; }
  .up-prog { margin-bottom: 10px; }
  .up-tab[aria-selected='false'] > span:last-child { display: none; }
  .up-tab b { font-size: 17px; }
  .up-desk { border-radius: 18px; }
  /* A taller, narrower scene: Uplink fills it, Lantern sits over its lower half when it asks. */
  .up-scene { width: 760px; height: 980px; }
  .uw { left: 20px; top: 20px; width: 720px; height: 940px; transform-origin: 50% 100%; }
  .up-scene[data-layout='lantern'] .uw { transform: none; }
  .lw { left: 60px; top: auto; bottom: 40px; width: 640px; }
  .lw-body { min-height: 0; }
  .u-thead, .u-row { grid-template-columns: 22px minmax(0, 1fr) 70px 120px; }
  .u-thead > span:last-child, .u-row > span:last-child { display: none; }
  .u-tools > .ic, .u-tools .u-ghost, .u-crumbs .u-proto, .u-end { display: none; }
  .u-link .u-note { display: none; }
  .u-tray { width: 600px; }
  .up-saves { left: 50%; bottom: 150px; width: 520px; transform: translateX(-50%); }
}
