/* === TRA Components === */

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-align: center;
}
.btn-primary {
  background: var(--gold);
  color: #2c1810;
}
.btn-primary:hover { background: var(--gold-light); text-decoration: none; }
.btn-secondary {
  background: var(--navy);
  color: white;
}
.btn-secondary:hover { background: #243c8a; text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}
.btn-outline:hover { background: var(--navy); color: white; text-decoration: none; }

/* Campaign Progress Bar */
.campaign-bar {
  background: var(--parchment-dark);
  border-radius: 8px;
  overflow: hidden;
  height: 24px;
  position: relative;
  margin: 1rem 0;
}
.campaign-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--water), var(--navy));
  border-radius: 8px;
  transition: width 1.5s ease-out;
  position: relative;
}
.campaign-bar-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
}
.campaign-stats {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Impact Counter */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.impact-item {
  text-align: center;
  padding: 1rem;
}
.impact-number {
  font-family: var(--font-gemara);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-accent);
  display: block;
}
.impact-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Project Card */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.project-card {
  background: white;
  border: 1px solid var(--parchment-shadow);
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.project-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.project-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--parchment-dark);
}
.project-card-body {
  padding: 1rem;
}
.project-card-title {
  font-family: var(--font-gemara);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.project-card-location {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.project-card-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-ready { background: #d4edda; color: #155724; }
.status-building { background: #fff3cd; color: #856404; }
.status-planned { background: #d1ecf1; color: #0c5460; }
.status-hold { background: #f8d7da; color: #721c24; }

.project-card-families {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Water Divider */
.water-divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}
.water-divider::before {
  content: '\301C\301C\301C';
  color: var(--water);
  opacity: 0.4;
  font-size: 1.2rem;
  letter-spacing: 0.5em;
}

/* Donation Amount Selector */
.amount-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}
.amount-btn {
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  background: var(--parchment-light);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-gemara);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-accent);
  transition: all 0.2s;
}
.amount-btn:hover, .amount-btn.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #2c1810;
}
.amount-btn small {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Contact/Donation Form */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--parchment-shadow);
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  background: white;
  color: var(--text-primary);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(26,42,108,0.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* Trust Badge */
.trust-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
  flex-wrap: wrap;
}
.trust-item {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.trust-item strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* === Illuminated Daf Image System === */
.figure { margin: 1.2rem 0; break-inside: avoid; }
.figure img { width: 100%; height: auto; display: block; }

.tra-image {
  background: #f0e6d0;
  border: 2px solid rgba(139,69,19,0.85);
  border-radius: 3px;
  padding: 4px;
  box-shadow: inset 0 0 8px rgba(58,42,26,0.15), 2px 2px 6px rgba(58,42,26,0.25);
  overflow: hidden;
}
.tra-image img {
  border-radius: 2px;
  filter: sepia(10%) saturate(90%) brightness(98%);
  transition: filter 0.4s ease;
}
.tra-image img:hover { filter: sepia(0%) saturate(100%) brightness(100%); }

.tra-image--ornate { position: relative; }
.tra-image--ornate::before,
.tra-image--ornate::after {
  content: "\2767";
  position: absolute;
  font-size: 1rem;
  color: rgba(218,165,32,0.85);
  z-index: 2;
  pointer-events: none;
}
.tra-image--ornate::before { top: 6px; left: 8px; }
.tra-image--ornate::after { bottom: 6px; right: 8px; transform: rotate(180deg); }

.tra-caption {
  font-family: var(--font-gemara);
  font-size: 0.8rem;
  color: #5a4a3a;
  text-align: center;
  padding: 6px 8px 2px;
  font-style: italic;
  border-top: 1px solid rgba(139,69,19,0.2);
  margin-top: 4px;
}

.figure--hero { max-width: 980px; margin: 1.5rem auto; }
.figure--plate { max-width: 760px; margin: 1.2rem auto; }
.figure--inline { max-width: 600px; margin: 1rem auto; }
.figure--marginal { max-width: 100%; margin: 0.6rem 0; }

.tra-hero-plate {
  position: relative;
  border: 3px double #8b4513;
  border-radius: 4px;
  padding: 6px;
  background: #f0e6d0;
  box-shadow: inset 0 0 12px rgba(58,42,26,0.1), 0 4px 16px rgba(58,42,26,0.2);
}
.tra-hero-plate img {
  border-radius: 2px;
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(8%) saturate(92%);
}
.tra-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.5rem;
  background: linear-gradient(transparent, rgba(58,42,26,0.7) 40%, rgba(58,42,26,0.85));
  color: #f8f0e0;
}
.tra-hero-overlay h2 { color: #daa520; margin-bottom: 0.3rem; font-size: 1.6rem; }
.tra-hero-overlay p { font-size: 0.95rem; margin: 0; }

.tra-divider {
  width: 100%; max-width: 500px; height: auto;
  margin: 1.5rem auto; display: block; opacity: 0.55;
}

.status-badge {
  display: inline-block; font-size: 0.65rem; padding: 2px 8px;
  border-radius: 2px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-badge--completed { background: rgba(46,139,154,0.15); color: #2e8b9a; border: 1px solid #2e8b9a; }
.status-badge--near { background: rgba(218,165,32,0.15); color: #8b6914; border: 1px solid #daa520; }
.status-badge--construction { background: rgba(139,69,19,0.12); color: #8b4513; border: 1px solid #8b4513; }
.status-badge--planning { background: rgba(58,42,26,0.08); color: #5a4a3a; border: 1px solid #5a4a3a; }

img[loading="lazy"] { opacity: 0; transition: opacity 0.5s ease; }
img[loading="lazy"].loaded { opacity: 1; }

.marginal-stack { display: grid; gap: 0.8rem; }

@media (max-width:720px) {
  .tra-image--ornate::before, .tra-image--ornate::after { display: none; }
  .figure--hero, .figure--plate, .figure--inline { max-width: 100%; margin: 0.8rem 0; }
  .tra-hero-overlay { padding: 1rem; }
  .tra-hero-overlay h2 { font-size: 1.2rem; }
}

/* Page-flip Animation */
.daf-page {
  animation: dafEnter 0.5s ease-out;
}
@keyframes dafEnter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Spacing within Gemara */
.daf-section { margin-bottom: 2rem; }
.daf-section:last-child { margin-bottom: 0; }

/* Hebrew Text Helpers */
.he { direction: rtl; font-family: var(--font-gemara); }
.he-block { direction: rtl; text-align: right; }

/* Email Capture */
.email-capture {
  background: var(--parchment-dark);
  padding: 1.5rem;
  border-radius: 6px;
  text-align: center;
  margin: 2rem 0;
}
.email-capture h3 {
  font-family: var(--font-gemara);
  font-size: 1.2rem;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
}
.email-capture p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.email-capture-form {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto;
}
.email-capture-form input {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--parchment-shadow);
  border-radius: 4px;
  font-family: var(--font-ui);
}
.email-capture-form button {
  padding: 0.6rem 1.2rem;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
}
