/*
 * WikiPortraits Photo Portal — common stylesheet
 *
 * Contents
 * 
 * 1. Custom properties & reset
 * 2. Base
 * 3. Header
 * 4. Buttons
 * 5. Footer
 *
 * Page-specific styles live in separate files:
 *  gallery.css   — filter bar, grid, photo cards, pagination
 *  photo.css     — photo detail, tags, license badge
 *  auth.css      — login & register forms
 *  error.css     — error page
 */

/* 1. Custom properties & reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colours */
  --clr-bg:          #f5f5f5;
  --clr-surface:     #ffffff;
  --clr-header:      #1d1d1d;
  --clr-header-text: #ffffff;
  --clr-text:        #1a1a1a;
  --clr-text-muted:  #666666;
  --clr-accent:      #c8102e;
  --clr-accent-dark: #a50d26;
  --clr-border:      #e0e0e0;
  --clr-tag-subj:    #e8f0fe;
  --clr-tag-subj-fg: #1a3c6e;
  --clr-tag-evt:     #fef3cd;
  --clr-tag-evt-fg:  #7c5800;

  /* Sizing */
  --container-width: 1400px;
  --height-control:  36px;
  --radius:          4px;
  --radius-lg:       8px;

  /* Elevation */
  --shadow:    0 2px 8px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.14);

  /* Motion */
  --transition: 0.18s ease;

  /* Typography */
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

/* 2. Base */
html { font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
main { flex: 1; }

/* 3. Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--clr-header);
  color: var(--clr-header-text);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.header-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none !important;
  min-width: 0;
  flex-shrink: 1;
}
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  padding: 3px;
}
.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}
.logo-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--clr-header-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.header-nav { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.nav-link {
  display: inline-flex;
  align-items: center;
  color: rgba(255,255,255,.8);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1;
  transition: color var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
}
.nav-link:hover { color: #fff; }
.nav-link--btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

/* Responsive header: shrink logo text on small screens */
@media (max-width: 480px) {
  .header-inner {
    padding: .6rem 1rem;
  }
  .logo-name {
    font-size: .85rem;
    letter-spacing: 0;
  }
  .header-nav { gap: .75rem; }
  .nav-register { padding: 0 .75rem; }
}

/* 4. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--height-control);
  padding: 0 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn--primary { background: var(--clr-accent); color: #fff !important; }
.btn--primary:hover { background: var(--clr-accent-dark); }
.btn--ghost {
  background: transparent;
  color: var(--clr-text-muted) !important;
  border: 1px solid var(--clr-border);
}
.btn--ghost:hover { border-color: #aaa; color: var(--clr-text) !important; }
.btn--full { display: flex; width: 100%; }

/* 5. Footer */
.site-footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  background: var(--clr-header);
  color: rgba(255,255,255,.55);
  font-size: .82rem;
}
.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.site-footer a { color: rgba(255,255,255,.75); text-decoration: underline; }
.site-footer a:hover { color: #fff; }

/* Header nav extras (used in header partial) */
.nav-user {
  color: rgba(255,255,255,.65);
  font-size: .88rem;
}
.nav-link--btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.nav-register { height: 30px; font-size: .82rem; }

/* Email verification banner */
.verify-banner {
  background: #fffbea;
  border-bottom: 1px solid #f5e07a;
  padding: .55rem 1.5rem;
  font-size: .875rem;
  color: #7c6200;
}
.verify-banner__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.verify-banner__link {
  white-space: nowrap;
  font-weight: 600;
  color: #5a4700;
  text-decoration: underline;
}
.verify-banner__link:hover { color: #3a2e00; }

/* Star button */
.star-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), transform var(--transition);
}
.star-btn svg {
  fill: none;
  stroke: #999;
  stroke-width: 2;
  stroke-linejoin: round;
  transition: fill var(--transition), stroke var(--transition);
}
.star-btn:hover {
  background: #fff;
  transform: scale(1.12);
}
.star-btn:hover svg         { stroke: #e8a020; }
.star-btn.star-btn--active svg {
  fill: #f5a623;
  stroke: #f5a623;
}
.star-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* Detail-page variant — inline block button */
.star-btn--detail {
  position: static;
  width: 100%;
  height: var(--height-control);
  border-radius: var(--radius);
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  gap: .5rem;
  padding: 0 1.1rem;
  font-size: .88rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: .5rem;
}
.star-btn--detail svg { flex-shrink: 0; }
.star-btn--detail:hover {
  border-color: #e8a020;
  color: var(--clr-text);
  background: var(--clr-bg);
  transform: none;
}
.star-btn--detail.star-btn--active {
  border-color: #f5a623;
  background: #fff8ee;
  color: #b87200;
}
.star-btn--detail.star-btn--active svg {
  fill: #f5a623;
  stroke: #f5a623;
}

/* Profile page */
.profile-header {
  max-width: var(--container-width);
  margin: 2rem auto 1.5rem;
  padding: 0 1.5rem;
}
.profile-name {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.profile-meta {
  color: var(--clr-text-muted);
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.profile-sep { opacity: .5; }
.profile-email {
  font-size: .85rem;
  color: var(--clr-text-muted);
  margin-top: .25rem;
}
.profile-verified {
  font-size: .75rem;
  color: var(--clr-success, #2e7d32);
  margin-left: .35rem;
}
.profile-unverified {
  font-size: .75rem;
  color: var(--clr-error, #c62828);
  margin-left: .35rem;
}
.profile-section-title {
  max-width: var(--container-width);
  margin: 0 auto 1rem;
  padding: 0 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.profile-count { font-weight: 400; color: var(--clr-text-muted); }

/* Flash banner */
.profile-flash {
  max-width: var(--container-width);
  margin: 0 auto 1.5rem;
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.5;
}
.profile-flash--success {
  background: #eaf5ea;
  border-left: 3px solid #3a8a3a;
  color: #1a5c1a;
}
.profile-flash--error {
  background: #fff5f5;
  border-left: 3px solid var(--clr-accent);
  color: #b00;
}

/* Edit grid — two equal columns */
.profile-edit-grid {
  max-width: var(--container-width);
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.profile-edit-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
}
.profile-edit-card__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.profile-edit-card__divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: 1.75rem 0;
}

@media (max-width: 760px) {
  .profile-edit-grid { grid-template-columns: 1fr; }
}
