@import url('../tokens.css');

/* Root's language: monochrome, hairlines; the subpage layout as in usage/usage.css. */

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

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

body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 0.5px; }

/* The root page's focus ring. */
:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* The root page's layout (style.css .site-wrapper / .site-sidebar), the part a subpage
   needs: from 900px a sticky sidebar beside the column, with root's fluid gutters;
   below, the sidebar stacks on top, short: a small portrait beside name and page. */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 var(--space-lg);
}

.site-sidebar {
  padding: var(--space-lg) 0 var(--space-md);
  border-bottom: 1px solid var(--border-hairline);
}

.sidebar-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-md);
}

.sidebar-portrait-link { grid-row: 1 / 3; }

.sidebar-portrait {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--bg-subtle);
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.site-title a { text-decoration: none; }
.site-title a:hover { text-decoration: underline; }

/* The page's kicker, in root's subtitle handwriting. */
.site-subtitle {
  font-family: var(--font-hand);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sidebar-back {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-back:hover { text-decoration: underline; }

.sidebar-meta {
  margin-top: var(--space-xs);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.sidebar-meta:empty { display: none; }

.site-main {
  flex-grow: 1;
  min-width: 0;
  max-width: var(--content-max-width);
  padding: var(--space-lg) 0 var(--space-3xl);
}

@media (min-width: 900px) {
  .site-wrapper {
    --gutter: clamp(36px, 12.791vw - 79.12px, 80px);
    --side-gutter: clamp(24px, 3.4884vw - 7.395px, 36px);
    flex-direction: row;
    max-width: 1244px;
    padding: 0 var(--gutter) 0 var(--side-gutter);
    gap: var(--gutter);
  }
  .site-sidebar {
    width: clamp(240px, 11.628vw + 135.35px, var(--sidebar-width));
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    border-bottom: none;
    border-right: 1px solid var(--border-hairline);
    padding: var(--space-2xl) var(--side-gutter) var(--space-lg) 0;
  }
  .sidebar-header { display: block; }
  .sidebar-portrait { width: 9rem; height: 9rem; margin-bottom: var(--space-md); }
  .site-title { font-size: 1.65rem; margin-bottom: var(--space-xs); }
  .sidebar-back { margin: var(--space-lg) 0 var(--space-md); }
  .sidebar-meta { margin-top: var(--space-sm); }
  .site-main { padding: var(--space-2xl) 0 var(--space-lg); }
}

.lead { font-size: 1.05rem; letter-spacing: -0.01em; }

.note, .status { font-size: 0.8rem; color: var(--text-muted); }
.status.error { color: var(--text-primary); }

p + p, p + ol { margin-top: var(--space-sm); }
ol { padding-left: 1.25rem; }
li + li { margin-top: var(--space-xs); }

/* Sections: spacing only, a small uppercase label. */
.block { margin-top: var(--space-2xl); }

.block-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

kbd, code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  padding: 0 4px;
}

/* The one thing to drag: ink on paper, the page's strongest mark. */
.install { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); margin: var(--space-md) 0; }

.bookmarklet {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 4px;
  background: var(--text-primary);
  color: var(--bg-app);
  font-weight: 700;
  text-decoration: none;
  cursor: grab;
}

.bookmarklet[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.more {
  font: inherit;
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--border-medium);
  padding: 2px 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.more:hover { background: var(--bg-hover); }
.more:disabled { opacity: 0.4; cursor: default; }

.try {
  padding: var(--space-lg);
  border: 1px dashed var(--border-medium);
  border-radius: 4px;
}

.try p { margin-top: var(--space-md); }
