/* ============================================================
   Sahil OS — dark TV desktop + light classic-Mac windows
   ============================================================ */

:root {
  --bg: #060606;
  --ink: #e6e6e6;
  --ink-dim: #8c8c8c;
  --ink-faint: #555;
  --line: #262626;
  --line-soft: #181818;
  --neon: #36ff7a;
  --font: "IBM Plex Mono", ui-monospace, "Berkeley Mono", "Geist Mono",
    SFMono-Regular, Menlo, Consolas, monospace;

  /* classic-mac light window palette */
  --w-bg: #ededed;
  --w-paper: #fbfbfb;
  --w-head: #e3e3e3;
  --w-head-2: #d2d2d2;
  --w-line: #c9c9c9;
  --w-line-soft: #e0e0e0;
  --w-ink: #1c1c1c;
  --w-ink-dim: #6a6a6a;
  --w-ink-faint: #9a9a9a;
  --w-sel: #d4dcea;
  --w-sidebar: #e6e6e6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: default;
  user-select: none;
}

/* ---------- Boot sequence ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.58);
  display: flex;
  align-items: flex-start;
  padding: 8vh 6vw;
  transition: opacity 0.45s ease;
}
.boot.gone { opacity: 0; pointer-events: none; }

.boot-text {
  font-family: var(--font);
  font-size: clamp(15px, 2.4vw, 26px);
  line-height: 1.9;
  color: var(--neon);
  text-shadow: 0 0 6px rgba(54, 255, 122, 0.65),
    0 0 18px rgba(54, 255, 122, 0.35);
  letter-spacing: 0.04em;
  white-space: pre-wrap;
}
.boot-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  background: var(--neon);
  box-shadow: 0 0 8px rgba(54, 255, 122, 0.8);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}

/* ---------- CRT / TV layers (dull, jittery) ---------- */
.crt {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 170px 170px;
  animation: static-shift 0.5s steps(4) infinite;
  will-change: transform;
}
@keyframes static-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 3px); }
  50% { transform: translate(3px, -3px); }
  75% { transform: translate(-3px, -2px); }
  100% { transform: translate(2px, 3px); }
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 8999;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.7;
}

/* slow rolling band + faint flicker = old TV */
.flicker {
  position: fixed;
  inset: 0;
  z-index: 8998;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 48%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 52%
  );
  background-size: 100% 220px;
  animation: roll 7s linear infinite, flick 5s steps(30) infinite;
}
@keyframes roll {
  0% { background-position: 0 -220px; }
  100% { background-position: 0 100vh; }
}
@keyframes flick {
  0%, 96%, 100% { opacity: 0.5; }
  97% { opacity: 0.3; }
  98% { opacity: 0.7; }
  99% { opacity: 0.4; }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 8997;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,0.6) 100%);
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 28px;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(2px);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.menubar-left, .menubar-right { display: flex; align-items: center; gap: 2px; }

