/* ismargutic.se — homelab page styles
 *
 * Endast delar som är unika för homelab.html. Delad grund/komponenter
 * (layout, hero, shell, code-doc, footer …) ligger i css/base.css.
 *
 * Innehåll:
 *   1. Status-rad med utfällbar förklaring
 *   2. Tldr som git-log
 *   3. Stories + inline code-play
 *   4. Infra-split (proxmox/omv)
 *   5. Nätverkskarta
 *   6. Backup-simulator
 *   7. Docs ls-listning
 *   8. Plain-language-läge
 *   9. Mobil (homelab-element)
 */

/* ── 1. status-rad + utfällbar förklaring ── */
button.status-branch {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: var(--green);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

button.status-branch:hover,
.status-wrap--open button.status-branch {
  text-decoration-color: var(--green-soft);
}

.status-wrap {
  width: 100%;
  max-width: 40rem;
  margin-bottom: 3rem;
}

.status-wrap .status {
  margin-bottom: 0;
  flex-wrap: nowrap;
  gap: 0.4rem 0.65rem;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.status-wrap--open .status {
  width: 100%;
  border-radius: 0.5rem 0.5rem 0 0;
  border-bottom-color: transparent;
}

.status-panel {
  width: 100%;
}

.code-doc--panel {
  margin-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  border-top: none;
}

@media (prefers-reduced-motion: no-preference) {
  .status-panel:not([hidden]) {
    animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

.status-dot--warn {
  background: #d4a030;
  box-shadow: 0 0 10px rgba(212, 160, 48, 0.4);
}

/* ── 2. tldr timeline (git-log) ── */
.tldr {
  margin-bottom: 3.5rem;
}

.tldr-card {
  padding: 1.25rem 1.375rem 1.375rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(22, 128, 63, 0.06);
}

.tldr-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.tldr-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--green);
}

.tldr-meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--dim);
}

.tldr-today {
  margin-top: 1.375rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--border);
}

.tldr-today-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.35rem;
}

.tldr-today-body {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 40rem;
  margin: 0;
}

.git-log {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
}

.git-commit {
  display: grid;
  grid-template-columns: 1.25rem 4.5rem 1fr;
  gap: 0 0.5rem;
  align-items: baseline;
  margin-bottom: 0.125rem;
}

.git-commit--body {
  margin-bottom: 0.875rem;
}

.git-graph { color: var(--green); user-select: none; }
.git-hash { color: var(--amber); font-size: 0.6875rem; }
.git-subject { color: var(--text); font-weight: 500; }
.git-body {
  grid-column: 2 / -1;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  padding: 0.25rem 0 0 0.5rem;
  border-left: 1px solid var(--border);
  margin-left: 0.25rem;
}

.git-commit--past .git-graph,
.git-commit--past .git-hash { color: var(--dim); }

/* ── 3. stories + inline code-play ── */
.stories { display: grid; gap: 1rem; }

.story {
  position: relative;
  padding: 1.375rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-wrap: break-word;
  word-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.story .shell,
.story .code-play,
.story .backup-sim {
  max-width: 100%;
}

.story-tag {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.35rem;
}

.story h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.story-lead {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.55;
}

.story-body {
  color: var(--muted);
  font-size: 0.9375rem;
}

.story-body p + p { margin-top: 0.75rem; }

.story-note {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px dashed var(--border);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--dim);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.story--photo .story-tag { color: var(--amber); }
.story--net .story-tag { color: var(--green); }
.story--auto .story-tag { color: var(--rose); }
.story--backup .story-tag { color: #2a6494; }

.story-body code {
  font-family: var(--mono);
  font-size: 0.8125em;
  padding: 0.1em 0.35em;
  background: var(--surface-2);
  border-radius: 0.25rem;
}

.code-play {
  margin: 1rem 0 1.125rem;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--shell-border);
  box-shadow: 0 8px 24px rgba(10, 20, 14, 0.08);
  min-width: 0;
  max-width: 100%;
}

.code-play-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--shell-bar);
  border-bottom: 1px solid var(--shell-border);
  flex-wrap: nowrap;
  min-width: 0;
}

