:root {
  --page-bg: #c4b8a8;
  --bg: #f3ede1;
  --text: #221d18;
  --muted: #6b6058;
  --accent: #b04a2c;
  --serif: "Iowan Old Style", "Charter", "Palatino", "Georgia", ui-serif, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0a0906;
    --bg: #1a1612;
    --text: #ece4d7;
    --muted: #a39788;
    --accent: #a8c2a6;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
}

main {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  min-height: 100vh;
}

@media (min-width: 600px) {
  main {
    padding: 3rem 2rem;
    align-items: center;
  }
}

.card {
  background: var(--bg);
  border-radius: 24px;
  max-width: 640px;
  width: 100%;
  padding: 2.5rem 1.75rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  margin: auto 0;
}

@media (min-width: 600px) {
  .card {
    padding: 3rem 3rem;
    border-radius: 32px;
  }
}

.photo {
  display: block;
  width: 120px;
  height: auto;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  object-fit: cover;
  margin: 0 auto 1.75rem;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 0.75rem;
  letter-spacing: -0.005em;
  text-align: center;
}

h1 em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
}

.meta {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.75rem;
}

.descriptors {
  text-align: center;
  margin: 0 0 2.25rem;
  font-size: 1rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--muted);
  opacity: 0.7;
}

.descriptors em {
  font-style: italic;
}

p {
  margin: 0 0 1.4rem;
}

p em {
  font-style: italic;
}

.contact {
  margin-top: 2rem;
  font-size: 1rem;
}

.contact a {
  color: var(--text);
}

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

a:hover {
  text-decoration-thickness: 2px;
}

h2 {
  font-family: var(--serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3rem 0 1.5rem;
}

ul.projects {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

ul.projects li {
  padding: 0.25rem 0;
  font-size: 1rem;
}

ul.projects li::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--muted);
}

dl.lately {
  margin: 0 0 2rem;
}

dl.lately dt {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-top: 1.25rem;
}

dl.lately dt:first-of-type {
  margin-top: 0;
}

dl.lately dd {
  margin: 0.25rem 0 0;
  padding: 0;
}

/* Churn Tracker */
.churn-back {
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}

.churn-back a {
  color: var(--muted);
  text-decoration: none;
}

.churn-back a:hover {
  color: var(--text);
}

.churn-page-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: left;
  margin: 0 0 0.5rem;
}

.churn-summary {
  font-size: 0.88rem;
  color: var(--muted);
  margin: -0.75rem 0 1rem;
}

.churn-list-wrap {
  position: relative;
  margin-bottom: 2rem;
}

.churn-list-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
  border-radius: 0 0 8px 8px;
}

.churn-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 6px;
}

.churn-list::-webkit-scrollbar {
  width: 6px;
}

.churn-list::-webkit-scrollbar-track {
  background: rgba(107, 96, 88, 0.1);
  border-radius: 3px;
}

.churn-list::-webkit-scrollbar-thumb {
  background: rgba(107, 96, 88, 0.45);
  border-radius: 3px;
}

.churn-list::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 96, 88, 0.7);
}

.churn-card {
  border: 1px solid rgba(107, 96, 88, 0.2);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.1s;
}

.churn-card:hover {
  background: rgba(107, 96, 88, 0.05);
}

.churn-card-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  line-height: 1.3;
}

.churn-card-fields {
  display: flex;
  flex-wrap: nowrap;
  gap: 0 1.25rem;
  overflow: hidden;
  align-items: flex-start;
}

.churn-card-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
}

.churn-card-field-grow {
  flex: 1;
  min-width: 0;
}

.churn-card-field-link {
  max-width: 90px;
  min-width: 0;
}

.churn-card-field-grow .churn-field-value,
.churn-card-field-link .churn-field-value {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.churn-bonus {
  font-weight: 600;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.12em 0.45em;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-p1 {
  background: rgba(176, 74, 44, 0.12);
  color: var(--accent);
}

.badge-p2 {
  background: rgba(107, 96, 88, 0.15);
  color: var(--muted);
}

.badge-type-bank {
  background: rgba(70, 130, 70, 0.12);
  color: #3d7a3d;
}

.badge-type-cc {
  background: rgba(60, 100, 170, 0.12);
  color: #3a62a8;
}

@media (prefers-color-scheme: dark) {
  .badge-type-bank {
    background: rgba(100, 180, 100, 0.15);
    color: #7abf7a;
  }
  .badge-type-cc {
    background: rgba(100, 150, 230, 0.15);
    color: #7aaae0;
  }
}

.churn-field-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.churn-field-value {
  color: var(--text);
  line-height: 1.3;
}

.churn-empty {
  color: var(--muted);
  opacity: 0.5;
}

/* Churn modal */
.churn-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.churn-modal[hidden] { display: none; }

.churn-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.churn-modal-content {
  position: relative;
  background: var(--bg);
  border-radius: 20px;
  padding: 1.75rem;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
}

.churn-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-family: var(--serif);
}

.churn-modal-close:hover { color: var(--text); }

.churn-modal-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 2rem 1.25rem 0;
  line-height: 1.3;
}

.churn-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.churn-modal-field {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.5rem;
  font-size: 0.84rem;
  align-items: baseline;
}

@media (max-width: 599px) {
  .churn-list {
    padding-right: 0;
  }

  .churn-card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1rem;
  }

  /* Notes and Link are almost always empty; modal shows everything */
  .churn-card-field-grow,
  .churn-card-field-link {
    display: none;
  }

  .churn-modal-content {
    border-radius: 14px;
    padding: 1.35rem 1.25rem;
  }
}
