:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-soft: #fbfbfd;
  --bg-elevated: rgba(255, 255, 255, 0.72);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #8e8e93;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.12);

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);

  --success-soft: #eef7ff;
  --danger-soft: #fff2f2;
  --danger-text: #d92d20;

  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);

  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 34px;

  --transition: 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family:
    "SF Pro Display",
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top left, rgba(0, 113, 227, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(180deg, #f9f9fb 0%, #f2f2f7 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* =========================
   YEAR BANNER
========================= */
.year-banner {
  width: 100%;
  text-align: center;
  padding: 26px 18px 8px;
  position: relative;
  z-index: 5;
}

.top-label {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.big-year {
  font-size: clamp(4rem, 11vw, 7.2rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.06em;
  color: var(--text-primary);
}

/* ===== HERO FIX OVERRIDE ===== */

.year-banner {
  padding: 28px 18px 0 !important;
}

.top-label {
  margin-bottom: 6px !important;
}

.big-year {
  font-size: clamp(4rem, 9vw, 6rem) !important;
  line-height: 0.95 !important;
  margin: 0 !important;
}

.hero-section {
  min-height: auto !important;
  height: auto !important;
  padding: 18px 20px 40px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
  overflow: visible !important;
}

.hero-content {
  width: min(820px, 92%) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  gap: 14px !important;
  animation: none !important;
}

.site-name {
  font-size: clamp(3rem, 6vw, 4.4rem) !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.hero-text {
  margin: 0 !important;
  max-width: 620px !important;
  font-size: 1.02rem !important;
  line-height: 1.7 !important;
  color: #6e6e73 !important;
}

.hero-visual {
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  display: none !important;
}

.falling-photos {
  display: none !important;
}

.hero-buttons {
  margin-top: 10px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
}

.save-btn,
.secondary-btn {
  min-width: 190px !important;
  padding: 14px 24px !important;
}

.calendar-page {
  margin-top: 18px !important;
}

/* =========================
   BUTTONS
========================= */
.save-btn,
.delete-btn,
.secondary-btn,
.nav-btn,
.tool-btn,
.close-btn {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    opacity var(--transition);
}

.save-btn:hover,
.secondary-btn:hover,
.nav-btn:hover,
.tool-btn:hover,
.delete-btn:hover {
  transform: translateY(-2px);
}

.save-btn,
.delete-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}

.save-btn {
  background: linear-gradient(180deg, #0a84ff 0%, #0071e3 100%);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.26);
}

.save-btn:hover {
  background: linear-gradient(180deg, #2892ff 0%, #0077ed 100%);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--border-strong);
}

.delete-btn {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.delete-btn:hover {
  background: #ffe8e8;
}

/* =========================
   CALENDAR WRAPPER
========================= */
.calendar-page {
  width: min(1220px, 92%);
  margin: 0 auto 48px;
  position: relative;
  z-index: 5;
  scroll-margin-top: 30px;
}

.calendar-section {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: 26px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.9s ease;
}

.calendar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.calendar-topbar h2 {
  flex: 1;
  text-align: center;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.nav-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-btn:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

/* =========================
   WEEKDAYS
========================= */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.weekdays div {
  text-align: center;
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* =========================
   CALENDAR GRID
========================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

.day-cell {
  min-height: 158px;
  border-radius: 24px;
  padding: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.day-cell:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 113, 227, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

.other-month {
  opacity: 0.42;
  background: rgba(245, 245, 247, 0.75);
  pointer-events: none;
}

.today {
  border: 1.5px solid rgba(0, 113, 227, 0.35);
  box-shadow:
    0 0 0 4px rgba(0, 113, 227, 0.08),
    var(--shadow-md);
}

.has-entry {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(245, 249, 255, 0.94) 100%);
}

.day-top {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
  margin-bottom: 10px;
}

.day-number {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.day-title {
  max-width: calc(100% - 38px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.day-image {
  width: 100%;
  height: 92px;
  margin-top: auto;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

/* =========================
   MODAL
========================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

.modal-content {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;

  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 30px;
  padding: 28px;
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: var(--shadow-lg);

  animation: modalPop 0.28s ease;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  background: #ffffff;
  color: var(--text-primary);
}

.modal-content h3 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 22px;
  padding-right: 48px;
}

/* =========================
   VIEW MODE
========================= */
.entry-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-title {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.view-image-container.hidden {
  display: none !important;
}

#viewImage {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid var(--border);
}

.view-note {
  min-height: 120px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  line-height: 1.8;
  color: var(--text-primary);
  direction: auto;
  text-align: start;
  unicode-bidi: plaintext;
}

.view-note h1,
.view-note h2,
.view-note p,
.view-note ul,
.view-note ol {
  margin-bottom: 10px;
}

.view-note ul,
.view-note ol {
  padding-inline-start: 22px;
}

/* =========================
   FORM
========================= */
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="file"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-primary);
  font-size: 0.98rem;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.form-group input[type="text"]:focus,
.form-group input[type="file"]:focus {
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
  background: #ffffff;
}

/* =========================
   TOOLBAR
========================= */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.tool-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-secondary);
  padding: 9px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.tool-btn:hover {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* =========================
   EDITOR
========================= */
.editor {
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
  direction: auto;
  text-align: start;
  unicode-bidi: plaintext;

  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.editor:focus {
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
  background: #ffffff;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
}

.editor h1,
.editor h2,
.editor p,
.editor ul,
.editor ol {
  margin-bottom: 10px;
}

.editor ul,
.editor ol {
  padding-inline-start: 22px;
}

/* =========================
   IMAGE PREVIEW
========================= */
.image-preview-container {
  display: none;
}

.image-preview-container.show {
  display: block;
}

#imagePreview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* =========================
   ACTIONS
========================= */
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* =========================
   FALLING PHOTOS
========================= */
.falling-photos {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.falling-photo {
  position: absolute;
  top: -200px;
  width: 120px;
  height: 150px;
  object-fit: cover;
  border-radius: 22px;
  border: 6px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
  animation-name: fallDown, swaySide;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
  opacity: 0.95;
}

/* =========================
   ANIMATIONS
========================= */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fallDown {
  0% {
    transform: translateY(-200px) rotate(-8deg);
    opacity: 0;
    filter: blur(2px);
  }

  10% {
    opacity: 1;
    filter: blur(0);
  }

  60% {
    opacity: 1;
  }

  78% {
    opacity: 0.25;
    filter: blur(2px);
  }

  92% {
    opacity: 0;
    transform: translateY(72vh) rotate(8deg);
    filter: blur(4px);
  }

  100% {
    opacity: 0;
  }
}

@keyframes swaySide {
  0% {
    margin-left: 0;
  }
  50% {
    margin-left: 18px;
  }
  100% {
    margin-left: -12px;
  }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .calendar-grid,
  .weekdays {
    gap: 10px;
  }

  .day-cell {
    min-height: 136px;
    border-radius: 20px;
  }

  .day-image {
    height: 74px;
    border-radius: 16px;
  }
}

@media (max-width: 700px) {
  .year-banner {
    padding-top: 20px;
  }

  .calendar-section {
    padding: 16px;
    border-radius: 24px;
  }

  .calendar-topbar h2 {
    font-size: 1.2rem;
  }

  .weekdays div {
    font-size: 0.79rem;
    padding: 10px 4px;
  }

  .calendar-grid {
    gap: 8px;
  }

  .day-cell {
    min-height: 102px;
    padding: 8px;
    border-radius: 16px;
  }

  .day-number {
    width: 24px;
    height: 24px;
    font-size: 0.76rem;
    border-radius: 8px;
  }

  .day-title {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .day-image {
    height: 50px;
    border-radius: 12px;
  }

  .modal-content {
    padding: 20px;
    border-radius: 24px;
  }

  .editor {
    min-height: 180px;
  }

  .big-year {
    font-size: clamp(3.2rem, 14vw, 5rem);
  }

  .site-name {
    font-size: clamp(2.3rem, 8vw, 3.5rem);
  }

  .hero-text {
    font-size: 0.98rem;
  }

  .save-btn,
  .secondary-btn,
  .delete-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =========================
   ENDING SECTION
========================= */
.ending-section {
  position: relative;
  width: min(1220px, 92%);
  margin: 30px auto 80px;
  padding: 40px 20px 10px;
  overflow: hidden;
}

.ending-section::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  margin-bottom: 34px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 113, 227, 0.12) 20%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 113, 227, 0.12) 80%,
    transparent 100%
  );
}

.ending-card {
  position: relative;
  z-index: 2;
  max-width: 860px;
  margin: 0 auto;
  padding: 42px 30px;
  text-align: center;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.ending-label {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.ending-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 750;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.ending-text {
  max-width: 620px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

.ending-actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.ending-actions .secondary-btn {
  min-width: 170px;
}

.ending-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
}

.ending-glow-1 {
  width: 220px;
  height: 220px;
  background: rgba(0, 113, 227, 0.12);
  top: 10px;
  left: 8%;
  animation: floatGlow 7s ease-in-out infinite;
}

.ending-glow-2 {
  width: 260px;
  height: 260px;
  background: rgba(180, 180, 200, 0.16);
  bottom: 0;
  right: 7%;
  animation: floatGlow 8s ease-in-out infinite reverse;
}

@keyframes floatGlow {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.05);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.site-name {
  margin-bottom: 10px;
}

.hero-text {
  margin-bottom: 20px;
}

.hero-visual {
  margin: 20px auto 24px;
  min-height: 200px; /* بدل 320 */
}