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

:root {
  --bg: #fffff8;
  --fg: #1a1a1a;
  --fg-muted: #555;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #fffff8;
  --fg-muted: #aaa;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a;
    --fg: #fffff8;
    --fg-muted: #aaa;
  }
}

body {
  font-family: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
  background: var(--bg);
  color: var(--fg);
  max-width: 935px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1.1;
  text-align: center;
  white-space: pre;
}

.theme-toggle:hover {
  opacity: 0.7;
}

.theme-toggle .mobile {
  display: none;
}

.theme-toggle .desktop {
  display: block;
}

main {
  text-align: center;
}

.bio {
  text-align: left;
  margin: 2rem 0;
  line-height: 1.6;
}

.bio p {
  margin-bottom: 1rem;
}

.bio p:last-child {
  margin-bottom: 0;
}

/* App grid on homepage */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin: 2rem 0;
  text-align: left;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.app-card .app-icon {
  width: 128px;
  height: 128px;
  border-radius: 22.5%;
  margin-bottom: 1rem;
}

.app-card h2 {
  font-size: 1.5rem;
  font-weight: normal;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.app-card h2 a {
  font-variant: normal;
}

.app-card .app-description {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.app-card .app-link {
  font-size: 0.9rem;
}

/* Dark/light mode icon switching */
.app-icon-light { display: block; }
.app-icon-dark { display: none; }

[data-theme="dark"] .app-icon-light { display: none; }
[data-theme="dark"] .app-icon-dark { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app-icon-light { display: none; }
  :root:not([data-theme="light"]) .app-icon-dark { display: block; }
}

/* Product page icon */
.product-icon {
  width: 96px;
  height: 96px;
  border-radius: 22.5%;
  margin-bottom: 1rem;
}

pre.ascii {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.2;
  margin-bottom: 2rem;
  display: inline-block;
  text-align: left;
}

nav {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem;
}

nav a {
  margin-right: 1rem;
}

nav a:last-child {
  margin-right: 0;
}

a {
  color: var(--fg);
  text-decoration: none;
  font-variant: small-caps;
  white-space: nowrap;
}

a:hover {
  text-decoration: underline;
}

/* Product pages (like /bud/) */
.product {
  text-align: left;
}

.product h1 {
  font-size: 2.5rem;
  font-weight: normal;
  font-style: italic;
  margin-bottom: 1.5rem;
}

.product p {
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.product ul {
  list-style: none;
  line-height: 2;
  margin-bottom: 2rem;
}

.product .back {
  font-size: 0.95rem;
}

.product .coming-soon {
  color: var(--fg-muted);
  font-variant: small-caps;
}

/* Legal/document pages */
.document {
  text-align: left;
}

.document h1 {
  font-size: 2rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
}

.document .subtitle {
  font-size: 1rem;
  color: var(--fg-muted);
  margin-bottom: 2rem;
}

.document h2 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.document p {
  line-height: 1.7;
  margin-bottom: 1rem;
}

.document .nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--fg);
  opacity: 0.2;
}

.document .nav a {
  margin-right: 1.5rem;
}

footer {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

@media (max-width: 600px) {
  .app-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .app-card {
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  pre.ascii {
    font-size: 0.55rem;
  }

  body {
    font-size: 12pt;
    padding: 1rem;
  }

  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.2rem;
  }

  .theme-toggle .mobile {
    display: block;
  }

  .theme-toggle .desktop {
    display: none;
  }
}
