/* Nogard OS – plocha s obvodovým „N“ na pozadí, matně průhledná okna,
   barvy převzaté z tapety: světle modrá (cyan) a fialová. */
:root {
  /* Světlý režim */
  --bg: #e9eff6;
  --fg: #16203a;
  --muted: #56647e;
  --glass: rgba(246, 250, 255, .52);
  --glass-bar: rgba(255, 255, 255, .45);
  --panel: rgba(255, 255, 255, .55);
  --line: rgba(70, 100, 160, .18);
  --cyan: #1fa6d9;
  --violet: #6c5ce7;
  --accent: #1a8fc4;          /* odkazy a text v akcentu – čitelné na světlé */
  --glow: rgba(56, 189, 248, .35);
  --topbar: rgba(240, 245, 252, .62);
  --icon-tile: linear-gradient(160deg, rgba(255,255,255,.85), rgba(225,234,246,.75));
  --shadow: 0 24px 60px rgba(30, 50, 90, .22);
  --logo-fill: #ffffff;
  --logo-stroke: #262a33;
  --wall: url("assets/bg-light.jpg");
  --wall-mobile: url("assets/bg-light-mobile.jpg");
  --wall-top: #f6f9fc;      /* barva horního okraje mobilní tapety */
  --wall-bottom: #bfc8d2;   /* barva dolního okraje mobilní tapety */

  --f-ui: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", Consolas, monospace;
  --topbar-h: 38px;
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1420;
  --fg: #e6edf8;
  --muted: #93a2bd;
  --glass: rgba(14, 22, 36, .5);
  --glass-bar: rgba(20, 30, 48, .45);
  --panel: rgba(255, 255, 255, .05);
  --line: rgba(140, 170, 220, .16);
  --cyan: #4cc9f0;
  --violet: #8f7cff;
  --accent: #5fd0f5;
  --glow: rgba(76, 201, 240, .35);
  --topbar: rgba(8, 13, 22, .6);
  --icon-tile: linear-gradient(160deg, rgba(40,55,85,.85), rgba(18,26,42,.85));
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --logo-fill: transparent;
  --logo-stroke: #d7e3f4;
  --wall: url("assets/bg-dark.jpg");
  --wall-mobile: url("assets/bg-dark-mobile.jpg");
  --wall-top: #020408;
  --wall-bottom: #010306;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg) var(--wall) center / cover no-repeat;
  color: var(--fg);
  font: 15px/1.55 var(--f-body);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color .3s;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button { font: inherit; color: inherit; }

/* Logo – výplň a obrys podle režimu */
.logo-mark { fill: var(--logo-fill); stroke: var(--logo-stroke); stroke-width: 26; overflow: visible; }

/* ---------- Horní lišta ---------- */
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  font-family: var(--f-ui); font-size: 13px; letter-spacing: .04em;
  position: relative; z-index: 1000; flex: none;
}
.topbar-left { display: flex; min-width: 0; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  border: 1px solid transparent; background: none; cursor: pointer;
  padding: 4px 10px 4px 8px; border-radius: 9px; font-family: var(--f-ui); font-weight: 700;
}
.theme-toggle:hover { background: var(--panel); border-color: var(--line); }
.theme-toggle:hover .mode-icon { color: var(--accent); }
.brand { white-space: nowrap; }
.mode-icon { display: grid; place-items: center; width: 18px; height: 18px; color: var(--muted); flex: none; }
.mode-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
:root[data-theme="dark"] .i-sun, :root[data-theme="light"] .i-moon { display: none; }
.clock { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* Přepínač jazyka – vlajky vpravo nahoře */
.topbar-right { display: flex; justify-content: flex-end; min-width: 0; }
.lang { display: flex; gap: 4px; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px;
  border: 1px solid transparent; background: none; cursor: pointer;
  font-family: var(--f-ui); font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); opacity: .65; transition: opacity .15s, background .15s;
}
.lang-btn svg { width: 22px; height: 15px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.lang-btn:hover { opacity: 1; background: var(--panel); }
.lang-btn[aria-pressed="true"] { opacity: 1; color: var(--fg); border-color: var(--line); background: var(--panel); }
.lang-btn[aria-pressed="true"] svg { box-shadow: 0 0 0 1.5px var(--cyan); }

/* ---------- Plocha ---------- */
.desktop { position: relative; flex: 1; min-height: 0; overflow: hidden; --side-w: calc(68px + env(safe-area-inset-left, 0px)); }

/* ---------- Ikony na ploše (vpravo, sloupce se přidávají zprava doleva) ---------- */
.icons {
  position: absolute; top: 18px; right: max(18px, env(safe-area-inset-right, 0px)); bottom: 18px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 100px);
  grid-auto-columns: 92px; gap: 6px; align-content: start; z-index: 1;
  direction: rtl;
}
.icons > * { direction: ltr; }
.icon {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border-radius: 10px; border: 1px solid transparent;
  background: none; cursor: pointer; text-decoration: none; color: var(--fg);
  font-family: var(--f-ui); font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2;
}
.icon:hover { background: var(--glass); border-color: var(--line); backdrop-filter: blur(10px); }
.icon-glyph {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center;
  background: var(--icon-tile); color: var(--accent);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.icon-glyph svg { width: 26px; height: 26px; }
.icon[data-kind="link"] .icon-glyph,
.side-item[data-kind="link"] {
  background: linear-gradient(140deg, var(--cyan), var(--violet)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 20px var(--glow);
}
.icon[data-kind="soon"] { color: var(--muted); }
.icon[data-kind="soon"] .icon-glyph { border-style: dashed; background: var(--glass); box-shadow: none; color: var(--muted); }
.icon-label {
  padding: 1px 6px; border-radius: 6px;
  background: var(--glass); backdrop-filter: blur(6px);
}
.icon-sep { display: none; }   /* oddělovač skupin – jen na mobilu */

/* ---------- Okna (matné sklo s modro-fialovým rámečkem) ---------- */
.windows { position: absolute; inset: 0 0 0 var(--side-w); pointer-events: none; z-index: 10; }
.win {
  position: absolute; pointer-events: auto;
  width: min(580px, calc(100% - 32px));
  max-height: calc(100% - 120px);
  display: flex; flex-direction: column;
  background: var(--glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  animation: win-in .18s ease-out;
}
/* Gradientní rámeček – cyan → fialová */
.win::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--cyan));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .45; transition: opacity .15s;
}
.win.is-active::before { opacity: 1; }
.win.is-active { box-shadow: var(--shadow), 0 0 40px -10px var(--glow); }
.win[hidden] { display: none; }
@keyframes win-in { from { opacity: 0; transform: scale(.97) translateY(6px); } }

