/* Pinterest Mobile Pin Page - Style */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--pin-font);
  background: var(--pin-bg);
  color: var(--pin-dark);
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Top Navigation Bar */
.nav-top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--pin-surface);
  border-bottom: 1px solid var(--pin-gray-200);
  height: 56px;
}

.nav-top .nav-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 10px 0;
}

.nav-top .nav-logo .pinterest-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-top .nav-logo .nav-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--pin-red);
  letter-spacing: -0.5px;
}

.nav-top .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-top .nav-login {
  font-size: 15px;
  font-weight: 600;
  color: var(--pin-link-color);
  text-decoration: none;
  padding: 8px 4px;
}

.nav-top .nav-login:active {
  opacity: 0.7;
}

.nav-top .nav-signup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 24px;
  background: var(--pin-red);
  color: var(--pin-white);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.nav-top .nav-signup:active {
  background: var(--pin-red-hover);
}

/* Pin Container */
.pin-container {
  max-width: 100%;
  background: var(--pin-surface);
  margin-bottom: 8px;
}

/* Pin Image */
.pin-image-wrapper {
  position: relative;
  width: 100%;
  background: #000034;
}

.pin-image-wrapper img {
  display: block;
  width: 100%;
  height: auto;
}

/* Pin Content Section */
.pin-content {
  padding: 12px 16px 16px;
}

/* Source / Domain link */
.pin-source {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.pin-source .source-icon {
  width: 16px;
  height: 16px;
  color: var(--pin-gray-500);
}

.pin-source a {
  font-size: 14px;
  color: var(--pin-link-color);
  text-decoration: none;
  font-weight: 600;
}

.pin-source a:hover {
  text-decoration: underline;
}

/* Pin Description */
.pin-description {
  font-size: 14px;
  color: var(--pin-dark);
  line-height: 1.5;
  margin-bottom: 16px;
  word-wrap: break-word;
}

.pin-description a {
  color: var(--pin-link-color);
  text-decoration: none;
}

.pin-description a:hover {
  text-decoration: underline;
}

/* Pin Stats */
.pin-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--pin-gray-600);
}

.pin-stats .stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--pin-dark);
}

/* Action Buttons Row */
.pin-actions {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.pin-actions .actions-left,
.pin-actions .actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.pin-actions .actions-right {
  justify-content: flex-end;
}

.pin-actions .actions-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pin-actions .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--pin-dark);
  transition: background 0.15s;
}

.pin-actions .action-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.pin-actions .action-btn-icon:active {
  background: var(--pin-gray-100);
}

.pin-actions .action-btn-icon svg {
  width: 20px;
  height: 20px;
}

.pin-actions .action-btn-text {
  padding: 0 16px;
  height: 40px;
  border-radius: 24px;
  border: 2px solid var(--pin-gray-300);
  background: var(--pin-surface);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--pin-font);
  color: var(--pin-dark);
}

.pin-actions .action-btn-text:active {
  background: var(--pin-gray-100);
}

.pin-actions .save-btn {
  padding: 0 20px;
  height: 40px;
  border-radius: 24px;
  border: none;
  background: var(--pin-red);
  color: var(--pin-white);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--pin-font);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.pin-actions .save-btn:active {
  background: var(--pin-red-hover);
}

/* Divider */
.pin-divider {
  height: 1px;
  background: var(--pin-gray-200);
  margin: 0 0 16px;
}

/* Pinner / Creator Section */
.pin-pinner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 16px;
}

.pin-pinner .pinner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--pin-link-color);
  min-width: 0;
}

.pin-pinner .pinner-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.pin-pinner .pinner-details {
  min-width: 0;
}

.pin-pinner .pinner-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-pinner .pinner-followers {
  font-size: 12px;
  color: var(--pin-gray-500);
  margin-top: 2px;
}

.pin-pinner .follow-btn {
  padding: 0 16px;
  height: 40px;
  border-radius: 24px;
  border: none;
  background: var(--pin-gray-100);
  color: var(--pin-dark);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.pin-pinner .follow-btn:active {
  background: var(--pin-gray-300);
}

/* Tags / Related Topics */
.pin-tags {
  padding: 0 16px 16px;
  background: var(--pin-surface);
}

.pin-tags h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.pin-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pin-tags-list .tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 24px;
  background: var(--pin-gray-100);
  font-size: 14px;
  font-weight: 600;
  color: var(--pin-link-color);
  text-decoration: none;
  transition: background 0.15s;
}

.pin-tags-list .tag:active {
  background: var(--pin-gray-300);
}

/* Board Section */
.pin-board-section {
  padding: 16px;
  background: var(--pin-surface);
  margin-top: 8px;
}

.pin-board-section h3 {
  font-size: 14px;
  color: var(--pin-gray-500);
  margin-bottom: 12px;
}

.pin-board {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--pin-link-color);
}

.pin-board .board-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--pin-radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.pin-board .board-info .board-name {
  font-size: 16px;
  font-weight: 700;
}

.pin-board .board-info .board-pins {
  font-size: 12px;
  color: var(--pin-gray-500);
  margin-top: 2px;
}

/* Comments Section */
.pin-comments {
  padding: 16px;
  background: var(--pin-surface);
  margin-top: 8px;
}

.pin-comments h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pin-comments .no-comments {
  font-size: 14px;
  color: var(--pin-gray-500);
  padding: 16px 0;
}

.pin-comments .comment-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--pin-gray-200);
}

.pin-comments .comment-input .comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pin-gray-200);
  flex-shrink: 0;
}

.pin-comments .comment-input input {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 24px;
  background: var(--pin-gray-100);
  padding: 0 16px;
  font-size: 14px;
  font-family: var(--pin-font);
  outline: none;
}

.pin-comments .comment-input input::placeholder {
  color: var(--pin-gray-400);
}

/* More Like This / Related */
.pin-related {
  padding: 16px;
  background: var(--pin-surface);
  margin-top: 8px;
}

.pin-related h3 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.related-grid {
  columns: 2;
  column-gap: 8px;
}

.related-card {
  break-inside: avoid;
  margin-bottom: 8px;
}

.related-img {
  border-radius: var(--pin-radius);
  overflow: hidden;
  position: relative;
}

.related-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-img--tall {
  height: 260px;
  min-height: 220px;
}

.related-img--medium {
  height: 200px;
  min-height: 180px;
}

.related-img--short {
  height: 160px;
  min-height: 140px;
}

.related-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pin-dark);
  padding: 6px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Navigation */
.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  background: var(--pin-surface);
  border-top: 1px solid var(--pin-gray-200);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-bottom a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--pin-gray-500);
  padding: 4px 12px;
  font-size: 10px;
  font-family: var(--pin-font);
  text-decoration: none;
}

.nav-bottom a.active {
  color: var(--pin-link-color);
}

.nav-bottom a svg {
  width: 24px;
  height: 24px;
}

/* Safe area for bottom nav */
.bottom-spacer {
  height: calc(56px + env(safe-area-inset-bottom, 0));
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--pin-dark);
  color: var(--pin-surface);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Image zoom overlay */
.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.image-overlay.active {
  display: flex;
}

.image-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-overlay .close-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: var(--pin-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-overlay .close-overlay svg {
  width: 20px;
  height: 20px;
}

/* Responsive - keep max width for larger phones */
@media (min-width: 480px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  }

  .nav-bottom {
    width: 100%;
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}