/* ================================================================
   COMPONENTS.CSS — Buttons, Cards, Forms, Modal, Countdown, etc.
   ================================================================ */

/* === BUTTONS === */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 22px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(38,128,104,0.22), 0 1px 2px rgba(0,0,0,0.08);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 4px 16px rgba(38,128,104,0.32), 0 2px 4px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border-strong);
}

.btn-ghost:hover,
.btn-ghost.btn--active {
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.btn-white {
  background: #ffffff;
  color: var(--color-primary-dark);
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.btn-white:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  transform: translateY(-1px);
}

/* Outline white (on dark backgrounds) */
.btn-outline-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 22px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.36);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-outline-white:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.6);
  transform: translateY(-1px);
}

/* === POST CARDS === */
.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-med),
              transform var(--transition-slow),
              box-shadow var(--transition-slow);
}

.post-card:hover {
  border-color: rgba(38,128,104,0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.post-card__click {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.post-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-primary-light);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover .post-card__media img {
  transform: scale(1.05);
}

/* type badge on card image */
.post-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-md);
}

.post-card__date {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-hint);
  letter-spacing: 0.02em;
}

.post-card__title {
  display: block;
  margin: 0 0 8px;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: 1.3;
  letter-spacing: -0.005em;
  transition: color var(--transition);
}

.post-card:hover .post-card__title {
  color: var(--color-primary);
}

.post-card__excerpt {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.post-card__author {
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-card__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-primary);
  font-weight: var(--weight-medium);
  text-decoration: none;
  flex: 0 0 auto;
  transition: gap var(--transition);
}

.post-card:hover .post-card__link {
  gap: 7px;
}

/* === POST GRIDS === */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
}

.posts-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* === FORMS === */
.form-group {
  margin-bottom: var(--space-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.form-input,
.form-select {
  width: 100%;
  padding: 11px 14px;
  font-size: var(--text-base);
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(38,128,104,0.12);
}

.form-input::placeholder {
  color: var(--color-text-hint);
}

.form-textarea {
  min-height: 130px;
  resize: vertical;
}

.form-help {
  margin: 6px 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.story-form {
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* === HALL OF FAME CARDS === */
.hall-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-md);
}

.hall-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-med),
              transform var(--transition-slow),
              box-shadow var(--transition-slow);
}

.hall-card:hover {
  border-color: rgba(38,128,104,0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hall-card__photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-primary-light);
}

.hall-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hall-card:hover .hall-card__photo img {
  transform: scale(1.04);
}

.hall-card__info {
  padding: var(--space-sm) var(--space-md);
}

.hall-card__name {
  display: block;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: -0.005em;
}

.hall-card__course {
  display: block;
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: var(--weight-medium);
}

.hall-card__date {
  display: block;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.hall-card__desc {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* === COUNTDOWN === */
.countdown {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.countdown__unit {
  min-width: 72px;
  text-align: center;
}

.countdown__num {
  display: block;
  font-size: 52px;
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.countdown__label {
  display: block;
  margin-top: 5px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.countdown__sep {
  margin-bottom: 22px;
  font-size: 38px;
  color: var(--color-text-hint);
  font-weight: var(--weight-medium);
}

/* === VIDEO MODAL === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
}

.modal__inner {
  position: relative;
  z-index: 1;
  width: min(840px, 95vw);
}

.modal__video {
  aspect-ratio: 16 / 9;
}

.modal__video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dark);
}

.modal__close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  transition: background var(--transition);
}

.modal__close:hover {
  background: rgba(255,255,255,0.22);
}

/* === ALERTS === */
.alert {
  margin-bottom: var(--space-md);
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(38,128,104,0.2);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: var(--text-sm);
}

.alert--error {
  background: #fdf0f0;
  color: #8a1c1c;
  border-color: rgba(138,28,28,0.15);
}

/* === EMPTY STATE === */
.empty-state {
  padding: var(--space-xl);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: var(--text-sm);
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
  .posts-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hall-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .posts-grid,
  .posts-grid--four,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hall-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-form {
    padding: var(--space-md);
  }

  .countdown {
    gap: var(--space-sm);
    justify-content: space-between;
  }

  .countdown__unit {
    min-width: 56px;
  }

  .countdown__num {
    font-size: var(--text-2xl);
  }

  .countdown__sep {
    display: none;
  }
}
