/* פריסת העמודים של אתר RSA בלבד - בלי צבעים או רכיבים.
   כל עיצוב של רכיב מגיע מ-dashboard.css. */

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

/* רכיבים עם display משלהם (.btn) דורסים את hidden של הדפדפן */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.site-brand {
  color: inherit;
  text-decoration: none;
  font-family: var(--font-h1);
  font-weight: 700;
  font-size: 1.4rem;
}

.site-brand-sub {
  font-weight: 400;
}

.site-nav,
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a,
.site-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-sm);
}

.site-main:focus {
  outline: none;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* מסך 1 - טופס החיפוש */
.search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-sm);
  padding: var(--space-md);
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.search-field .input {
  width: 100%;
}

.search-field--wide,
.search-actions {
  grid-column: 1 / -1;
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

.search-actions .link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* מסך 2 - תוצאות */
.results-head,
.results-foot,
.script-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block: var(--space-md);
}

.results-head .h1 {
  flex-basis: 100%;
  margin: 0;
}

.results-head p,
.results-foot p {
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.script-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  height: 100%;
}

.script-card .card-title,
.script-card p {
  margin: 0;
}

.script-card-meta {
  flex: 1;
  margin: 0;
}

.script-card-meta div {
  margin-block: 0.2rem;
}

.script-card-meta dt,
.script-card-meta dd {
  display: inline;
  margin: 0;
}

.script-card-meta dt {
  font-weight: 700;
}

.script-card .btn {
  align-self: flex-start;
}

.pagination-gap {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.3rem;
}

/* מסך 3 - פרטי סקריפט */
.script-page .breadcrumb {
  margin-block: var(--space-sm);
}

.script-actions {
  justify-content: flex-start;
}

.script-copy-status {
  margin: 0;
}

/* פסקאות בתוכן הסקריפט הן הפרדה מכוונת בין בלוקים - נשארות, רק בלי רווח בקצוות */
.script-code > :first-child {
  margin-top: 0;
}

.script-code > :last-child {
  margin-bottom: 0;
}

/* טפסים: צור קשר, כניסת ניהול */
.form-panel {
  display: grid;
  gap: var(--space-md);
  max-width: 40rem;
  padding: var(--space-md);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-field .form-label,
.field-hint,
.field-error {
  margin: 0;
}

.form-panel textarea {
  resize: vertical;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
}

.form-check .checkbox {
  flex: none;
  margin-top: 0.15rem;
}

.form-panel > p {
  margin: 0;
}

.error-summary,
.form-message {
  max-width: 40rem;
  margin-block: var(--space-md);
}

.error-summary .h3 {
  margin-top: 0;
}

.error-summary ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* ניהול */
.admin-breadcrumb {
  margin-bottom: var(--space-sm);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-block: var(--space-md);
}

.admin-search {
  flex: 1 1 20rem;
  max-width: 32rem;
}

.admin-search-row {
  display: flex;
  gap: var(--space-xs);
}

.table-scroll {
  /* relative: טקסט לקורא מסך (.visually-hidden, absolute) נשאר בתוך אזור הגלילה ולא מרחיב את העמוד */
  position: relative;
  overflow-x: auto;
  margin-block: var(--space-sm);
}

.table-scroll .table {
  min-width: 36rem;
}

.data-cell {
  font-variant-numeric: tabular-nums;
}

.form-panel--wide {
  max-width: 60rem;
}

.admin-readonly {
  margin: 0;
}

.color-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.color-field .input {
  flex: 1 1 12rem;
}

.admin-summary {
  display: grid;
  gap: var(--space-xs);
  max-width: 40rem;
  margin-block: var(--space-md);
  padding: var(--space-md);
}

.admin-summary div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.admin-summary dt {
  font-weight: 700;
}

.admin-summary dt::after {
  content: ":";
}

.admin-summary dd {
  margin: 0;
}

.form-message ul,
.form-message p {
  margin-block: var(--space-xs);
}

/* ערכים ביומן השינויים: שמירת שורות, שבירת מילים ארוכות */
.change-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* כפתור יציאה בתוך סרגל הניהול */
.site-nav-form {
  margin: 0;
}

/* עמודים משפטיים: שורה קצרה לקריאה נוחה */
.legal {
  max-width: 46rem;
}

.legal .h2 {
  margin-top: var(--space-md);
}

.legal li + li {
  margin-top: var(--space-xs);
}

/* דף הזיכרון (ניהול): נר עם להבה מרצדת - ציור בקוד, בצבעי ספר המותג */
/* טלפון: תמונה ונר זה לצד זה, הטקסט מתחת. מסך רחב: תמונה | טקסט | נר, הכל במסך אחד */
.memorial-layout {
  display: grid;
  grid-template-columns: 9rem 1fr;
  grid-template-areas:
    "photo candle"
    "text text";
  align-items: start;
  gap: var(--space-sm);
}

.memorial-photo {
  grid-area: photo;
  margin: 0;
}

.memorial-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-global);
}

