/* ============================================
   Pawstar - Pet SNS
   Global Stylesheet
============================================ */

:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --text: #161616;
  --text-soft: #6B6B6B;
  --text-muted: #9A9A9A;
  --border: #EDEDED;
  --border-strong: #DBDBDB;
  --primary: #FF5A5F;
  --primary-hover: #E8464B;
  --accent: #FFBE0B;
  --story-ring: linear-gradient(45deg, #FFBE0B, #FF5A5F, #C13584);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --nav-h: 60px;
  --max-w: 975px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Pretendard', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--nav-h);
  padding-bottom: 80px;
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ============================================
   Top Navigation
============================================ */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topnav-inner {
  width: 100%;
  max-width: var(--max-w);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fraunces', 'Pretendard', serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: grid; place-items: center;
  color: white; font-size: 18px;
}

.search-bar {
  flex: 1;
  max-width: 280px;
  background: #EFEFEF;
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 14px;
}
.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  font: inherit;
  color: var(--text);
}
@media (max-width: 640px) {
  .search-bar { display: none; }
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-icons a {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--text);
  font-size: 22px;
  transition: transform 0.15s ease;
}
.nav-icons a:hover { transform: scale(1.1); }
.nav-icons a.active { color: var(--primary); }

/* ============================================
   Bottom Mobile Nav
============================================ */
.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}
.bottomnav a {
  font-size: 24px;
  color: var(--text);
  padding: 10px;
}
.bottomnav a.active { color: var(--primary); }
@media (min-width: 768px) {
  .bottomnav { display: none; }
}

/* ============================================
   Layout Container
============================================ */
.container {
  max-width: 630px;
  margin: 24px auto;
  padding: 0 16px;
}
.container-wide {
  max-width: var(--max-w);
  margin: 24px auto;
  padding: 0 20px;
}

/* ============================================
   Stories Bar
============================================ */
.stories {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }

.stories-track {
  display: flex;
  gap: 18px;
  padding: 0 4px;
}

.story {
  flex-shrink: 0;
  text-align: center;
  cursor: pointer;
  width: 72px;
}
.story-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  padding: 3px;
  background: var(--story-ring);
  margin: 0 auto 6px;
  transition: transform 0.2s ease;
}
.story:hover .story-avatar { transform: scale(1.06); }
.story-avatar.viewed { background: var(--border-strong); }
.story-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 3px solid var(--surface);
  object-fit: cover;
}
.story-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Post Card
============================================ */
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.post-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.post-user { flex: 1; }
.post-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.post-location {
  font-size: 12px;
  color: var(--text-soft);
}
.post-more {
  font-size: 20px;
  color: var(--text);
  padding: 4px;
}

.post-media {
  background: #F5F5F5;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.post-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.post:hover .post-media img { transform: scale(1.02); }

.post-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  font-size: 26px;
}
.post-actions button { transition: transform 0.15s ease; }
.post-actions button:hover { transform: scale(1.15); }
.post-actions .liked { color: var(--primary); }
.post-actions .spacer { flex: 1; }

.post-likes {
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
}

.post-caption {
  padding: 6px 16px 10px;
  font-size: 14px;
  line-height: 1.45;
}
.post-caption .name { font-weight: 600; margin-right: 6px; }

.post-comments {
  padding: 0 16px 8px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}

.post-time {
  padding: 4px 16px 16px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================
   Story Viewer Modal
============================================ */
.story-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.story-viewer.active { display: flex; }

.story-viewer-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 9 / 16;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
}
.story-viewer-content img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.story-progress {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  overflow: hidden;
}
.story-progress-bar {
  height: 100%;
  background: white;
  width: 0;
  animation: progress 5s linear forwards;
}
@keyframes progress {
  from { width: 0; }
  to { width: 100%; }
}

.story-header {
  position: absolute;
  top: 24px; left: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  z-index: 2;
}
.story-header img {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid white;
}
.story-header .name {
  font-weight: 600;
  font-size: 14px;
}
.story-header .time {
  font-size: 12px;
  opacity: 0.8;
}

