:root {
  --bg: #0a0a0a;
  --fg: #e6e6e6;
  --dim: #8a8a8a;
  --muted: #555;
  --hover: #161616;
  --rule: #1a1a1a;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #2a2a2a; }

/* menu (top-left dropdown) ----------------------------------- */

.menu-btn {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 20;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.menu-btn:hover { background: var(--hover); border-color: var(--dim); }
.menu-btn[aria-expanded="true"] { background: var(--hover); border-color: var(--dim); }

.menu-panel {
  position: fixed;
  top: 68px;
  left: 24px;
  z-index: 19;
  width: 280px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: #111;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.menu-panel[aria-hidden="false"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.menu-tree, .menu-sub {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* category header inside the menu */
.menu-cat {
  display: flex;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.1s ease;
}
.menu-cat:hover { background: var(--hover); }
.menu-cat .chev {
  color: var(--muted);
  margin-right: 8px;
  font-size: 10px;
  transition: transform 0.12s ease, color 0.12s ease;
  display: inline-block;
  width: 10px;
}
.menu-cat.open .chev {
  transform: rotate(90deg);
  color: var(--dim);
}

/* sub-list of items under a category */
.menu-sub {
  margin: 2px 0 6px 18px;
  padding-left: 8px;
  border-left: 1px solid var(--rule);
}
.menu-sub li { list-style: none; }

.menu-leaf {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  transition: background-color 0.1s ease;
}
a.menu-leaf:hover { background: var(--hover); }
.leaf-name { font-size: 13px; }
.leaf-desc { font-size: 11px; color: var(--dim); }

.menu-leaf.soon { opacity: 0.45; cursor: default; }
.menu-leaf.soon:hover { background: transparent; }
.menu-leaf.soon .leaf-desc::after {
  content: " · soon";
  color: var(--muted);
}


main {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 28px;
}

/* header ------------------------------------------------------ */

header { margin-bottom: 64px; }

h1 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0;
}
h1::before {
  content: "$ ";
  color: var(--dim);
}

.tag {
  margin: 4px 0 0 14px;
  color: var(--dim);
  font-size: 13px;
}

/* sections ---------------------------------------------------- */

section { margin-bottom: 48px; }

h2 {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 12px;
}

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

.list li,
.list .row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  transition: background-color 0.12s ease;
}

a.row:hover { background: var(--hover); }
a.row:hover .arrow { opacity: 1; transform: translateX(2px); }

.name { font-weight: 500; }
.desc { color: var(--dim); font-size: 13px; }
.arrow {
  color: var(--dim);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  font-size: 13px;
}

/* disabled / soon rows --------------------------------------- */

.row.soon { opacity: 0.4; cursor: default; }
.row.soon:hover { background: transparent; }
.row.soon .arrow { display: none; }
.row.soon .desc::after {
  content: " · soon";
  color: var(--muted);
}

/* status dot for services ------------------------------------ */

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--muted);
}
.dot.up { background: #4ade80; box-shadow: 0 0 6px #4ade8055; }

/* footer ------------------------------------------------------ */

footer {
  margin-top: 96px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--dim); }

/* ============================================================
   mobile — distinct iOS-native feel, not just a shrunk desktop
   - bigger base font (read at arm's length)
   - stacked rows, generous tap targets (>= 44px)
   - rounded "list group" cards like iOS Settings
   - notch-safe padding
   ============================================================ */

@media (max-width: 768px) {
  html, body { font-size: 16px; }

  main {
    max-width: 100%;
    padding:
      calc(72px + env(safe-area-inset-top))
      calc(20px + env(safe-area-inset-right))
      calc(48px + env(safe-area-inset-bottom))
      calc(20px + env(safe-area-inset-left));
  }

  /* keep menu clear of the notch / dynamic island */
  .menu-btn {
    top: calc(env(safe-area-inset-top) + 14px);
    left: calc(env(safe-area-inset-left) + 14px);
    width: 40px;
    height: 40px;
  }
  .menu-panel {
    top: calc(env(safe-area-inset-top) + 62px);
    left: calc(env(safe-area-inset-left) + 14px);
    width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: 320px;
    /* dvh = dynamic viewport height: shrinks when iOS URL bar is visible
       so the bottom items aren't trapped behind the bar. Falls back to
       100vh on older browsers via the prior declaration. */
    max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px);
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px);
    /* extra padding-bottom inside the scroll area so the last row clears
       the home-indicator inset and reads as "real estate, not edge" */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* lock body scroll while the menu is open so touch-drags inside the
     dropdown don't bubble out and scroll the page underneath */
  body.menu-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }
  /* sticky category headers: even with two categories expanded,
     the third stays reachable — its header pins to the top of the
     panel as you scroll past the previous category's items. */
  .menu-cat {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #111;
    padding: 10px 12px;
    font-size: 14px;
    /* hairline under the sticky header so it visually separates
       from the items it's overlaying when stuck */
    box-shadow: 0 1px 0 var(--rule);
  }
  .menu-leaf { padding: 9px 12px; }
  .leaf-name { font-size: 14px; }
  .leaf-desc { font-size: 12px; }

  header { margin-bottom: 40px; }
  h1 { font-size: 18px; }
  .tag { margin-left: 16px; font-size: 14px; }

  section { margin-bottom: 36px; }
  h2 {
    font-size: 12px;
    margin-bottom: 8px;
    padding: 0 4px;
  }

  /* iOS-style grouped list: rounded container, hairline separators */
  .list {
    background: #111;
    border-radius: 10px;
    overflow: hidden;
  }

  .list li,
  .list .row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 10px 14px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid #1d1d1d;
  }
  .list li:last-child,
  .list .row:last-child { border-bottom: none; }

  .name { font-size: 15px; }
  .desc { font-size: 13px; }
  .arrow { display: none; }

  /* tap feedback instead of hover */
  a.row:active { background: #1a1a1a; }

  /* soft fade for placeholder rows in mobile too */
  .row.soon { opacity: 0.45; }
  .row.soon .desc::after { content: " · soon"; }

  footer {
    margin-top: 56px;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
}