.memorial-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.memorial-verse {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.7;
}

.memorial-download {
  margin: 0;
}

.memorial-candle-wrap {
  grid-area: candle;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

@media (min-width: 48rem) {
  .memorial-layout {
    grid-template-columns: auto auto auto;
    grid-template-areas: "photo text candle";
    justify-content: start;
    gap: var(--space-md);
  }

  .memorial-candle-wrap {
    justify-self: start;
  }

  /* עד 28rem (פי 2 מהגודל הקודם), אבל לא יותר ממה שנכנס לגובה המסך מתחת לכותרת.
     0.7077 = 799/1129, יחס הרוחב לגובה של התמונה */
  .memorial-photo {
    width: min(28rem, (100vh - 13rem) * 0.7077, 40vw);
  }
}

.memorial-candle {
  position: relative;
  width: 3rem;
  height: 9.5rem;
}

.memorial-wax {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 6rem;
  border-radius: 0.4rem 0.4rem 0.6rem 0.6rem;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--color-gray-light) 75%, black),
    color-mix(in srgb, var(--color-gray-light) 40%, white) 45%,
    color-mix(in srgb, var(--color-gray-light) 85%, black)
  );
}

.memorial-wick {
  position: absolute;
  bottom: 6rem;
  left: 50%;
  width: 2px;
  height: 0.7rem;
  margin-left: -1px;
  background: var(--color-charcoal);
}

.memorial-flame {
  position: absolute;
  bottom: 6.4rem;
  left: 50%;
  width: 1.4rem;
  height: 2.6rem;
  margin-left: -0.7rem;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(
    circle at 50% 75%,
    white 0 15%,
    color-mix(in srgb, var(--color-gold-metallic) 55%, white) 30%,
    var(--color-gold-metallic) 55%,
    var(--color-amber-dark) 85%
  );
  box-shadow: 0 0 1.4rem 0.5rem color-mix(in srgb, var(--color-gold-metallic) 45%, transparent);
  transform-origin: 50% 90%;
  animation: memorial-flicker 2.4s ease-in-out infinite alternate;
}

.memorial-candle--still .memorial-flame {
  animation-play-state: paused;
}

@keyframes memorial-flicker {
  0% { transform: scale(1, 1) rotate(-1deg); opacity: 0.95; }
  25% { transform: scale(0.96, 1.05) rotate(1.5deg); }
  50% { transform: scale(1.03, 0.97) rotate(-2deg); opacity: 1; }
  75% { transform: scale(0.98, 1.04) rotate(1deg); }
  100% { transform: scale(1.02, 0.98) rotate(-0.5deg); opacity: 0.92; }
}

/* עמוד תצוגת הרכיבים (פיתוח בלבד) */
.sg-section {
  margin-block: var(--space-md);
  padding: var(--space-md);
}

.sg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-block: var(--space-sm);
}

.sg-form {
  display: grid;
  gap: var(--space-sm);
  max-width: 480px;
}

.sg-check {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.sg-table-wrap {
  margin-top: var(--space-sm);
  overflow-x: auto;
}
