:root {
  --paper: #EDE4D3;
  --ink: #33281F;
  --sepia: #8B6F4E;
  --stamp-red: #A63D2F;
  --line: #C7B79C;
  --committed-green: #5C6B4F;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(51, 40, 31, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 65% 70%, rgba(51, 40, 31, 0.03) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  color: var(--ink);
}

h1, .eyebrow, legend, .photo-caption, .stamp-text, button[type="submit"] {
  font-family: var(--font-display);
}

a { color: var(--sepia); }

/* Hero: photo staged as a print beside its caption, not a banner with text on top */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
}

.photo-print {
  background: #fff;
  padding: 12px 12px 40px;
  box-shadow: 0 8px 24px rgba(51, 40, 31, 0.35), 0 2px 6px rgba(51, 40, 31, 0.2);
  transform: rotate(-2deg);
  max-width: 420px;
  width: 100%;
}

.photo-print img {
  display: block;
  width: 100%;
  filter: sepia(0.5) contrast(1.05);
}

.photo-caption {
  text-align: center;
  font-style: italic;
  margin: 0.6rem 0 0;
  color: var(--sepia);
}

.hero-text { flex: 1; min-width: 240px; }
.hero-text h1 { margin: 0.1rem 0 0.6rem; font-size: 2.4rem; }
.hero-text p { margin: 0.2rem 0; }

.eyebrow {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--sepia);
  margin: 0;
}

main { max-width: 640px; margin: 0 auto; padding: 1.5rem; }

.banner { padding: 0.75rem 1rem; border-radius: 2px; margin-bottom: 1rem; }
.banner-warning {
  background: #F4E0C2;
  border: 1px dashed var(--sepia);
  font-family: var(--font-display);
  font-style: italic;
}

/* Person-blocks as tilted index cards, not uniform stacked boxes */
fieldset { border: 1px solid var(--line); border-radius: 4px; margin-bottom: 1rem; padding: 1rem; }
fieldset.person-card {
  background: #fff;
  box-shadow: 2px 3px 8px rgba(51, 40, 31, 0.15);
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  transform: rotate(var(--card-tilt, 0deg));
}

label { display: block; margin: 0.5rem 0; }
label[hidden] { display: none; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; }

input[type="text"], input[type="email"], input[type="tel"], select {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: inherit;
  background: var(--paper);
}

button[type="submit"] {
  background: var(--stamp-red);
  color: var(--paper);
  border: 2px solid var(--ink);
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  border-radius: 2px;
  cursor: pointer;
}

.required-marker { color: var(--stamp-red); }

/* Signature element: a rubber-stamp confirmation instead of a flat message */
#confirmation { text-align: center; }

.stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border: 4px double var(--stamp-red);
  border-radius: 50%;
  color: var(--stamp-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(-8deg);
  margin: 2rem auto 1rem;
  animation: stamp-in 0.4s ease-out;
}

.stamp-text { font-size: 1.4rem; font-weight: 700; }
.stamp-date { font-size: 0.9rem; margin-top: 0.3rem; }

@keyframes stamp-in {
  from { transform: rotate(-8deg) scale(2.2); opacity: 0; }
  to { transform: rotate(-8deg) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; }
}

@media (max-width: 480px) {
  .hero-text h1 { font-size: 1.9rem; }
  .photo-print { max-width: 100%; }
}

.site-footer {
  max-width: 640px;
  margin: 2rem auto 0;
  padding: 1rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--sepia);
  border-top: 1px dashed var(--line);
}
.site-footer a { color: var(--stamp-red); }

/* Admin dashboard: restrained/functional treatment (tables, stat bars) —
   no card tilts or stamp motifs, reuses the same token palette as the public form. */
.stat-row { margin: 0.5rem 0; }
.stat-label { display: block; margin-bottom: 0.2rem; }
.stat-bar-track { background: var(--line); border-radius: 4px; height: 10px; }
.stat-bar-fill { background: var(--sepia); height: 100%; border-radius: 4px; }

table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.85rem; }
th, td { border: 1px solid var(--line); padding: 0.4rem; text-align: left; }

.family-tree, .family-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 1.25rem;
}
.family-tree { padding-left: 0; }
.family-tree li {
  border-left: 1px solid var(--line);
  padding: 0.4rem 0 0.4rem 1rem;
  position: relative;
}
.family-tree li:last-child { border-left-color: transparent; }
.family-tree li::before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 0;
  width: 0.75rem;
  height: 1px;
  background: var(--line);
}

.tree-node {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-family: var(--font-display);
}
.tree-node.committed { background: var(--committed-green); color: var(--paper); border-color: var(--committed-green); }

.plus-one {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  border: 1px dashed var(--line);
  color: var(--sepia);
}
.plus-one.committed { background: var(--committed-green); color: var(--paper); border-style: solid; border-color: var(--committed-green); }

.tree-child-name {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.8;
  padding: 0.2rem 0.5rem;
}