.menu-item {
  padding: 3px 9px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  cursor: pointer;
}
.menu-item:hover { background: var(--ink); color: #000; }
.menu-logo::before { content: "Sahil"; font-weight: 600; }

.menu-clock {
  min-width: 86px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.menu-clock.morphing { color: var(--ink); background: transparent; }

/* ---------- Desktop ---------- */
.desktop { position: absolute; inset: 28px 0 0 0; z-index: 10; }

.manifesto {
  position: absolute;
  top: 40px; left: 46px;
  max-width: 300px;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.04em;
}
.principle {
  color: var(--ink);
  margin-bottom: 14px;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.15);
}

.obsession {
  position: absolute;
  bottom: 34px; left: 46px;
  color: var(--ink-dim);
  font-size: 12.5px;
  line-height: 1.7;
}
.obsession-label {
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  margin-bottom: 10px;
}

/* ---------- Desktop icons (enlarged) ---------- */
.icons {
  position: absolute;
  top: 46px; right: 52px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
}
.icon {
  background: none; border: none;
  color: var(--ink);
  font-family: inherit;
  display: flex; flex-direction: column; align-items: center;
  gap: 9px;
  width: 116px;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.14s ease;
}
.icon-glyph {
  font-size: 56px;
  line-height: 1;
  filter: saturate(0.85) brightness(1.05) drop-shadow(0 3px 6px rgba(0,0,0,0.6));
  transition: transform 0.14s ease, filter 0.14s ease;
}
.icon-label {
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 3px;
}
.icon:hover { transform: translateY(-2px); }
.icon:hover .icon-glyph { transform: scale(1.07); filter: saturate(1) brightness(1.18) drop-shadow(0 4px 10px rgba(0,0,0,0.7)); }
.icon:active .icon-glyph { transform: scale(0.95); }
.icon.selected .icon-label { background: var(--ink); color: #000; }

.icon.jitter { animation: jitter 0.4s ease; }
@keyframes jitter {
  0%, 100% { transform: translate(0,0) rotate(0); }
  15% { transform: translate(-3px,2px) rotate(-2deg); }
  30% { transform: translate(3px,-2px) rotate(2deg); }
  45% { transform: translate(-3px,1px) rotate(-1.5deg); }
  60% { transform: translate(3px,-1px) rotate(1.5deg); }
  80% { transform: translate(-2px,1px) rotate(-1deg); }
}

/* ---------- Whisper (Trash / Future) near cursor ---------- */
.whisper {
  position: fixed;
  z-index: 8000;
  width: 200px;
  text-align: center;
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.92);
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 2px 6px rgba(0,0,0,0.9);
}
.whisper.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.whisper b { display: block; font-weight: 600; font-size: 19px; margin-top: 4px; }

/* ============================================================
   Windows — classic Mac LIGHT theme
   ============================================================ */
.window {
  position: absolute;
  min-width: 320px;
  background: var(--w-bg);
  border: 1px solid #b4b4b4;
  border-radius: 9px;
  box-shadow: 0 22px 70px rgba(0,0,0,0.65), 0 0 0 0.5px rgba(0,0,0,0.2);
  color: var(--w-ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  opacity: 0;
  transform: scale(0.95);
  transform-origin: center;
  animation: win-open 0.17s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes win-open { to { opacity: 1; transform: scale(1); } }
.window.closing { animation: win-close 0.13s ease forwards; }
@keyframes win-close { to { opacity: 0; transform: scale(0.96); } }
.window.minimizing { animation: win-min 0.22s cubic-bezier(0.5, 0, 0.7, 0.3) forwards; }
@keyframes win-min { to { opacity: 0; transform: translateY(60vh) scale(0.2); } }

.window-titlebar {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: linear-gradient(to bottom, var(--w-head), var(--w-head-2));
  border-bottom: 1px solid var(--w-line);
  cursor: grab;
  flex-shrink: 0;
}
.window-titlebar:active { cursor: grabbing; }

.traffic { display: flex; gap: 8px; align-items: center; }
.traffic span {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9px; line-height: 1; color: rgba(0,0,0,0.5);
  cursor: pointer;
}
.traffic .tl-close { background: #ff5f57; border: 0.5px solid #e0443e; }
.traffic .tl-min { background: #febc2e; border: 0.5px solid #d99e1f; }
.traffic .tl-max { background: #28c840; border: 0.5px solid #1faa33; }
.traffic span b { opacity: 0; font-weight: 700; }
.traffic:hover span b { opacity: 1; }

.window-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: #3a3a3a;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 12px;
}

.window-body { flex: 1; overflow: auto; min-height: 0; background: var(--w-paper); }

.window-body::-webkit-scrollbar { width: 13px; height: 13px; }
.window-body::-webkit-scrollbar-thumb {
  background: #c2c2c2; border-radius: 8px; border: 3px solid var(--w-paper);
}
.window-body::-webkit-scrollbar-track { background: transparent; }

/* ---------- Finder (light) ---------- */
.finder { display: flex; height: 100%; background: var(--w-paper); }

.finder-sidebar {
  width: 168px;
  flex-shrink: 0;
  background: var(--w-sidebar);
  border-right: 1px solid var(--w-line);
  padding: 12px 8px;
  font-size: 13px;
}
.finder-sidebar .sb-head {
  color: var(--w-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  padding: 8px 8px 5px;
}
.finder-sidebar .sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--w-ink-dim);
}
.finder-sidebar .sb-item.active { background: var(--w-sel); color: var(--w-ink); }

.finder-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.finder-path {
  height: 28px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border-bottom: 1px solid var(--w-line-soft);
  color: var(--w-ink-faint);
  font-size: 11.5px;
  flex-shrink: 0;
}
.finder-path .crumb { cursor: pointer; color: var(--w-ink-dim); }
.finder-path .crumb:hover { color: var(--w-ink); text-decoration: underline; }
.finder-path .crumb.current { color: var(--w-ink-faint); cursor: default; text-decoration: none; }

.finder-list { flex: 1; overflow: auto; padding: 4px 0; }
.finder-list::-webkit-scrollbar { width: 13px; }
.finder-list::-webkit-scrollbar-thumb {
  background: #c2c2c2; border-radius: 8px; border: 3px solid var(--w-paper);
}

/* file rows — clearly clickable */
.file-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--w-line-soft);
  transition: background 0.1s ease;
}
.file-row:hover { background: #eef1f6; }
.file-row.selected { background: var(--w-sel); }
.file-icon { font-size: 19px; text-align: center; }
.file-name {
  font-size: 14px;
  color: var(--w-ink);
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s ease, color 0.12s ease;
}
.file-row:hover .file-name { text-decoration-color: var(--w-ink-dim); }
.file-desc {
  grid-column: 2;
  font-size: 12px;
  color: var(--w-ink-dim);
  line-height: 1.5;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
}
.file-row:hover .file-desc { max-height: 70px; opacity: 1; margin-top: 5px; }

/* ---------- Editor / About (light paper) ---------- */
.editor {
  height: 100%;
  padding: 26px 30px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--w-ink);
  white-space: pre-wrap;
  overflow: auto;
  letter-spacing: 0.005em;
  background: var(--w-paper);
}
.editor::-webkit-scrollbar { width: 13px; }
.editor::-webkit-scrollbar-thumb {
  background: #c2c2c2; border-radius: 8px; border: 3px solid var(--w-paper);
}
.editor .dim { color: var(--w-ink-dim); }

/* ---------- Terminal (Contact) — green-on-black ---------- */
.window.term-win { background: #050505; border-color: #2a2a2a; }
.window.term-win .window-titlebar {
  background: linear-gradient(to bottom, #1a1a1a, #121212);
  border-bottom: 1px solid #2a2a2a;
}
.window.term-win .window-title { color: #9a9a9a; }
.window.term-win .window-body { background: #000; }

.terminal {
  height: 100%;
  background: #000;
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--neon);
  text-shadow: 0 0 5px rgba(54,255,122,0.4);
  overflow: auto;
}
.terminal::-webkit-scrollbar { width: 12px; }
.terminal::-webkit-scrollbar-thumb { background: #1f1f1f; border-radius: 8px; border: 3px solid #000; }
.terminal .prompt-line { display: flex; gap: 8px; }
.terminal .sigil { color: #1f9e52; }
.terminal .cmd { color: var(--neon); }
.terminal .out { color: #bdf7d2; text-shadow: none; }
.terminal .out b { color: #fff; font-weight: 500; }
.terminal a { color: var(--neon); text-decoration: underline; text-underline-offset: 2px; }

.cursor {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--neon);
  box-shadow: 0 0 6px rgba(54,255,122,0.7);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

.cal-card {
  margin-top: 14px;
  border: 1px solid #1f9e52;
  border-radius: 6px;
  padding: 16px 18px;
  max-width: 320px;
}
.cal-card p { color: #bdf7d2; margin-bottom: 12px; line-height: 1.6; text-shadow: none; }
.cal-card p b { color: #fff; font-weight: 500; }
.cal-btn {
  display: inline-block;
  border: 1px solid var(--neon);
  color: var(--neon);
  background: transparent;
  font-family: inherit; font-size: 12.5px;
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.cal-btn:hover { background: var(--neon); color: #000; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .manifesto { position: static; max-width: none; padding: 16px 22px 0; }
  .obsession { position: static; padding: 22px 22px 0; }
  .desktop { overflow-y: auto; }
  .icons {
    position: static;
    flex-direction: row; flex-wrap: wrap; justify-content: center;
    gap: 26px; margin: 28px 0 40px;
  }
  .window {
    left: 10px !important; top: 42px !important;
    width: calc(100vw - 20px) !important; max-width: none;
    height: calc(100vh - 60px) !important;
  }
  .finder-sidebar { display: none; }
  .menu-item[data-menu] { display: none; }
  .menu-logo { display: inline !important; }
}
