:root {
  --bg: #111112;
  --text: #f2f2f2;
  --muted: #8f8f8f;
  --link: #7aa8ff;
  --border: #2c2c2e;
  --card-bg: rgba(10, 12, 15, 0.55);
  --card-border: rgba(255, 255, 255, 0.1);
  --tip-bg: #1c1d20;
  --max-width: 700px;
}

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --text: #1c1d1f;
  --muted: #63666b;
  --link: #1d5fd6;
  --border: #dcdde1;
  --card-bg: rgba(255, 255, 255, 0.6);
  --card-border: rgba(0, 0, 0, 0.08);
  --tip-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  margin: 0;
  transition: background 0.2s ease;
}

#wave-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: -1;
  display: block;
}

body {
  margin: 0;
  padding: calc(4rem + env(safe-area-inset-top)) 0 calc(4rem + env(safe-area-inset-bottom));
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--max-width);
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 1.5rem;
  margin-right: auto;
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.intro {
  margin-bottom: 2.5rem;
}

.tagline {
  color: var(--muted);
  margin: 0;
  max-width: 56ch;
}

section {
  margin-bottom: 2.25rem;
}

section:last-child {
  margin-bottom: 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  opacity: 0.8;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top));
  right: calc(1rem + env(safe-area-inset-right));
  z-index: 100;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.co-link {
  position: relative;
}

.co-link:hover {
  z-index: 10;
}

.tip {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(var(--tip-bg), var(--tip-bg));
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  padding: 3px 8px 3px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px) translateZ(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 50;
  will-change: opacity, transform;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.tip img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: block;
}

.co-link:hover .tip {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

.rows {
  margin: 0;
}

.row {
  display: grid;
  grid-template-columns: 135px 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.3rem 0;
}

.row dt {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}

.row dd {
  margin: 0;
}

.detail {
  color: var(--muted);
  font-size: 0.92em;
}

/* Tablet and small laptop: main no longer pinned to the left with a
   fixed offset, so it doesn't collide with the edge of the screen. */
@media (max-width: 900px) {
  main {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Phones: stack the date/label above its content instead of a
   cramped two-column grid, and give the card comfortable full-width
   margins. */
@media (max-width: 600px) {
  body {
    padding: calc(3.5rem + env(safe-area-inset-top)) 0 calc(3rem + env(safe-area-inset-bottom));
    font-size: 0.88rem;
  }

  main {
    margin-left: 1rem;
    margin-right: 1rem;
    padding: 1.25rem 1.25rem;
    border-radius: 10px;
  }

  h1 {
    font-size: 1.2rem;
  }

  .theme-toggle {
    top: calc(0.75rem + env(safe-area-inset-top));
    right: calc(0.75rem + env(safe-area-inset-right));
    width: 34px;
    height: 34px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding: 0.55rem 0;
  }

  .row dt {
    font-size: 0.78rem;
  }

  .row + .row {
    border-top: 1px solid var(--border);
  }
}