.win-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line);
  background: var(--glass-bar); border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--f-ui); font-size: 13px; font-weight: 600; letter-spacing: .04em;
  cursor: grab; user-select: none; touch-action: none; flex: none;
}
.win.is-dragging .win-bar { cursor: grabbing; }
.win-bar > svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.win-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-btn {
  width: 28px; height: 24px; border-radius: 7px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.win-btn:hover { background: var(--panel); color: var(--fg); }
.win-btn.close:hover { background: linear-gradient(140deg, var(--cyan), var(--violet)); color: #fff; }
.win-back { display: none; }   /* tlačítko Zpět – jen na mobilu */
.win-body { padding: 22px 24px 24px; overflow: auto; min-height: 0; }

/* ---------- Obsah: O mně ---------- */
.about-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.avatar {
  width: 66px; height: 66px; border-radius: 18px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, rgba(76, 201, 240, .22), rgba(143, 124, 255, .22));
  border: 1px solid var(--line);
}
.avatar .logo-mark { width: 40px; height: 40px; stroke-width: 20; }
.about h1 { font-family: var(--f-ui); font-size: clamp(1.35rem, 3.5vw, 1.8rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.nick {
  background: linear-gradient(120deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.role { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.about p { margin: 0 0 10px; max-width: 62ch; }
.about h2 {
  font-family: var(--f-ui); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 20px 0 8px;
}
.proj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.proj-list li > a, .proj-list li.soon {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; color: var(--fg);
}
.proj-list li > a:hover { border-color: var(--cyan); }
.proj-list span { color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.proj-list li.soon { color: var(--muted); border-style: dashed; background: transparent; }
.about-actions { margin-top: 18px; display: flex; gap: 8px; }
.btn {
  border: 0; color: #fff; padding: 9px 18px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(140deg, var(--cyan), var(--violet));
  font-family: var(--f-ui); font-weight: 600; letter-spacing: .03em;
  box-shadow: 0 6px 18px var(--glow);
}
.btn:hover { filter: brightness(1.08); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--f-mono); font-size: 13px; }

/* ---------- Obsah: Kontakt ---------- */
.contact p { margin: 0 0 14px; }
.contact-list { margin: 0 0 14px; display: grid; gap: 8px; }
.contact-list > div {
  display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.contact-list dt { color: var(--muted); font-size: 13px; }
.contact-list dd { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.contact-list code { font-family: var(--f-mono); font-size: 13px; word-break: break-all; }
/* Kopírování – jen ikona (dva listy → po zkopírování fajfka) */
.copy {
  width: 28px; height: 28px; padding: 0; flex: none; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; border-radius: 7px;
  color: var(--muted); cursor: pointer;
}
.copy svg { width: 16px; height: 16px; }
.copy:hover { color: var(--accent); background: var(--panel); border-color: var(--line); }
.copy.is-done { color: var(--cyan); }
.contact-list a { color: var(--fg); text-decoration: none; }
.contact-list a:hover code, .contact-list a:hover .dc-name { color: var(--accent); }

/* Discord – kulatý avatar jako na Discordu, mezera, nick svisle na středu */
.discord { display: inline-flex; align-items: center; gap: 12px; min-height: 32px; }
.dc-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none;
  display: block; background: var(--panel);
}
.dc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.dc-name { font-weight: 600; line-height: 1; }
.soon-win p { margin: 0 0 12px; }
.soon-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.soon-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line);
}
.soon-list li::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--cyan), var(--violet));
}
.soon-list li.muted { background: transparent; border-style: dashed; }
.soon-list li.muted::before { background: var(--muted); opacity: .5; }


/* ---------- Boční pruh vlevo (matné sklo, ikony bez popisků) ---------- */
.sidebar {
  position: absolute; top: 0; left: 0; bottom: 0; z-index: 900;
  width: var(--side-w);
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--topbar);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  overflow-y: auto; overflow-x: visible;
}
.side-item {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 13px; border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer; text-decoration: none; color: var(--accent);
  background: var(--icon-tile);
  transition: transform .12s ease, box-shadow .12s ease;
}
.side-item:hover { transform: scale(1.08); }
.side-item svg { width: 22px; height: 22px; }
.side-item[data-kind="soon"] { border-style: dashed; background: transparent; color: var(--muted); }
/* Indikátor otevřeného okna – svislá čárka u levé hrany pruhu */
.side-item::before {
  content: ""; position: absolute; left: -9px; top: 50%; width: 4px; height: 0; margin-top: 0;
  border-radius: 4px; background: linear-gradient(var(--cyan), var(--violet));
  transition: height .15s ease, margin-top .15s ease;
}
.side-item.is-open::before { height: 18px; margin-top: -9px; box-shadow: 0 0 8px var(--glow); }
.side-item.is-open.is-min::before { height: 6px; margin-top: -3px; opacity: .7; }
.side-item.is-active { box-shadow: 0 0 0 2px var(--cyan), 0 6px 20px var(--glow); }
/* Oddělovač stálých částí a projektů – jemná čára v barvách webu */
.side-sep {
  width: 34px; height: 1px; flex: none; margin: 6px 0; border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent);
  opacity: .55;
}

