/* ============================================================
   ArtNotes.io — Main Stylesheet
   ============================================================ */

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

:root {
  --bg:           #f7f5f2;
  --surface:      #ffffff;
  --text:         #1c1a18;
  --text-muted:   #6e6a65;
  --accent:       #b5913a;
  --accent-light: #d4aa55;
  --border:       #e3dfd9;
  --radius:       6px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 3px 12px rgba(0,0,0,.12);
  --nav-bg:       #1c1a18;
  --nav-text:     #f0ede8;
  --success:      #2d7a4a;
  --error:        #b83232;
  --pin-color:    #e84040;
  --max-w:        1200px;
}

/* ---- Base ------------------------------------------------- */
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, textarea, select { font: inherit; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- Navigation ------------------------------------------- */
.nav {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nav__inner {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 1.5rem;
}
.nav__brand {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav__links {
  display: flex;
  list-style: none;
  gap: .15rem;
  flex: 1;
}
.nav__links a {
  color: var(--nav-text);
  padding: .4rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  white-space: nowrap;
  opacity: .8;
  transition: background .15s, opacity .15s;
}
.nav__links a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.nav__links a.active { background: rgba(255,255,255,.12); opacity: 1; color: var(--accent-light); }
.nav__auth {
  display: flex;
  align-items: center;
  gap: .75rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav__user {
  color: var(--nav-text);
  font-size: .8rem;
  opacity: .75;
}
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .25rem .5rem;
  margin-left: auto;
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn--primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn--ghost     { background: transparent; color: var(--nav-text); border-color: rgba(255,255,255,.3); }
.btn--ghost:hover { background: rgba(255,255,255,.1); }
.btn--outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn--danger    { background: var(--error); color: #fff; border-color: var(--error); }
.btn--danger:hover { opacity: .88; }
.btn--success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn--success:hover { opacity: .88; }
.btn--sm        { padding: .35rem .8rem; font-size: .8rem; }
.btn--lg        { padding: .7rem 1.5rem; font-size: 1rem; }
.btn--block     { display: flex; width: 100%; }
button.btn[disabled] { opacity: .5; cursor: default; }

/* ---- Flash messages --------------------------------------- */
.flash {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .875rem;
  font-weight: 500;
}
.flash--success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash--error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.flash--info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ---- Main content ----------------------------------------- */
.main { flex: 1; padding: 2rem 0 3rem; }

/* ---- Page header ------------------------------------------ */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -.3px; }
.page-header p  { color: var(--text-muted); margin-top: .35rem; font-size: .95rem; }

/* ---- Hero ------------------------------------------------- */
.hero {
  background: linear-gradient(140deg, #1c1a18 0%, #2e251e 60%, #1c1a18 100%);
  color: #f0ede8;
  padding: 5rem 0;
  margin: -2rem -1.25rem 3rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: .85rem;
  line-height: 1.2;
}
.hero h1 em { color: var(--accent-light); font-style: normal; }
.hero p {
  font-size: 1.05rem;
  opacity: .78;
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}
.hero__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero__stats   {
  display: flex;
  gap: 3rem;
  justify-content: center;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.hero__stat { text-align: center; }
.hero__stat strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-light);
  line-height: 1.1;
}
.hero__stat span { font-size: .8rem; opacity: .65; }

/* ---- Section header --------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 1.25rem; font-weight: 700; }

/* ---- Artwork grid ----------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* ---- Artwork card ----------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card__link { display: contents; }
.card__img  {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #ddd;
}
.card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
}
.card:hover .card__img img { transform: scale(1.05); }
.card__body {
  padding: .875rem 1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card__title {
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: .3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__artist { font-size: .8rem; color: var(--accent); font-weight: 500; margin-bottom: .4rem; }
.card__meta   { font-size: .73rem; color: var(--text-muted); margin-top: auto; }

/* ---- Pagination ------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius);
  font-size: .85rem;
  border: 1.5px solid var(--border);
  padding: 0 .6rem;
}
.pagination a { color: var(--text); transition: border-color .15s, color .15s; }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pagination .dots    { border: none; color: var(--text-muted); }

/* ---- Artwork detail layout -------------------------------- */
.artwork-detail {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

/* ---- Artwork canvas (image + pins) ------------------------ */
.artwork-canvas {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.artwork-canvas img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* ---- Comment pins ----------------------------------------- */
.pin {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 10;
  cursor: pointer;
}
.pin-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color);
  border: 2.5px solid #fff;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  transition: background .15s;
}
.pin:hover .pin-dot { background: #ff7070; }
.pin-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1c1a18;
  color: #f0ede8;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  font-size: .78rem;
  width: 185px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  pointer-events: none;
  z-index: 20;
  line-height: 1.45;
}
.pin-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1c1a18;
}
.pin-tooltip strong { display: block; margin-bottom: .2rem; color: var(--accent-light); font-size: .8rem; }
.pin:hover .pin-tooltip { display: block; }

/* ---- Pin comment form (modal overlay) --------------------- */
.pin-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.pin-modal-bg.active { display: flex; }
.pin-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(420px, 92vw);
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
}
.pin-modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; }
.pin-modal p.hint { font-size: .78rem; color: var(--text-muted); margin-bottom: .85rem; }
.pin-modal textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  resize: vertical;
  min-height: 80px;
  font-size: .875rem;
  margin-bottom: .85rem;
  transition: border-color .15s;
}
.pin-modal textarea:focus { outline: none; border-color: var(--accent); }
.pin-modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ---- Artwork sidebar info --------------------------------- */
.artwork-info {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.artwork-info h1 { font-size: 1.35rem; font-weight: 700; line-height: 1.3; margin-bottom: .2rem; }
.artwork-info .artist { color: var(--accent); font-size: .95rem; font-weight: 500; margin-bottom: 1rem; }
.artwork-meta { list-style: none; font-size: .84rem; }
.artwork-meta li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.artwork-meta li:last-child { border-bottom: none; }
.artwork-meta .label { color: var(--text-muted); flex-shrink: 0; }
.artwork-meta .value { font-weight: 500; text-align: right; }
.artwork-desc {
  margin-top: 1rem;
  font-size: .84rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.artwork-tags { margin-top: .85rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  display: inline-block;
  padding: .2rem .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .72rem;
  color: var(--text-muted);
}
.comment-hint {
  margin-top: 1rem;
  padding: .7rem .9rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-size: .8rem;
  color: #78540a;
  line-height: 1.45;
}

/* ---- Comments list --------------------------------------- */
.comments-section {
  margin-top: 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.comments-section h3 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.comment-item { padding: .75rem 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.comment-item:last-child { border-bottom: none; }
.comment-user { font-weight: 600; color: var(--accent); font-size: .78rem; margin-bottom: .2rem; }
.comment-text { line-height: 1.55; }
.no-comments {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ---- Auth page ------------------------------------------- */
.auth-page { max-width: 420px; margin: 0 auto; }
.auth-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: .6rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-card { background: var(--surface); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 1.15rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .84rem; font-weight: 500; margin-bottom: .35rem; }
.form-group input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .8rem;
  font-size: .875rem;
  transition: border-color .15s;
}
.form-group input:focus { outline: none; border-color: var(--accent); }
.form-hint { font-size: .77rem; color: var(--text-muted); margin-top: .25rem; }

/* ---- Artists / Museums list ------------------------------ */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 1rem;
}
.list-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.list-item:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.list-item .name  { font-weight: 600; font-size: .9rem; }
.list-item .count { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ---- Profile page ---------------------------------------- */
.profile-header {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-info h2 { font-size: 1.15rem; font-weight: 700; }
.profile-info p  { font-size: .83rem; color: var(--text-muted); }

.contribution-list { display: flex; flex-direction: column; gap: 1rem; }
.contribution-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: .75rem 1rem;
  align-items: start;
}
.contribution-thumb { width: 72px; height: 56px; border-radius: 4px; object-fit: cover; }
.contribution-artwork { font-weight: 600; font-size: .9rem; }
.contribution-meta   { font-size: .78rem; color: var(--text-muted); margin: .2rem 0 .5rem; }
.contribution-text   {
  font-size: .83rem;
  border-left: 3px solid var(--accent);
  padding-left: .7rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- Moderation table ------------------------------------ */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge--pending  { background: #fef3c7; color: #92400e; }
.badge--approved { background: #d1fae5; color: #065f46; }
.badge--rejected { background: #fee2e2; color: #7f1d1d; }
.table-actions   { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---- Filters --------------------------------------------- */
.filters { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select {
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  background: var(--surface);
  transition: border-color .15s;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); }

/* ---- Footer ---------------------------------------------- */
.footer {
  background: #1c1a18;
  color: rgba(240,237,232,.55);
  padding: 1.5rem 0;
  font-size: .8rem;
  text-align: center;
  margin-top: auto;
}
.footer a { color: var(--accent-light); }

/* ---- Empty state ----------------------------------------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty h3 { font-size: 1.05rem; margin-bottom: .5rem; font-weight: 600; }
.empty p  { font-size: .875rem; }

/* ---- 404 ------------------------------------------------- */
.not-found { text-align: center; padding: 4rem 1rem; }
.not-found .code { font-size: 6rem; font-weight: 800; color: var(--border); line-height: 1; }
.not-found h2 { font-size: 1.4rem; margin-bottom: .6rem; }
.not-found p  { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 860px) {
  .artwork-detail { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav__links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    z-index: 99;
  }
  .nav__links.open { display: flex; }
  .nav__toggle     { display: block; }
  .nav__auth       { display: none; }
  .nav__auth.open  { display: flex; position: absolute; top: 120px; right: 1rem; flex-direction: column; }

  .hero { padding: 3rem 0; margin-bottom: 2rem; }
  .hero__stats { gap: 1.5rem; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 1rem; }
  .list-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .contribution-card { grid-template-columns: 1fr; }
  .contribution-thumb { display: none; }
}

/* ---- Timeline -------------------------------------------- */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}
.timeline__item {
  position: relative;
  margin-bottom: 4rem;
  width: 50%;
  padding: 0 2.5rem;
}
.timeline__item:nth-child(odd) { left: 0; text-align: right; }
.timeline__item:nth-child(even) { left: 50%; text-align: left; }

.timeline__dot {
  position: absolute;
  top: 10px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border: 4px solid var(--accent);
  border-radius: 50%;
  z-index: 5;
}
.timeline__item:nth-child(odd) .timeline__dot { right: -9px; }
.timeline__item:nth-child(even) .timeline__dot { left: -9px; }

.timeline__year {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: .75rem;
  font-variant-numeric: tabular-nums;
}
.timeline__card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
  text-align: left;
}
.timeline__card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.timeline__img { aspect-ratio: 16 / 10; overflow: hidden; background: #eee; }
.timeline__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.timeline__card:hover .timeline__img img { transform: scale(1.05); }

.timeline__content { padding: 1.5rem; }
.timeline__movement {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  background: rgba(181, 145, 58, 0.1);
  padding: .25rem .6rem;
  border-radius: 4px;
  margin-bottom: .85rem;
}
.timeline__title { font-weight: 700; font-size: 1.15rem; line-height: 1.3; margin-bottom: .35rem; color: var(--text); }
.timeline__artist { color: var(--text-muted); font-weight: 500; font-size: .9rem; margin-bottom: .75rem; }
.timeline__desc { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

@media (max-width: 768px) {
  .timeline::before { left: 20px; }
  .timeline__item { 
    width: 100%; 
    padding-left: 3.5rem; 
    padding-right: 1rem; 
    text-align: left !important; 
    left: 0 !important;
    margin-bottom: 3rem;
  }
  .timeline__dot { left: 11px !important; right: auto !important; }
  .timeline__year { font-size: 1.2rem; }
}

.pagination__pages { display: flex; gap: .4rem; }
