:root {
  color-scheme: light;
  --background: #fafafa;
  --text: #1f2328;
  --muted: #667085;
  --rule: #d8dee4;
  --link: #2f4f9f;
  --link-hover: #12307d;
  --max-width: 820px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--text);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.36;
}

body {
  margin: 0;
}

.page {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.4rem;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
}

h1,
h2,
p,
ul {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.2rem;
  font-size: 1.75rem;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0.55rem;
  font-size: 1.05rem;
  line-height: 1.3;
}

p {
  margin-bottom: 0.5rem;
}

section {
  margin-bottom: 0.78rem;
}

nav {
  color: var(--muted);
  font-size: 0.94rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
}

.profile-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
}

ul {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.2rem;
}

li > span:first-child,
li > a:first-child {
  font-weight: 650;
}

li > span + span,
li > a + span {
  color: var(--muted);
}

footer {
  margin-top: 0.9rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}

footer p {
  margin-bottom: 0;
}

body.edit-mode {
  display: grid;
  grid-template-columns: minmax(360px, 44vw) minmax(0, 1fr);
  align-items: start;
  height: 100vh;
  overflow: hidden;
}

body.edit-mode .page {
  width: min(var(--max-width), calc(100% - 2rem));
  height: 100vh;
  margin: 0 auto;
  overflow: auto;
  padding: 1.25rem 0 1.5rem;
}

.edit-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem;
  border-right: 1px solid var(--rule);
  background: #ffffff;
  color: var(--text);
  overflow: auto;
}

.edit-panel h2 {
  margin: 0 0 0.75rem;
}

.edit-markdown {
  width: 100%;
  min-height: calc(100vh - 7.5rem);
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font:
    0.9rem / 1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  padding: 0.85rem;
  resize: vertical;
}

.edit-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.edit-controls button {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--text);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
}

@media (max-width: 520px) {
  html {
    font-size: 14px;
    line-height: 1.32;
  }

  .page {
    width: min(var(--max-width), calc(100% - 1.5rem));
    padding-top: 1rem;
  }

  .header {
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .profile-mark {
    width: 48px;
    height: 48px;
  }

  h1 {
    font-size: 1.65rem;
  }

  h2 {
    margin-bottom: 0.35rem;
  }

  p {
    margin-bottom: 0.4rem;
  }

  section {
    margin-bottom: 0.65rem;
  }

  ul {
    padding-left: 1rem;
  }

  li {
    margin-bottom: 0.12rem;
  }
}

@media (max-width: 900px) {
  body.edit-mode {
    display: block;
    height: auto;
    overflow: auto;
  }

  body.edit-mode .page {
    height: auto;
    overflow: visible;
  }

  .edit-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .edit-markdown {
    min-height: 48vh;
  }
}
