:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6862;
  --line: #e6e3dc;
  --accent: #2f5d50;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark colors: used when the toggle picks dark (js/theme.js sets data-theme), or
   when the system is dark and nothing has been picked. Keep both blocks in sync. */
:root[data-theme="dark"] {
  --bg: #161615;
  --surface: #1d1d1b;
  --text: #ecebe7;
  --muted: #9b9890;
  --line: #2d2c29;
  --accent: #8fbfae;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615;
    --surface: #1d1d1b;
    --text: #ecebe7;
    --muted: #9b9890;
    --line: #2d2c29;
    --accent: #8fbfae;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
}

/* Intro */

.intro {
  padding-top: 72px;
  padding-bottom: 48px;
}

.intro h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.5rem;
  line-height: 1.15;
  margin: 0 0 12px;
}

.intro p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 34em;
  margin: 0;
}

/* Sections */

section + section {
  margin-top: 56px;
}

.section-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.section-head h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

/* Tool list */

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

.tool {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.tool-name {
  font-weight: 500;
}

.tool-desc {
  color: var(--muted);
}

.tool-status {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* A finished tool: wrap the row contents in <a class="tool-link" href="tools/name/">. */
.tool-link {
  display: contents;
  text-decoration: none;
}

.tool-link:hover .tool-name {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* About */

.about p {
  color: var(--muted);
  margin: 16px 0 0;
}

/* Footer */

.site-footer {
  margin-top: 96px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .intro {
    padding-top: 48px;
  }

  .intro h1 {
    font-size: 2rem;
  }

  .tool {
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
  }

  .tool-desc {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Account */

.extra-links {
  display: contents;
}

.extra-links a,
.link-button {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.extra-links a:hover,
.link-button:hover {
  color: var(--text);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.account {
  display: inline-flex;
  gap: 12px;
  align-items: baseline;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.account-name {
  font-size: 0.95rem;
  font-weight: 500;
}

[hidden] {
  display: none !important;
}

/* Theme toggle: shows the moon in light mode and the sun in dark mode. */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

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

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


.auth-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.auth-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.auth-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 10px;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.auth-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.auth-error {
  min-height: 1.2em;
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #b3412e;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.button-primary,
.button-secondary {
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.button-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--surface);
}

.button-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.button-secondary {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
}

@media (max-width: 600px) {
  .site-nav {
    gap: 14px;
  }

  .site-nav > a[href^="#"] {
    display: none;
  }
}