.code-play-bar > span:nth-child(-n+3) {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-play-bar > span:nth-child(1) { background: #e07070; }
.code-play-bar > span:nth-child(2) { background: #d4a030; }
.code-play-bar > span:nth-child(3) { background: #4caf78; }

.code-play-title {
  margin-left: 0.35rem;
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.625rem;
  color: #5f6b62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-play-body {
  background: var(--shell-bg);
  padding: 0.875rem 0.875rem 0.75rem;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-play-body pre {
  margin: 0 0 0.875rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.65;
  color: #8fa396;
  white-space: pre;
  width: max-content;
  max-width: none;
}

.code-play .kw { color: #c792ea; }
.code-play .fn { color: #82aaff; }
.code-play .ty { color: #ffcb6b; }
.code-play .num { color: #f78c6c; }
.code-play .cm { color: #4d5a52; }
.code-play .hl { color: var(--green-bright); font-weight: 500; }
.code-play .out { color: #ff5370; font-weight: 500; }

.code-play-slider {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: #6a7a70;
  padding-top: 0.625rem;
  border-top: 1px solid #252b27;
}

.code-play-slider input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--green-bright);
  cursor: pointer;
}

.code-play-hint {
  color: #4d5a52;
  font-size: 0.625rem;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .code-play-hint { display: none; }
}

/* ── 4. infra split (proxmox / omv) ── */
.infra-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (min-width: 560px) {
  .infra-grid { grid-template-columns: 1fr 1fr; }
}

.infra-card {
  padding: 1rem 1.125rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.infra-card h3 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--green);
  margin-bottom: 0.625rem;
  letter-spacing: 0.02em;
}

.infra-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.infra-card p + p { margin-top: 0.5rem; }

.infra-card ul {
  margin-top: 0.5rem;
  padding-left: 1.125rem;
  font-size: 0.8125rem;
  color: var(--dim);
}

.infra-card li + li { margin-top: 0.25rem; }

/* ── 5. nätverkskarta ── */
.net-map {
  position: relative;
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 1rem 0.5rem;
}

.net-hint {
  font-size: 0.625rem;
  color: var(--dim);
  margin-bottom: 1rem;
}

.net-tier {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.net-node {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--shell-border);
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  color: #8fa396;
  cursor: default;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.net-node--active {
  background: rgba(31, 191, 90, 0.15);
  border-color: rgba(31, 191, 90, 0.45);
  color: #b8f0cc;
}

.net-connector {
  text-align: center;
  color: #4d5a52;
  font-size: 0.6875rem;
  margin: 0.25rem 0;
}

.net-edge {
  display: block;
  height: 1px;
  background: #2a332d;
  margin: 0 auto 0.5rem;
  max-width: 60%;
  transition: background 0.15s;
}

.net-edge--active { background: var(--green-bright); box-shadow: 0 0 8px var(--green-glow); }

/* ── 6. backup-simulator ── */
.backup-sim {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.backup-sim-q {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--dim);
  margin-bottom: 0.625rem;
}

.backup-sim-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
}

.backup-sim-btns button {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.backup-sim-btns button:hover,
.backup-sim-btn--active {
  border-color: var(--green-soft);
  color: var(--green);
}

.backup-layers {
  display: grid;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.backup-layer {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.4rem 0.65rem;
  border: 1px dashed var(--border);
  border-radius: 0.25rem;
  color: var(--dim);
  transition: all 0.2s;
}

.backup-layer--active {
  border-style: solid;
  border-color: var(--green);
  background: rgba(31, 191, 90, 0.08);
  color: var(--green);
}

.backup-sim-result {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  min-height: 2.5rem;
}

/* ── 7. docs ls-listning ── */
.docs-ls .ls-row {
  display: block;
  line-height: 1.85;
}

.docs-ls .ls-row:hover { background: rgba(31, 191, 90, 0.06); margin: 0 -0.5rem; padding: 0 0.5rem; border-radius: 0.25rem; }

.docs-ls .perm { color: #5f8a72; }
.docs-ls .size { color: #5f6b62; display: inline-block; width: 3.5rem; }
.docs-ls .date { color: #5f6b62; }
.docs-ls .name { color: #e8f5ec; }
.docs-ls .name--dir { color: #5ecf8a; }
.docs-ls .desc { color: #6a7a70; font-size: 0.6875rem; display: block; padding-left: 12.5rem; margin-top: -0.15rem; margin-bottom: 0.35rem; }

@media (max-width: 520px) {
  .docs-ls .desc { padding-left: 0; }
  .git-commit { grid-template-columns: 1rem 3.5rem 1fr; }
}

/* ── 8. plain-language-läge ── */
.has-plain-fab .page {
  padding-bottom: 6rem;
}

.plain-toggle {
  position: fixed;
  z-index: 50;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: auto;
  max-width: min(20rem, calc(100vw - 2rem));
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
  box-shadow: 0 10px 32px rgba(10, 20, 14, 0.18);
  transition: color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.plain-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(10, 20, 14, 0.22);
}

.plain-toggle:active {
  transform: translateY(0);
}

.plain-toggle:hover,
.plain-toggle[aria-pressed="true"] {
  color: var(--green);
  border-color: var(--green-soft);
}

html.plain-swapping {
  scroll-behavior: auto !important;
}

.homelab-plain .code-play {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  box-shadow: none;
}

.homelab-plain .code-play-body {
  background: transparent;
  padding: 1rem;
}

.homelab-plain .code-play-slider {
  border-top: 1px dashed var(--border);
}

.icloud-simple {
  margin: 0 0 0.875rem;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.55;
}

.icloud-simple p { margin: 0; }

.icloud-simple-sum {
  margin-top: 0.5rem !important;
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: var(--muted);
}

.icloud-simple-sum strong {
  color: var(--green);
  font-weight: 600;
}

.plain-only { display: none; }

.homelab-plain .plain-only { display: block; }

.homelab-plain .tech-only { display: none !important; }

.homelab-plain .infra-card h3,
.homelab-plain .story-tag,
.homelab-plain .story-note,
.homelab-plain .tldr-tag {
  font-family: var(--sans);
  letter-spacing: normal;
  text-transform: none;
}

.homelab-plain .git-subject {
  font-family: var(--serif);
  font-weight: 500;
}

.homelab-plain .plain-net {
  margin: 1rem 0 1.5rem;
  padding: 0.875rem 1rem;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.55;
}

.homelab-plain .git-hash { display: none; }

.homelab-plain .git-commit {
  grid-template-columns: 1.25rem 1fr;
}

.homelab-plain .git-subject {
  grid-column: 2;
}

.homelab-plain .git-body {
  grid-column: 2;
  border-left: none;
  padding-left: 0;
  margin-left: 0;
}

/* ── 9. mobil (homelab-element) ── */
@media (max-width: 640px) {
  .status-wrap {
    width: 100%;
  }

  .status-panel,
  .code-doc--panel {
    width: 100%;
  }

  .net-map {
    padding: 0.75rem 0.25rem;
  }

  .net-node {
    font-size: 0.625rem;
    padding: 0.3rem 0.5rem;
  }

  .stories {
    gap: 1.125rem;
  }

  .story {
    padding: 1rem 0.875rem;
  }

  .story h3 {
    font-size: 1.125rem;
    line-height: 1.3;
    hyphens: auto;
    -webkit-hyphens: auto;
  }

  .story-lead,
  .story-body {
    font-size: 0.875rem;
    line-height: 1.6;
  }

  .story-note {
    font-size: 0.625rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
  }

  .story .shell--spaced {
    margin-top: 1rem;
  }

  .story .shell-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.875rem 0.75rem;
  }

  .story .shell-body pre {
    font-size: 0.625rem;
    line-height: 1.6;
  }

  .code-play {
    margin: 0.875rem 0 1rem;
  }

  .code-play-body {
    padding: 0.75rem;
    overflow-x: hidden;
  }

  .code-play-body pre {
    font-size: 0.625rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    width: auto;
    max-width: 100%;
  }

  .code-play-slider {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .code-play-slider input[type="range"] {
    flex: 1 1 100%;
    width: 100%;
    min-height: 1.75rem;
    order: 2;
  }

  .code-play-slider span:first-child {
    order: 1;
  }

  .code-play-hint {
    order: 3;
    flex: 1 1 100%;
    white-space: normal;
  }

  .backup-sim {
    padding: 0.875rem;
    margin: 0.875rem 0 1rem;
  }

  .backup-sim-btns {
    flex-direction: column;
    gap: 0.5rem;
  }

  .backup-sim-btns button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem;
    font-size: 0.75rem;
  }

  .backup-sim-result {
    font-size: 0.8125rem;
  }

  .backup-layer {
    font-size: 0.625rem;
    padding: 0.5rem 0.65rem;
  }

  .plain-toggle {
    right: max(0.75rem, env(safe-area-inset-right));
    left: max(0.75rem, env(safe-area-inset-left));
    max-width: none;
    font-size: 0.625rem;
    padding: 0.6rem 0.875rem;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .status-panel:not([hidden]) {
    animation: none;
  }
}
