:root {
  --bg: #fbfbf9;
  --fg: #16150f;
  --muted: #6b6960;
  --line: #e2e0d8;
  --field: #ffffff;
  --accent: #c8553d;
  --ok: #3f7d5c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --fg: #f4f2ea;
    --muted: #a3a094;
    --line: #33312a;
    --field: #1e1d16;
    --accent: #e8836b;
    --ok: #7fb99a;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Inter, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 9vw, 6rem) 1.5rem 5rem;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 15vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-align: center;
  text-wrap: balance;
}

h1 .mark {
  color: var(--accent);
}

h2 {
  margin: 0 0 1.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

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

/* --- Visitor log form --- */

.log {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.field {
  margin-bottom: 1.125rem;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: inherit;
  font: inherit;
  transition: border-color 0.15s;
}

textarea {
  resize: vertical;
  min-height: 5rem;
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.hint {
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Honeypot field: off-screen rather than display:none, which bots skip. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button {
  padding: 0.6875rem 1.5rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

button:hover:not(:disabled) {
  opacity: 0.88;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

#status {
  margin: 0.875rem 0 0;
  min-height: 1.4rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

#status.success {
  color: var(--ok);
}

#status.error {
  color: var(--accent);
}

.view-link {
  margin: 2rem 0 0;
  font-size: 0.9375rem;
}

/* --- Visitor log table --- */

.log-page h1 {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  text-align: left;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.log-page {
  max-width: 52rem;
}

.subtitle {
  margin: 0 0 2.5rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

td.when {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

td.who {
  font-weight: 500;
  white-space: nowrap;
}

td.message {
  overflow-wrap: anywhere;
}

.empty,
.error-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

.back {
  margin-top: 2rem;
  font-size: 0.9375rem;
}
