/* Desk: the site dressed as a folder on a computer.
   IBM Plex was drawn for interfaces, which is what this pretends to be.
   Sans for anything you read, Mono for anything that is a filename or a date.
   Dark ground and one blue, taken from the selection color of a file manager. */

:root {
  --ground: #1c1d20;
  --side: #26272b;
  --text: #e6e6e6;
  --dim: #a2a6ae;    /* 6.1:1 on the sidebar, 6.9:1 on the ground */
  --sel: #2f5bd3;    /* selected file; white on it is 5.9:1 */
  --link: #8fa8ee;   /* underlines and focus rings, the selection blue lifted */
  --rule: #393a40;
  --hover: #303136;
  --sans: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --pad: clamp(1rem, 4vw, 3.5rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
}

::selection { background: var(--sel); color: #fff; }

a {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
a:hover { color: #fff; text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---- the sidebar ---- */

.side { background: var(--side); }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem .85rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}

/* The name is the window title, so it sits at text size on purpose. */
h1 { margin: 0; font: 600 1.0625rem/1.3 var(--sans); }
h1 a { text-decoration: none; }

.toggle { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.toggle-label {
  font: 500 .875rem/1.4 var(--mono);
  padding: .3rem .7rem;
  border: 1px solid var(--rule);
  cursor: pointer;
}
.toggle-label::after {
  content: "";
  display: inline-block;
  width: .32rem;
  height: .32rem;
  margin: 0 0 .2rem .55rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.toggle:checked ~ .side-head .toggle-label::after { transform: rotate(-135deg); margin-bottom: -.05rem; }
.toggle:focus-visible ~ .side-head .toggle-label { outline: 2px solid var(--link); outline-offset: 2px; }

.tree { font: 400 .875rem/1.5 var(--mono); padding: .5rem 0 1.5rem; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li li { --indent: 2.6rem; }
.tree li li li { --indent: 3.7rem; }

.tree a,
.tree summary {
  display: block;
  padding: .22rem 1rem .22rem var(--indent, 1.5rem);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree a:hover,
.tree summary:hover { background: var(--hover); }
.tree a:focus-visible,
.tree summary:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

.tree .ext { color: var(--ext, var(--dim)); }
.tree .view { color: var(--dim); font-family: var(--sans); }

.tree summary { position: relative; list-style: none; cursor: pointer; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before {
  content: "";
  position: absolute;
  left: calc(var(--indent, 1.5rem) - .9rem);
  top: .62rem;
  width: .3rem;
  height: .3rem;
  border: solid var(--dim);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
}
.tree details[open] > summary::before { transform: rotate(45deg); top: .55rem; }

/* The selected file. :has() reads the address; without it nothing is highlighted. */
body:not(:has(.pane:target)) .tree a[href="#readme"],
body:has(#readme:target) .tree a[href="#readme"],
body:has(#w-defaults:target) .tree a[href="#w-defaults"],
body:has(#w-fixing-the-lamp:target) .tree a[href="#w-fixing-the-lamp"],
body:has(#w-notifications-off:target) .tree a[href="#w-notifications-off"],
body:has(#w-paper-log:target) .tree a[href="#w-paper-log"],
body:has(#w-small-sites:target) .tree a[href="#w-small-sites"],
body:has(#p-receipt-printer:target) .tree a[href="#p-receipt-printer"],
body:has(#p-shelf:target) .tree a[href="#p-shelf"],
body:has(#p-soil-sensor:target) .tree a[href="#p-soil-sensor"],
body:has(#p-this-site:target) .tree a[href="#p-this-site"],
body:has(#p-walk-maps:target) .tree a[href="#p-walk-maps"],
body:has(#photos-2026:target) .tree a[href="#photos-2026"],
body:has(#ph-backboard:target) .tree a[href="#ph-backboard"],
body:has(#ph-bridge-underside:target) .tree a[href="#ph-bridge-underside"],
body:has(#ph-crates:target) .tree a[href="#ph-crates"],
body:has(#ph-fence-line:target) .tree a[href="#ph-fence-line"],
body:has(#ph-kitchen-window:target) .tree a[href="#ph-kitchen-window"],
body:has(#ph-low-tide:target) .tree a[href="#ph-low-tide"],
body:has(#ph-map-of-nowhere:target) .tree a[href="#ph-map-of-nowhere"],
body:has(#ph-moon-over-lot:target) .tree a[href="#ph-moon-over-lot"],
body:has(#ph-power-lines:target) .tree a[href="#ph-power-lines"],
body:has(#ph-ridge:target) .tree a[href="#ph-ridge"],
body:has(#ph-stairwell:target) .tree a[href="#ph-stairwell"],
body:has(#ph-water-tower:target) .tree a[href="#ph-water-tower"]
 {
  background: var(--sel);
  color: #fff;
  --ext: #e6e6e6;
}

/* ---- the main pane ---- */

main { min-width: 0; }

/* One file shows at a time. The address picks it; with no address, the README. */
.pane { display: none; }
.pane:target,
#readme { display: block; }
main:has(.pane:target) #readme:not(:target) { display: none; }

.path {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .15rem 1.5rem;
  padding: .7rem var(--pad);
  border-bottom: 1px solid var(--rule);
  font: 400 .8125rem/1.5 var(--mono);
  color: var(--dim);
}
.path b { color: var(--text); font-weight: 500; }

.body { padding: clamp(1.75rem, 5vw, 3.25rem) var(--pad) 4rem; }

h2 {
  margin: 0 0 1.25rem;
  max-width: 22ch;
  font: 500 clamp(1.75rem, 1.25rem + 2vw, 2.125rem)/1.15 var(--sans);
  letter-spacing: -.012em;
}

.doc p { max-width: 34rem; margin: 0 0 1em; }

h3 {
  margin: 2.75rem 0 0;
  font: 500 .8125rem/1.5 var(--mono);
  color: var(--dim);
}

.recent {
  list-style: none;
  max-width: 34rem;
  margin: .6rem 0 0;
  padding: 0;
  font: 400 .875rem/1.5 var(--mono);
  border-top: 1px solid var(--rule);
}
.recent li {
  display: grid;
  grid-template-columns: 10ch 1fr;
  gap: 1.25rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}
.recent time { color: var(--dim); font-variant-numeric: tabular-nums; }
.recent a { overflow-wrap: anywhere; }

.facts {
  display: flex;
  gap: .75rem;
  margin: -.4rem 0 1.5rem;
  font: 400 .8125rem/1.5 var(--mono);
}
.facts dt { color: var(--dim); }
.facts dd { margin: 0; }

/* ---- photos/2026: a contact sheet placed by hand, then one photo at a time ---- */

.wide > p { max-width: 34rem; margin: 0; color: var(--dim); }

.sheet {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: 1rem;
  row-gap: 1.75rem;
  align-items: start;
  max-width: 66rem;
  margin-top: 2.25rem;
}
.sheet figure { margin: 0; grid-column: 1 / span 3; }
.sheet figure:nth-child(even) { grid-column: 4 / span 3; margin-top: 2.5rem; }
.sheet a { display: block; }
.sheet img { display: block; width: 100%; height: auto; }
.sheet figcaption { margin-top: .4rem; font: 400 .8125rem/1.4 var(--mono); color: var(--dim); }

@media (min-width: 40rem) {
  .sheet { grid-template-columns: repeat(12, 1fr); column-gap: clamp(1rem, 2.5vw, 2rem); row-gap: 2.5rem; }
  .sheet figure:nth-child(1)  { grid-column: 1 / span 4; }
  .sheet figure:nth-child(2)  { grid-column: 6 / span 6; margin-top: 4rem; }
  .sheet figure:nth-child(3)  { grid-column: 2 / span 3; margin-top: 0; }
  .sheet figure:nth-child(4)  { grid-column: 6 / span 5; margin-top: 2rem; }
  .sheet figure:nth-child(5)  { grid-column: 1 / span 3; margin-top: 1rem; }
  .sheet figure:nth-child(6)  { grid-column: 5 / span 5; margin-top: 5rem; }
  .sheet figure:nth-child(7)  { grid-column: 2 / span 6; margin-top: 0; }
  .sheet figure:nth-child(8)  { grid-column: 9 / span 4; margin-top: 6rem; }
  .sheet figure:nth-child(9)  { grid-column: 1 / span 3; margin-top: 0; }
  .sheet figure:nth-child(10) { grid-column: 5 / span 7; margin-top: 3rem; }
  .sheet figure:nth-child(11) { grid-column: 3 / span 3; margin-top: 0; }
  .sheet figure:nth-child(12) { grid-column: 7 / span 5; margin-top: 2rem; }
}

.photo figure { margin: 0; padding: clamp(1rem, 3vw, 2.5rem) var(--pad) 3rem; }
.photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  max-height: calc(100dvh - 11rem);
  margin: 0 auto;
}
.photo figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .2rem 1.25rem;
  margin-top: .9rem;
  font: 400 .8125rem/1.5 var(--mono);
  color: var(--dim);
}
.photo .pn { display: flex; gap: 1.25rem; }
.photo h2 { margin: 0; max-width: none; font: 500 .8125rem/1.5 var(--mono); letter-spacing: 0; color: var(--text); }

/* ---- the status bar ---- */

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem 1.5rem;
  padding: .5rem var(--pad);
  background: var(--side);
  border-top: 1px solid var(--rule);
  font: 400 .8125rem/1.5 var(--mono);
  color: var(--dim);
}
.status .sample { font-family: var(--sans); }
.status .mail { margin-left: auto; }

/* ---- phones: the tree folds into a menu ---- */

@media (max-width: 47.99rem) {
  .tree { display: none; border-bottom: 1px solid var(--rule); }
  .toggle:checked ~ .tree { display: block; }
  .tree a, .tree summary { padding-top: .4rem; padding-bottom: .4rem; }
  .tree summary::before { top: .8rem; }
  .tree details[open] > summary::before { top: .72rem; }
  .status .mail { margin-left: 0; }
}

/* ---- wider screens: the app shell ---- */

@media (min-width: 48rem) {
  body {
    display: grid;
    grid-template: "side main" 1fr "side status" auto / 16rem 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .side { grid-area: side; overflow-y: auto; border-right: 1px solid var(--rule); }
  main { grid-area: main; overflow-y: auto; }
  .status { grid-area: status; padding-inline: 1.5rem; }
  .toggle, .toggle-label { display: none; }
}

@media (min-width: 64rem) {
  body { grid-template-columns: 18rem 1fr; }
}