.story-close {
  position: absolute;
  top: 20px; right: -50px;
  background: rgba(255,255,255,0.15);
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 20px;
  display: grid; place-items: center;
  backdrop-filter: blur(10px);
}
@media (max-width: 520px) {
  .story-close { top: 12px; right: 12px; }
}

/* ============================================
   Reels Page
============================================ */
.reels-container {
  max-width: 420px;
  margin: 0 auto;
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: calc(100vh - var(--nav-h) - 60px);
}
@media (min-width: 768px) {
  .reels-container { height: calc(100vh - var(--nav-h)); }
}

.reel {
  scroll-snap-align: start;
  position: relative;
  width: 100%;
  height: calc(100vh - var(--nav-h) - 60px);
  background: #111;
  overflow: hidden;
  margin-bottom: 0;
}
@media (min-width: 768px) {
  .reel {
    height: calc(100vh - var(--nav-h) - 40px);
    border-radius: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
  }
}
.reel img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.reel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 40%);
  display: flex;
  align-items: flex-end;
  padding: 20px;
  color: white;
}
.reel-info {
  flex: 1;
  max-width: calc(100% - 70px);
}
.reel-info .name { font-weight: 700; margin-bottom: 8px; }
.reel-info .caption { font-size: 14px; line-height: 1.4; opacity: 0.95; }
.reel-info .music {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.9;
}

.reel-actions {
  position: absolute;
  right: 14px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  color: white;
}
.reel-actions button {
  font-size: 30px;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.reel-actions .count {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ============================================
   Static Content Pages (About, Privacy, Contact)
============================================ */
.page {
  max-width: 780px;
  margin: 30px auto 60px;
  padding: 0 20px;
}
.page-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,90,95,0.15), transparent 70%);
  border-radius: 50%;
}
.page-kicker {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
}
.page h1 {
  font-family: 'Fraunces', 'Pretendard', serif;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .page h1 { font-size: 32px; }
}
.page-lead {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 560px;
}

.page-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
}
.page-section h2 {
  font-family: 'Fraunces', 'Pretendard', serif;
  font-size: 24px;
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}
.page-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 20px 0 8px;
}
.page-section p {
  color: var(--text-soft);
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.7;
}
.page-section ul { padding-left: 22px; color: var(--text-soft); }
.page-section ul li { margin-bottom: 8px; line-height: 1.6; }

.contact-form {
  display: grid;
  gap: 16px;
}
.contact-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--primary);
}
.contact-form textarea { min-height: 140px; resize: vertical; }
.contact-form button[type="submit"] {
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  justify-self: start;
  transition: background 0.15s ease;
}
.contact-form button[type="submit"]:hover { background: var(--primary-hover); }

.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}
.contact-card .icon {
  font-size: 22px;
  margin-bottom: 8px;
}
.contact-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.contact-card .value {
  font-weight: 600;
  font-size: 15px;
}

/* ============================================
   Post Detail Page
============================================ */
.post-detail {
  max-width: 935px;
  margin: 30px auto 60px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .post-detail {
    grid-template-columns: 1.3fr 1fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    gap: 0;
  }
}
.post-detail-media {
  background: #111;
  aspect-ratio: 1 / 1;
}
.post-detail-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.post-detail-side {
  padding: 24px;
}
.post-detail-article {
  margin-top: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 935px;
  margin-left: auto;
  margin-right: auto;
}
.post-detail-article h2 {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin-bottom: 12px;
}
.post-detail-article p {
  color: var(--text-soft);
  line-height: 1.7;
  margin-bottom: 14px;
}

/* ============================================
   Footer
============================================ */
.footer {
  margin-top: 60px;
  padding: 40px 20px 30px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
  margin-bottom: 16px;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 12px; }

/* ============================================
   Utility
============================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Heart pop animation */
@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.heart-pop { animation: heartPop 0.4s ease; }
