/* vysny.me: an outline page with a terminal accent. Areas are directories, entries are leaves. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --fg: #1d1d1b;
  --muted: #64625c;
  --line: #c9c6bd;
  --line-soft: #e6e3db;
  --accent: #0b6e53;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Source Code Pro", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131412;
    --fg: #e6e4dd;
    --muted: #9b998f;
    --line: #4a4a44;
    --line-soft: #2a2b27;
    --accent: #5fd3a5;
  }
}

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--fg); }

body {
  margin: 0 auto;
  max-width: 50rem;
  padding: 3rem 1.25rem 4rem;
  font: 1rem/1.6 var(--sans);
}

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Header */

header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2.5rem; }

.avatar { width: 6rem; height: 6rem; border-radius: 50%; flex: none; }

h1 { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -.01em; }

.motto { margin: .15rem 0 .6rem; font-family: var(--mono); font-size: .9rem; color: var(--accent); }

.intro { margin: 0 0 .6rem; }

.links { font-family: var(--mono); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; }

@media (max-width: 34rem) {
  header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* The working directory line above the tree */

.cwd {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: .9rem; color: var(--muted);
  padding-bottom: .4rem;
}

.cwd button {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
}
.cwd button:hover { text-decoration: underline; }

/* Disclosure */

summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "▶";
  display: inline-block;
  width: 1.6em;
  font-size: .65em;
  text-align: center;
  vertical-align: .12em;
  color: var(--accent);
  transition: transform .15s ease;
}
details[open] > summary::before { transform: rotate(90deg); }

@media (prefers-reduced-motion: reduce) {
  summary::before { transition: none; }
}

/* Areas: the first level */

.area { border-top: 1px solid var(--line-soft); }
.area:last-of-type { border-bottom: 1px solid var(--line-soft); }

.area > summary {
  display: grid; grid-template-columns: 1.1rem 10rem 1fr auto; align-items: baseline;
  column-gap: .6rem;
  padding: .6rem .15rem;
}
.area > summary:hover .area-name { color: var(--accent); }

.area-name { font-family: var(--mono); font-weight: 600; }
.gist { color: var(--muted); }
.count { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

.area > .tree { margin: 0 0 1rem .55rem; }

@media (max-width: 34rem) {
  .area > summary { grid-template-columns: 1.1rem 1fr auto; }
  .count { grid-row: 1; grid-column: 3; }
  .gist { grid-row: 2; grid-column: 2 / -1; }
  .tree > li { padding-left: 1.2rem; }
  .tree > li::after { width: .8rem; }
}

/* Groups: the second level */

.group > details > summary { font-family: var(--mono); font-size: .95rem; }
.group > details > summary:hover { color: var(--accent); }

/* The tree: lines drawn like `tree` output, so wrapped entries keep their branch */

.tree { list-style: none; margin: 0; padding: 0 0 0 .55rem; }

.tree > li { position: relative; padding: .1rem 0 .1rem 1.5rem; }

.tree > li::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}
.tree > li:last-child::before { bottom: auto; height: calc(.1rem + .8em); }

.tree > li::after {
  content: ""; position: absolute; left: 0; top: calc(.1rem + .8em);
  width: 1.05rem; border-top: 1px solid var(--line);
}

/* Entries: the leaves */

.tree > li > a { text-decoration: none; }
.tree > li > a:hover { text-decoration: underline; }
.tree > li > a:first-child, .tree > li > .name { font-weight: 600; }
.posts > li > a:first-child { font-weight: normal; }
.tree > li > a.more { font-weight: normal; font-style: italic; }
.what { color: var(--muted); }
.meta {
  font-family: var(--mono); font-size: .8rem; color: var(--muted);
  white-space: nowrap; margin-left: .25rem;
}

/* Footer */

footer { margin-top: 2.5rem; font-size: .85rem; color: var(--muted); }
footer p { margin: .3rem 0; }