/* Název jen při najetí myší – bublina vpravo od ikony (je mimo pruh, proto fixed) */
.side-tip {
  position: fixed; z-index: 2000; transform: translate(14px, -50%);
  background: var(--topbar); color: var(--fg); border: 1px solid var(--line); padding: 4px 10px; border-radius: 7px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-family: var(--f-ui); font-size: 12px; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
  pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.side-tip[hidden] { display: none; }

/* =====================================================================
   MOBIL – chová se jako telefon: domovská obrazovka, dok dole,
   okna jako karty přes celou obrazovku s tlačítkem Zpět.
   ===================================================================== */
@media (max-width: 720px) {
  /* Tapeta celá na šířku uprostřed plochy; nahoře a dole výplň barvou jejích okrajů,
     okraje obrázku se plynule rozplynou (žádný viditelný šev) */
  body {
    background: linear-gradient(var(--wall-top) 50%, var(--wall-bottom) 50%);
    background-color: var(--wall-top);
  }
  .desktop::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; z-index: 0;
    aspect-ratio: 1 / 1; transform: translateY(-50%); pointer-events: none;
    background: var(--wall-mobile) center / cover no-repeat;
    -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  }

  /* Horní lišta */
  .topbar { gap: 8px; padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
  .theme-toggle { padding: 4px 6px; gap: 6px; }
  .clock { font-size: 12px; }
  .lang { gap: 2px; }
  .lang-btn { padding: 5px 6px; }
  .lang-btn span { display: none; }

  /* Plocha bez levého pruhu; dole místo pro dok */
  .desktop {
    --side-w: 0px;
    --dock-space: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  /* Domovská obrazovka – mřížka 4 sloupců */
  .icons {
    top: 0; right: 0; bottom: var(--dock-space); left: 0;
    padding: 22px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
    direction: ltr; grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: none; grid-auto-columns: auto;
    gap: 18px 8px; overflow-y: auto;
  }
  .icon { padding: 4px 0; gap: 7px; font-size: 12px; min-width: 0; }
  .icon:hover { background: none; border-color: transparent; backdrop-filter: none; }
  .icon:active .icon-glyph { transform: scale(.92); }
  .icon-glyph { width: 60px; height: 60px; border-radius: 17px; transition: transform .1s; }
  .icon-glyph svg { width: 28px; height: 28px; }
  .icon-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-sep {
    display: block; grid-column: 1 / -1; height: 1px; margin: 2px 12px;
    background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent);
    opacity: .55;
  }

  /* Dok dole (stejné ikony jako pruh na desktopu) */
  .sidebar {
    top: auto; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: auto; max-width: calc(100% - 24px); height: auto;
    flex-direction: row; gap: 10px; padding: 9px 12px;
    border: 1px solid var(--line); border-radius: 22px;
    background: var(--glass); box-shadow: var(--shadow);
    overflow: visible;
  }
  .side-item { width: 48px; height: 48px; border-radius: 14px; }
  .side-item:hover { transform: none; }
  .side-item:active { transform: scale(.92); }
  .side-sep {
    width: 1px; height: 32px; margin: 0 2px;
    background: linear-gradient(180deg, transparent, var(--cyan), var(--violet), transparent);
  }
  /* Indikátor: tečka pod ikonou */
  .side-item::before,
  .side-item.is-open::before,
  .side-item.is-open.is-min::before {
    left: 50%; top: auto; bottom: -7px; width: 5px; height: 5px; margin: 0 0 0 -2.5px;
    border-radius: 50%; opacity: 0; transition: opacity .15s;
  }
  .side-item.is-open::before { opacity: 1; }
  .side-item.is-open.is-min::before { opacity: .45; }

  /* Okna jako karty přes celou obrazovku (nad dokem) */
  .windows { inset: 0 0 var(--dock-space) 0; }
  .win {
    left: 0 !important; top: 0 !important; width: 100% !important; height: 100%;
    max-height: none; border-radius: 0 0 20px 20px;
    animation: sheet-in .22s ease-out;
  }
  .win::before { border-radius: inherit; opacity: .35; }
  .win.is-active::before { opacity: .6; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }

  .win-bar {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px;
    padding: 6px max(8px, env(safe-area-inset-left, 0px)); min-height: 48px;
    cursor: default; border-radius: 0; touch-action: auto;
  }
  .win-bar > svg, .win-btn { display: none; }
  .win-title { grid-column: 2; text-align: center; font-size: 15px; }
  .win-back {
    grid-column: 1; justify-self: start;
    display: inline-flex; align-items: center; gap: 2px;
    min-height: 40px; padding: 0 10px 0 4px; border: 0; border-radius: 10px;
    background: none; color: var(--accent); cursor: pointer;
    font-family: var(--f-ui); font-size: 15px; font-weight: 600;
  }
  .win-back svg { width: 22px; height: 22px; }
  .win-back:active { background: var(--panel); }

  .win-body { padding: 20px max(18px, env(safe-area-inset-left, 0px)) 28px; font-size: 16px; line-height: 1.6; }
  .about-head { gap: 14px; }
  .avatar { width: 58px; height: 58px; }
  .contact-list > div { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
  .copy { width: 40px; height: 40px; }
  .copy svg { width: 18px; height: 18px; }
  .btn { min-height: 44px; padding: 0 22px; }
  .proj-list li > a, .proj-list li.soon, .soon-list li { min-height: 48px; align-items: center; }
}
@media (max-width: 360px) {
  .brand { display: none; }
}
@media (hover: none) { .side-tip { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .win { animation: none; }
  body, .side-item, .side-item::before, .win::before, .icon-glyph { transition: none; animation: none; }
}
