/* Campus Cats — shared stylesheet */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #67727e;
  --line: #e4e8ec;
  --brand: #0e7490;
  --brand-dark: #155e75;
  --brand-soft: #e0f2f7;
  --star: #f59e0b;
  --star-empty: #d5dade;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.05), 0 8px 24px rgba(23, 33, 43, 0.07);
  --shadow-lift: 0 2px 4px rgba(23, 33, 43, 0.06), 0 14px 34px rgba(23, 33, 43, 0.12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }

.brand .paw {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: 9px;
  color: #fff;
}
.brand .paw svg { width: 19px; height: 19px; }

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.site-nav a.active { color: var(--brand-dark); background: var(--brand-soft); }

/* auth area (header, right side) */
.auth-area {
  margin-left: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  max-width: 180px;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.user-chip .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0.2rem 0.3rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.auth-link:hover { color: var(--text); }

.btn-small { padding: 0.42rem 1rem; font-size: 0.88rem; }

/* ------------------------------------------------------------------ layout */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.page-title { margin: 0.5rem 0 0.25rem; font-size: 1.7rem; letter-spacing: -0.02em; }
.page-sub { margin: 0 0 1.5rem; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------ stars */

.stars {
  position: relative;
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
}
.stars .row { display: flex; gap: 2px; color: var(--star-empty); }
.stars .fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  gap: 2px;
  color: var(--star);
  pointer-events: none;
}
.stars svg { width: 1em; height: 1em; flex: none; }

/* interactive star input */
.star-input { display: flex; gap: 0.3rem; justify-content: center; }
.star-input button {
  appearance: none;
  border: none;
  background: none;
  padding: 0.2rem;
  margin: 0;
  cursor: pointer;
  color: var(--star-empty);
  transition: transform 0.12s ease, color 0.12s ease;
  border-radius: 8px;
}
.star-input button svg { width: 2.4rem; height: 2.4rem; display: block; }
.star-input button.lit { color: var(--star); }
.star-input button:hover { transform: scale(1.14); }
.star-input button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.star-input[data-disabled="1"] button { pointer-events: none; opacity: 0.55; }

/* ------------------------------------------------------------------- home */

.rate-wrap { max-width: 620px; margin: 0 auto; }

.rate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rate-photo {
  background:
    radial-gradient(1200px 400px at 50% -100px, #1e3a4a, #0d1b24);
  display: grid;
  place-items: center;
  min-height: 260px;
}
.rate-photo img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.rate-body { padding: 1.15rem 1.35rem 1.5rem; text-align: center; }

.cat-name { margin: 0 0 0.9rem; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.cat-name a { color: inherit; }

.rate-result {
  margin-top: 0.4rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
  animation: fadein 0.35s ease;
}
.rate-result .avg-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.05rem;
}
.rate-result .avg-num { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.rate-result .count { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }
.rate-result .your-vote { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }
.rate-result .stars { font-size: 1.35rem; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--brand-dark); }

.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }

.btn[disabled] { opacity: 0.6; pointer-events: none; }

/* ------------------------------------------------------------------ grids */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); text-decoration: none; }

.cat-card .cover { aspect-ratio: 4 / 3; background: #dfe4e8; }
.cat-card .cover img { width: 100%; height: 100%; object-fit: cover; }

.cat-card .info { padding: 0.8rem 1rem 0.95rem; }
.cat-card .info h3 { margin: 0 0 0.2rem; font-size: 1.05rem; letter-spacing: -0.01em; }
.cat-card .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.cat-card .meta span { white-space: nowrap; }
.cat-card .meta .stars { font-size: 0.95rem; }

/* photo tiles inside an album */
.photo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.photo-card .cover { aspect-ratio: 1 / 1; background: #dfe4e8; cursor: zoom-in; }
.photo-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.photo-card .info {
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.album-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 1.2rem;
}
.album-head .stars { font-size: 1.15rem; }
.album-head .summary { color: var(--muted); font-size: 0.95rem; }

/* --------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 16, 22, 0.92);
  display: none;
  place-items: center;
  padding: 2rem 1rem;
  cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }

/* ----------------------------------------------------------------- upload */

.form-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.75rem;
}

.field { margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.35rem; }
.field .help { color: var(--muted); font-size: 0.82rem; margin-top: 0.3rem; }

.field input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.field input[type="text"]:focus { outline: 2px solid var(--brand); outline-offset: 1px; background: #fff; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.dropzone input { display: none; }
.dropzone .big { font-weight: 600; color: var(--text); }
.dropzone.drag .big { color: var(--brand-dark); }

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.previews img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.form-msg { margin-top: 1rem; font-size: 0.95rem; display: none; }
.form-msg.err { display: block; color: var(--danger); }
.form-msg.ok {
  display: block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

/* ----------------------------------------------------------- modal dialog */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 16, 22, 0.55);
  display: none;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop.open { display: grid; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  max-width: 380px;
  width: 100%;
  padding: 1.6rem 1.5rem 1.4rem;
  text-align: center;
  animation: fadein 0.2s ease;
}
.modal h3 { margin: 0 0 0.4rem; font-size: 1.2rem; letter-spacing: -0.01em; }
.modal p { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.93rem; }
.modal .gsi-slot { display: flex; justify-content: center; min-height: 44px; margin-bottom: 1rem; }
.modal .modal-note { color: var(--danger); font-size: 0.88rem; }
.modal .modal-cancel { width: 100%; }

/* ------------------------------------------------------------ empty state */

.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--muted);
}
.empty h2 { color: var(--text); margin: 0.5rem 0 0.35rem; letter-spacing: -0.01em; }
.empty p { margin: 0 0 1.2rem; }

.loading { text-align: center; color: var(--muted); padding: 3rem 0; }

/* ----------------------------------------------------------------- mobile */

@media (max-width: 560px) {
  .site-header .inner { padding: 0.6rem 0.75rem; gap: 0.5rem; }
  .brand span.label { display: none; }           /* icon-only logo on tiny screens */
  .site-nav a { padding: 0.4rem 0.7rem; font-size: 0.88rem; }
  .user-chip .user-name { display: none; }       /* avatar only on tiny screens */
  main { padding: 1rem 0.75rem 2.5rem; }
  .page-title { font-size: 1.4rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
  .star-input button svg { width: 2.7rem; height: 2.7rem; }  /* bigger touch targets */
  .rate-body { padding: 1rem 1rem 1.3rem; }
}
