/* Port of src/app/globals.css color/typography scheme (brand navy + gold),
   hand-written (no Tailwind build step) for the Django+HTMX frontend. */
:root {
  --background: #ffffff;
  --foreground: #202122;

  --brand-50: #eef3f8;
  --brand-100: #d7e3f0;
  --brand-200: #aec7e1;
  --brand-300: #82a8d0;
  --brand-400: #4d7cb0;
  --brand-500: #2c5789;
  --brand-600: #1e4066;
  --brand-700: #16324f;
  --brand-800: #0f2439;
  --brand-900: #0a1a29;

  --gold-50: #fbf6ea;
  --gold-100: #f3e6c2;
  --gold-300: #e0bc6f;
  --gold-500: #c2953a;
  --gold-600: #a3792a;
  --gold-700: #82601f;

  --font-serif: "Linux Libertine", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow-x: hidden;
}
img { max-width: 100%; }

a { color: inherit; }
a, button, .like-btn, .btn-primary, .btn-outline, .pill, .profile-card, .sidebar a {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease,
              box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}
.font-serif { font-family: var(--font-serif); }

/* Icons (Lucide) */
i[data-lucide] {
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: -0.15em;
  stroke-width: 2;
}
.icon-filled { fill: currentColor; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .45s ease both; }
.card-grid > * { animation: fadeInUp .4s ease both; }
.card-grid > *:nth-child(1) { animation-delay: .02s; }
.card-grid > *:nth-child(2) { animation-delay: .06s; }
.card-grid > *:nth-child(3) { animation-delay: .1s; }
.card-grid > *:nth-child(4) { animation-delay: .14s; }
.card-grid > *:nth-child(5) { animation-delay: .18s; }
.card-grid > *:nth-child(6) { animation-delay: .22s; }
.card-grid > *:nth-child(7) { animation-delay: .26s; }
.card-grid > *:nth-child(8) { animation-delay: .3s; }

/* Layout */
.site-header {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--brand-100);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
}
.site-header-inner {
  max-width: 1600px; margin: 0 auto; display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1rem;
}
@media (min-width: 640px) { .site-header-inner { padding: .75rem 1.5rem; } }
.menu-toggle {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2.25rem; height: 2.25rem; border: 1px solid #e5e5e5; border-radius: .5rem; background: #fff; color: #404040; cursor: pointer;
}
.menu-toggle i { width: 1.15rem; height: 1.15rem; }
@media (min-width: 900px) { .menu-toggle { display: none; } }
.brand-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; flex-shrink: 0; }
.brand-badge {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px; color: #fff;
  background: #2563eb;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.brand-badge i { width: 1.15rem; height: 1.15rem; }
.brand-name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--brand-800); display: block; }
.brand-tag { font-size: .75rem; color: #a3a3a3; display: none; }
@media (min-width: 480px) { .brand-tag { display: block; } }

.search-form { flex: 1; min-width: 0; display: none; }
@media (min-width: 700px) { .search-form { display: block; } }
.search-form .wrap { position: relative; max-width: 28rem; margin: 0 auto; }
.search-form input {
  width: 100%; border-radius: 999px; border: 1px solid #d4d4d4; background: #fafafa;
  padding: .4rem 2.4rem .4rem 1rem; font-size: .875rem;
}
.search-form input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); background: #fff; }
.search-form button {
  position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; border-radius: 999px; padding: .35rem; cursor: pointer; color: #737373;
}
.search-icon-link {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; margin-left: auto; border-radius: 999px; color: #737373; flex-shrink: 0;
}
.search-icon-link i { width: 1.15rem; height: 1.15rem; }
@media (min-width: 700px) { .search-icon-link { display: none; } }
.user-name-label { display: none; }
@media (min-width: 640px) { .user-name-label { display: inline; } }
.site-header-inner .btn-outline { padding: .45rem .65rem; font-size: .8rem; white-space: nowrap; }
@media (min-width: 640px) { .site-header-inner .btn-outline { padding: .5rem 1rem; font-size: .875rem; } }
.search-form button:hover { color: var(--brand-600); background: var(--brand-50); }

.site-body { max-width: 1600px; margin: 0 auto; display: flex; gap: 2rem; flex: 1; width: 100%; padding: 1rem; }
@media (min-width: 640px) { .site-body { padding: 1.5rem; } }
.sidebar {
  flex-shrink: 0; width: 220px; flex-direction: column; gap: 1.5rem;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 40;
  background: #fff; padding: 4.5rem 1rem 1.5rem; box-shadow: 4px 0 20px rgba(0,0,0,.1);
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); display: flex; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,36,57,.4); z-index: 30;
}
.sidebar-backdrop.open { display: block; }
@media (min-width: 900px) {
  .sidebar { display: flex; position: sticky; top: 5rem; left: auto; height: auto; width: 200px;
    transform: none; box-shadow: none; padding: 0; background: transparent; align-self: flex-start; }
  .sidebar-backdrop { display: none !important; }
}
.sidebar-group { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-heading { margin: 0 0 .4rem .5rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #a3a3a3; }
.sidebar a { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; font-size: .875rem; font-weight: 500; color: #404040; text-decoration: none; border-radius: .5rem; border: 1px solid transparent; transition: background-color .15s, color .15s, transform .15s; }
.sidebar a i { width: 1rem; height: 1rem; color: var(--brand-500); }
.sidebar a:hover { background: var(--brand-50); color: var(--brand-800); transform: translateX(2px); }
.sidebar a:hover i { color: var(--brand-600); }
.sidebar a.active { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.sidebar a.active i { color: #2563eb; }
.sidebar hr { border: none; border-top: 1px solid #e5e5e5; margin: .75rem .25rem; }

main { min-width: 0; flex: 1; border-left: 1px solid transparent; }
@media (min-width: 900px) { main { border-left: 1px solid #e5e5e5; padding-left: 2rem; } }

.site-footer { border-top: 1px solid #e5e5e5; text-align: center; padding: 1.5rem; font-size: .875rem; color: #a3a3a3; }

/* Buttons / forms */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: .5rem; background: #2563eb; color: #fff; padding: .6rem 1.25rem;
  font-weight: 600; font-size: .9rem; border: none; cursor: pointer; text-decoration: none;
}
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 2px 8px rgba(0,0,0,.08); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-primary i { width: 1rem; height: 1rem; }

.btn-outline {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: .5rem; border: 1px solid #d4d4d4;
  padding: .5rem 1rem; font-size: .875rem; background: #fff; text-decoration: none; color: #404040; cursor: pointer;
}
.btn-outline:hover { border-color: var(--brand-300); color: var(--brand-700); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.btn-outline i { width: 1rem; height: 1rem; }

.form-input {
  width: 100%; border-radius: .5rem; border: 1px solid #d1d5db; background: #fff;
  padding: .55rem .75rem; font-size: .9rem;
}
.form-label { display: flex; align-items: center; gap: .375rem; margin-bottom: .35rem; font-size: .875rem; font-weight: 500; color: var(--brand-700); }
.form-field { margin-bottom: 1rem; }

.profile-form-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 1024px) { .profile-form-grid { grid-template-columns: 1fr 320px; } }
.form-aside {
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: .75rem; padding: 1.25rem;
  align-self: start;
}
@media (min-width: 1024px) { .form-aside { position: sticky; top: 5rem; } }
.form-aside-heading {
  text-transform: uppercase; font-size: .75rem; font-weight: 700; letter-spacing: .03em;
  color: var(--brand-700); margin: 0 0 1rem;
}
.form-label i { width: .9rem; height: .9rem; }
.wiki-editor-help { margin: 0 0 .4rem; font-size: .8rem; color: #737373; }
.wiki-editor-help code { background: #f5f5f5; border-radius: .25rem; padding: .05rem .3rem; font-size: .78rem; }

/* Wikitext editor toolbar */
.wiki-editor { border: 1px solid #d4d4d4; border-radius: .5rem; overflow: hidden; }
.wiki-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem; background: #f5f5f5; border-bottom: 1px solid #e5e5e5; padding: .35rem .4rem; }
.wiki-toolbar button {
  display: inline-flex; align-items: center; gap: .3rem; height: 2rem; min-width: 2rem; padding: 0 .45rem;
  border: none; background: transparent; border-radius: .35rem; color: #404040; cursor: pointer; font-size: .78rem;
}
.wiki-toolbar button:hover { background: #e5e5e5; }
.wiki-toolbar button i { width: .95rem; height: .95rem; }
.wiki-toolbar-sep { width: 1px; height: 1.25rem; background: #d4d4d4; margin: 0 .3rem; }
.wiki-editor-textarea {
  width: 100%; border: none; resize: vertical; padding: .8rem 1rem; font-family: ui-monospace, monospace;
  font-size: .85rem; line-height: 1.6; color: #262626;
}
.wiki-editor-textarea:focus { outline: none; }
.wiki-toolbar-spacer { flex: 1; }
.wiki-mode-toggle {
  border: 1px solid var(--brand-200) !important; background: #fff !important; color: var(--brand-700) !important;
  font-weight: 500;
}
.wiki-mode-toggle:hover { background: var(--brand-50) !important; }
.wiki-visual-editor {
  width: 100%; min-height: 20rem; padding: .8rem 1rem; font-size: .9rem; line-height: 1.7; color: #262626;
}
.wiki-visual-editor:focus { outline: none; }
.wiki-visual-editor h2 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; margin: 1rem 0 .4rem; }
.wiki-visual-editor h3 { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; margin: .85rem 0 .35rem; }
.wiki-visual-editor h4 { font-family: var(--font-serif); font-size: 1rem; font-weight: 600; margin: .75rem 0 .3rem; }
.wiki-visual-editor p { margin: 0 0 .7em; }
.wiki-visual-editor ul { margin: 0 0 .7em 1.25rem; }
.wiki-editor-footer { margin: 0; padding: .4rem .8rem; font-size: .75rem; color: #a3a3a3; background: #fafafa; border-top: 1px solid #e5e5e5; }
.wiki-editor-footer code { background: #f5f5f5; border-radius: .25rem; padding: .05rem .3rem; }

/* Image uploader */
.image-uploader-preview { position: relative; display: inline-block; }
.image-uploader-preview img { width: 8rem; height: 8rem; border-radius: .6rem; border: 1px solid #e5e5e5; object-fit: cover; display: block; }
.image-uploader-remove {
  position: absolute; top: -.5rem; right: -.5rem; width: 1.5rem; height: 1.5rem; border-radius: 999px;
  background: #fff; border: 1px solid #e5e5e5; box-shadow: 0 1px 3px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center; color: #737373; cursor: pointer;
}
.image-uploader-remove:hover { color: #dc2626; }
.image-uploader-remove i { width: .8rem; height: .8rem; }
.image-uploader-empty {
  width: 8rem; height: 8rem; border-radius: .6rem; border: 1px dashed #d4d4d4; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  color: #a3a3a3; cursor: pointer; font-size: .75rem;
}
.image-uploader-empty:hover { border-color: var(--brand-400); color: var(--brand-600); }
.image-uploader-empty i { width: 1.4rem; height: 1.4rem; }
.image-uploader-empty.uploading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.image-uploader-error { margin: .4rem 0 0; font-size: .75rem; color: #dc2626; }

/* Color picker */
.color-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.color-swatch {
  width: 1.75rem; height: 1.75rem; border-radius: 999px; border: 1px solid #d4d4d4; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #262626; padding: 0;
}
.color-swatch i, .color-swatch svg { width: .8rem; height: .8rem; display: none; }
.color-swatch.selected i, .color-swatch.selected svg { display: block; }

/* Custom prompt modal (replaces native window.prompt) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,36,57,.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
  animation: fadeInUp .15s ease both;
}
.modal-box {
  width: 100%; max-width: 26rem; background: #fff; border-radius: 1rem; padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; color: var(--brand-900); margin: 0 0 1rem; }
.modal-input {
  width: 100%; border-radius: .5rem; border: 1px solid #d1d5db; background: #fff;
  padding: .6rem .8rem; font-size: .9rem; margin-bottom: 1.25rem;
}
.modal-input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }

/* Row editor (infobox facts / social links) */
.row-editor-rows { display: flex; flex-direction: column; gap: .35rem; border: 1px solid #e5e5e5; border-radius: .5rem; background: #fff; padding: .5rem; }
.row-editor-empty { padding: .25rem .3rem; font-size: .75rem; color: #a3a3a3; margin: 0; }
.row-editor-row, .row-editor-group { display: flex; align-items: center; gap: .4rem; }
.row-editor-row i.grip, .row-editor-group i.grip { width: .8rem; height: .8rem; color: #d4d4d4; flex-shrink: 0; }
.row-editor-row input, .row-editor-group input {
  border: 1px solid #d4d4d4; border-radius: .4rem; padding: .35rem .55rem; font-size: .8rem; background: #fff;
}
.row-editor-row input.label-input { width: 40%; }
.row-editor-row input.value-input { width: 60%; }
.row-editor-group { background: rgba(232,223,192,.35); border-radius: .4rem; padding: .3rem; }
.row-editor-group input { width: 100%; font-weight: 600; }
.row-editor-remove { flex-shrink: 0; background: none; border: none; color: #a3a3a3; cursor: pointer; padding: .2rem; display: flex; }
.row-editor-remove:hover { color: #dc2626; }
.row-editor-remove i { width: .85rem; height: .85rem; }
.row-editor-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.row-editor-add {
  display: inline-flex; align-items: center; gap: .3rem; border: 1px solid #d4d4d4; border-radius: .4rem;
  padding: .3rem .6rem; font-size: .75rem; color: #525252; background: #fff; cursor: pointer;
}
.row-editor-add:hover { background: #fafafa; border-color: var(--brand-300); color: var(--brand-700); }
.row-editor-add i { width: .8rem; height: .8rem; }

/* Category picker */
.category-picker { border: 1px solid #e5e5e5; border-radius: .5rem; background: #fff; padding: .5rem; }
.category-picker-search { position: relative; margin-bottom: .5rem; }
.category-picker-search i { position: absolute; left: .5rem; top: 50%; transform: translateY(-50%); width: .8rem; height: .8rem; color: #d4d4d4; }
.category-picker-search input { width: 100%; border: 1px solid #e5e5e5; border-radius: .4rem; padding: .3rem .5rem .3rem 1.6rem; font-size: .78rem; }
.category-picker-list { max-height: 13rem; overflow-y: auto; display: flex; flex-direction: column; gap: .1rem; }
.category-picker-row { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .2rem .3rem; border-radius: .35rem; }
.category-picker-row:hover { background: #fafafa; }
.category-picker-row label { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: #404040; cursor: pointer; }
.category-picker-remove { flex-shrink: 0; background: none; border: none; color: #d4d4d4; cursor: pointer; padding: .15rem; display: flex; opacity: 0; transition: opacity .15s, color .15s; }
.category-picker-row:hover .category-picker-remove { opacity: 1; }
.category-picker-remove:hover { color: #dc2626; }
.category-picker-remove i { width: .78rem; height: .78rem; }
.category-picker-empty { font-size: .75rem; color: #a3a3a3; padding: .25rem .3rem; margin: 0; }
.category-picker-add { display: flex; gap: .35rem; border-top: 1px solid #f0f0f0; padding-top: .5rem; margin-top: .4rem; }
.category-picker-add input { flex: 1; min-width: 0; border: 1px solid #d4d4d4; border-radius: .4rem; padding: .3rem .5rem; font-size: .78rem; }
.category-picker-error { margin: .4rem 0 0; font-size: .75rem; color: #dc2626; }

/* Ariza (application) page */
.ariza-header-badge {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2.75rem; height: 2.75rem; border-radius: .6rem; background: var(--brand-700); color: #fff;
  box-shadow: 0 4px 10px rgba(15,36,57,.2);
}
.ariza-header-badge i { width: 1.25rem; height: 1.25rem; }
.success-icon-circle {
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem;
  width: 3.5rem; height: 3.5rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-600);
  animation: fadeInUp .4s cubic-bezier(.34,1.56,.64,1) both;
}
.success-icon-circle i { width: 1.75rem; height: 1.75rem; }

/* Gazette list */
.gazette-week-heading {
  display: flex; align-items: center; gap: .4rem; margin: 0 0 .6rem;
  font-size: .8rem; font-weight: 600; color: #a3a3a3; text-transform: uppercase; letter-spacing: .03em;
}
.gazette-week-heading i { width: .85rem; height: .85rem; }
.gazette-list-item {
  display: block; text-decoration: none; color: inherit; padding: .9rem 1rem; border-radius: .75rem;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, transform .15s;
  animation: fadeInUp .4s ease both;
}
.gazette-list-item:hover { background: var(--brand-50); border-color: var(--brand-100); transform: translateX(2px); }
.gazette-list-title { color: #0645ad; font-size: 1.1rem; font-weight: 600; margin: 0; }
.gazette-list-item:hover .gazette-list-title { text-decoration: underline; }
.gazette-list-excerpt {
  margin: .3rem 0 0; color: #525252; font-size: .9rem; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.gazette-list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: .5rem; font-size: .75rem; color: #a3a3a3; }
.gazette-list-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.gazette-list-meta i { width: .8rem; height: .8rem; }
.error-text { color: #dc2626; font-size: .875rem; margin: .5rem 0; }
.help-text { color: #737373; font-size: .8rem; margin: .25rem 0 .5rem; }

/* Pills / categories */
.pill {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; border: 1px solid #e5e5e5;
  padding: .35rem .8rem; font-size: .875rem; font-weight: 500; text-decoration: none; color: var(--brand-800); background: #fff;
}
.pill.active { border-color: #2563eb; background: #2563eb; color: #fff; }

.page-nav-btn {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; border: 1px solid #bfdbfe;
  padding: .5rem 1rem; font-size: .875rem; font-weight: 500; color: #1d4ed8; background: #fff;
  text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.page-nav-btn i { width: 1rem; height: 1rem; }
.page-nav-btn:hover { border-color: #93c5fd; background: #eff6ff; box-shadow: 0 4px 10px rgba(0,0,0,.06); transform: translateY(-1px); }
.page-nav-btn.disabled { pointer-events: none; border-color: #e5e5e5; color: #d4d4d4; box-shadow: none; }
.page-badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: .5rem 1.1rem; font-size: .875rem; font-weight: 700;
  color: #fff; background: linear-gradient(90deg, #2563eb, #3b82f6); box-shadow: 0 2px 8px rgba(37,99,235,.25);
}

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }
.profile-card {
  display: flex; align-items: center; gap: .75rem; border: 1px solid #e5e5e5; border-radius: .8rem;
  padding: .75rem; text-decoration: none; color: inherit; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.profile-card:hover { border-color: var(--brand-200); box-shadow: 0 8px 20px rgba(15,36,57,.1); transform: translateY(-2px); }
.avatar-round {
  width: 3rem; height: 3rem; border-radius: 999px; overflow: hidden; flex-shrink: 0;
  background: var(--brand-100);
  display: flex; align-items: center; justify-content: center; color: var(--brand-400);
}
.avatar-round img { width: 100%; height: 100%; object-fit: cover; }
.avatar-round i { width: 1.4rem; height: 1.4rem; }

.photo-card {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 1rem; border: 1px solid #ebebeb;
  background: #fff; text-decoration: none; color: inherit;
  box-shadow: 0 1px 4px rgba(15,36,57,.05); transition: transform .25s, box-shadow .25s, border-color .25s;
}
.photo-card:hover { border-color: var(--brand-200); box-shadow: 0 12px 24px rgba(15,36,57,.12); transform: translateY(-3px); }
.photo-card-img { aspect-ratio: 1 / 1; width: 100%; overflow: hidden; background: linear-gradient(160deg, var(--brand-50), #f0f0f0); display: flex; align-items: center; justify-content: center; color: #c9ccd1; flex-shrink: 0; }
.photo-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.photo-card:hover .photo-card-img img { transform: scale(1.08); }
.photo-card-img i { width: 2rem; height: 2rem; }
.photo-card-body { padding: .85rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; }
.photo-card-name {
  display: block; font-weight: 700; font-size: .9rem; color: var(--brand-900); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-card-headline {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  margin-top: .3rem; font-size: .78rem; line-height: 1.4; color: #8a8f98;
}

/* Marquee rows (opposite-direction auto-scroll) */
@keyframes marquee-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes marquee-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.marquee-row {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
  mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
}
.marquee-track { display: flex; width: max-content; gap: 1rem; }
.marquee-track-left { animation: marquee-left 32s linear infinite; }
.marquee-track-right { animation: marquee-right 32s linear infinite; }
.marquee-row:hover .marquee-track { animation-play-state: paused; }
.marquee-track .photo-card { width: 12rem; flex-shrink: 0; }
@media (min-width: 640px) { .marquee-track .photo-card { width: 14rem; } }
@media (prefers-reduced-motion: reduce) { .marquee-track-left, .marquee-track-right { animation: none; } }

/* Animated gradient backgrounds */
.animated-gradient-blue {
  background: linear-gradient(120deg, #eaf1fb 0%, #dce8fb 30%, #f0f6ff 60%, #e4edfb 100%);
  background-size: 260% 260%;
  animation: gradient-shift 12s ease infinite;
}
.animated-gradient-gold {
  background: linear-gradient(120deg, var(--gold-50) 0%, #fdf3e1 30%, #fff8ea 60%, var(--gold-50) 100%);
  background-size: 260% 260%;
  animation: gradient-shift 12s ease infinite;
}
.animated-gradient-hero {
  background: linear-gradient(120deg, var(--brand-50) 0%, #eaf1fb 20%, var(--gold-50) 45%, #eef6ff 70%, var(--brand-50) 100%);
  background-size: 300% 300%;
  animation: gradient-shift 14s ease infinite;
}
@media (prefers-reduced-motion: reduce) { .animated-gradient-blue, .animated-gradient-gold, .animated-gradient-hero { animation: none; } }

/* Search page */
.search-hero { position: relative; overflow: hidden; border: 1px solid var(--brand-100); border-radius: 1rem; padding: 1.75rem; margin-bottom: 2rem; }
.search-hero-blob { position: absolute; border-radius: 999px; pointer-events: none; filter: blur(28px); }
.search-hero-blob-1 { top: -4rem; right: -4rem; width: 14rem; height: 14rem; background: rgba(243,230,194,.5); }
.search-hero-blob-2 { bottom: -4rem; left: -2.5rem; width: 12rem; height: 12rem; background: rgba(215,227,240,.5); }
.search-input-wrap { position: relative; }
.search-input-wrap i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 1.1rem; height: 1.1rem; color: var(--brand-400); pointer-events: none; }
.search-input-wrap input {
  width: 100%; border-radius: .75rem; border: 1px solid var(--brand-100); background: rgba(255,255,255,.95);
  padding: .8rem 1rem .8rem 2.6rem; font-size: .9rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); transition: box-shadow .15s, border-color .15s;
}
.search-input-wrap input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); }

.result-section { border: 1px solid #e5e5e5; border-radius: 1rem; padding: 1.25rem; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.03); margin-bottom: 1.5rem; }
.result-section h2 { display: flex; align-items: center; gap: .45rem; font-size: 1.1rem; font-weight: 500; color: var(--brand-800); margin-bottom: 1rem; }
.result-section h2 i { width: 1.05rem; height: 1.05rem; }
.result-row {
  display: flex; align-items: center; gap: .75rem; border: 1px solid #e5e5e5; border-radius: .75rem;
  padding: .7rem .8rem; text-decoration: none; color: inherit; margin-bottom: .5rem;
  transition: transform .15s, box-shadow .15s, border-color .15s; animation: fadeInUp .4s ease both;
}
.result-row:hover { border-color: var(--brand-200); box-shadow: 0 4px 12px rgba(15,36,57,.08); transform: translateY(-1px); }
.result-row:last-child { margin-bottom: 0; }
.result-icon { width: 2.25rem; height: 2.25rem; flex-shrink: 0; border-radius: 999px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-400); }
.result-icon img { width: 100%; height: 100%; object-fit: cover; }
.result-icon.gold { background: var(--gold-50); color: var(--gold-600, #b45309); }
.result-title { display: block; font-weight: 500; color: var(--brand-800); }
.result-sub { display: block; font-size: .85rem; color: #737373; }
.result-row .arrow-icon { margin-left: auto; width: 1rem; height: 1rem; color: #d4d4d4; transition: transform .15s, color .15s; flex-shrink: 0; }
.result-row:hover .arrow-icon { transform: translateX(3px); color: var(--brand-500); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 0; text-align: center; }
.empty-state span { width: 3rem; height: 3rem; border-radius: 999px; background: #f5f5f5; color: #d4d4d4; display: flex; align-items: center; justify-content: center; }
.empty-state p { font-size: .9rem; color: #737373; margin: 0; }

/* Wiki article rendering */
.wiki-page { font-family: sans-serif, Arial, Helvetica; color: #202122; }
.wiki-layout { display: flex; flex-direction: column-reverse; gap: 1.5rem; }
@media (min-width: 768px) { .wiki-layout { flex-direction: row; align-items: flex-start; } .wiki-body { flex: 1; min-width: 0; } }
.wiki-body p { margin-bottom: .6em; line-height: 1.6; }
.wiki-body ul { margin: 0 0 .75em 1.25rem; }
.wiki-body h3 { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; margin: 1rem 0 .4rem; }
.wiki-body h4 { font-family: var(--font-serif); font-size: 1rem; font-weight: 600; margin: .85rem 0 .35rem; }
.wiki-body a { color: #0645ad; text-decoration: none; }
.wiki-body a:hover { text-decoration: underline; }
.wiki-quote { margin: .75em 0; padding: .6em 1em; border-left: 3px solid var(--brand-300); background: var(--brand-50); font-style: italic; color: var(--brand-800); }
.wiki-quote footer { margin-top: .35em; font-style: normal; font-size: .8em; color: #54595d; }
.wiki-clearfix::after { content: ""; display: table; clear: both; }
.wiki-float-chap { float: left; margin: 0 1rem .5rem 0; }
.wiki-float-ong { float: right; margin: 0 0 .5rem 1rem; }
.wiki-thumb { width: 11rem; max-width: 42vw; border: 1px solid #c8ccd1; background: #f8f9fa; padding: 3px; }
@media (min-width: 640px) { .wiki-thumb { width: 14rem; max-width: none; } }
.wiki-thumb.wiki-thumb-video { width: 14rem; max-width: 60vw; }
@media (min-width: 640px) { .wiki-thumb.wiki-thumb-video { width: 16rem; max-width: none; } }
.wiki-thumb img { display: block; width: 100%; }
.wiki-thumb figcaption { padding: .25rem .2rem .1rem; font-size: .8rem; line-height: 1.4; color: #202122; text-align: left; }
.wiki-video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.wiki-video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.wiki-cite { font-size: .75em; }
.wiki-cite a { color: #0645ad; text-decoration: none; }
.wiki-references { font-size: .8125rem; line-height: 1.5; counter-reset: wiki-ref; }
.wiki-references li { counter-increment: wiki-ref; padding-left: 1.6em; text-indent: -1.6em; margin-bottom: .35rem; }
.wiki-ref-back { color: #0645ad; text-decoration: none; margin-right: .15em; }

.infobox { width: 100%; border: 1px solid #a2a9b1; background: #f8f9fa; font-size: .875rem; color: #202122; }
@media (min-width: 768px) { .infobox { width: 280px; flex-shrink: 0; } }
.infobox-title { padding: .5rem .6rem; text-align: center; font-weight: 700; font-size: 1.15rem; border-bottom: 1px solid #a2a9b1; }
.infobox-image { padding: 0; text-align: center; background: #fff; }
.infobox-image img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.infobox-image-placeholder { height: 160px; display: flex; align-items: center; justify-content: center; background: #eaecf0; color: #72777d; }
.infobox-image-placeholder i { width: 3rem; height: 3rem; }
.infobox-caption { padding: .35rem .6rem; text-align: center; font-size: .8rem; font-style: italic; background: #fff; border-bottom: 1px solid #a2a9b1; }
.infobox-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.infobox-table th, .infobox-table td { padding: .4rem .6rem; vertical-align: top; border-top: 1px solid #eaecf0; text-align: left; word-break: break-word; }
.infobox-table th { width: 42%; font-weight: 600; }
.infobox-table tr:nth-child(even) { background: #eaecf0; }
.infobox-subheader { background: #e8dfc0; text-align: center; font-weight: 700; padding: .35rem .5rem; border-top: 1px solid #a2a9b1; border-bottom: 1px solid #a2a9b1; }

/* Comments / likes */
.like-btn {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; border: 1px solid #d4d4d4;
  padding: .35rem .8rem; font-size: .875rem; background: #fff; cursor: pointer; color: #525252; text-decoration: none;
}
.like-btn i { width: .95rem; height: .95rem; }
.like-btn:hover { border-color: #fca5a5; color: #dc2626; transform: scale(1.04); }
.like-btn.liked { border-color: #fca5a5; background: #fef2f2; color: #dc2626; }
.like-btn.liked i { fill: currentColor; }
.comment-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.comment-list li { display: flex; gap: .75rem; border-bottom: 1px solid #f5f5f5; padding-bottom: 1rem; margin-bottom: 1rem; }
.comment-avatar { width: 2rem; height: 2rem; border-radius: 999px; background: #e5e5e5; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 500; flex-shrink: 0; }
.comment-form textarea { width: 100%; border: none; resize: vertical; min-height: 2.5rem; font-size: .875rem; padding: .5rem; }
.comment-form { border: 1px solid #e5e5e5; border-radius: .8rem; padding: .5rem; margin-top: 1rem; }

.alert { border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; padding: .6rem .8rem; font-size: .875rem; margin-bottom: 1rem; }
.alert-error { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }

.tag-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid var(--gold-300); background: var(--gold-50); color: var(--gold-700);
  padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.tag-badge i { width: .8rem; height: .8rem; }

.panel-card {
  border: 1px solid #e5e5e5; border-radius: 1.25rem; padding: 1.5rem; background: #fff;
  box-shadow: 0 2px 8px rgba(15,36,57,.04); transition: box-shadow .2s, transform .2s;
}

.hero-card {
  display: block; border: 1px solid var(--gold-300); border-radius: 1.25rem; overflow: hidden;
  text-decoration: none; color: inherit; margin: 1rem 0; background: #fff;
  box-shadow: 0 2px 10px rgba(180,131,20,.06); transition: box-shadow .25s, transform .25s;
}
.hero-card:hover { box-shadow: 0 10px 26px rgba(180,131,20,.14); transform: translateY(-3px); }
.hero-card-row { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 14rem; }
.hero-card-img { width: 100%; flex-shrink: 0; border-radius: 0; background: #fff; align-self: stretch; aspect-ratio: 16 / 9; max-height: 12rem; }
@media (min-width: 640px) { .hero-card-img { width: 16rem; max-height: none; aspect-ratio: auto; } .hero-card-row { min-height: 14rem; } }

.gazette-panel { display: flex; flex-direction: column; border-color: var(--brand-100); }
.gazette-heading {
  display: flex; align-items: center; gap: .5rem; margin: 0 0 1.1rem;
  text-transform: uppercase; font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--brand-700);
}
.gazette-heading i {
  width: 1.9rem; height: 1.9rem; padding: .4rem; box-sizing: border-box; border-radius: 999px;
  background: var(--brand-100); color: var(--brand-600); flex-shrink: 0;
}
.gazette-list { list-style: none; margin: 0 0 1.1rem; padding: 0; display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.gazette-list li { border-bottom: 1px solid rgba(37,99,235,.08); }
.gazette-list li:last-child { border-bottom: none; }
.gazette-item {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .1rem;
  color: var(--brand-800); text-decoration: none; border-radius: .5rem; transition: background-color .15s, transform .15s;
}
.gazette-item:hover { background: var(--brand-50); transform: translateX(2px); }
.gazette-item:hover .gazette-item-title { color: var(--brand-600); }
.gazette-thumb {
  width: 2.75rem; height: 2.75rem; flex-shrink: 0; border-radius: .6rem; overflow: hidden;
  background: var(--brand-50); display: flex; align-items: center; justify-content: center; color: var(--brand-300);
}
.gazette-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gazette-thumb-empty i { width: 1.1rem; height: 1.1rem; }
.gazette-item-title { font-weight: 500; font-size: .9rem; line-height: 1.3; transition: color .15s; }
.gazette-more {
  margin-top: auto; padding-top: .9rem; border-top: 1px solid var(--brand-100);
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 600; color: var(--brand-600); text-decoration: none;
}
.gazette-more i { width: .8rem; height: .8rem; transition: transform .15s; }
.gazette-more:hover { color: var(--brand-800); }
.gazette-more:hover i { transform: translateX(2px); }
.hero-card .photo-card-img img { transition: transform .5s; }
.hero-card:hover .photo-card-img img { transform: scale(1.05); }

.stats-bar { display: flex; gap: 1.5rem; margin-bottom: .5rem; }
.stat-item { display: flex; align-items: center; gap: .6rem; color: var(--brand-700); }
.stat-item i { width: 1.15rem; height: 1.15rem; color: var(--brand-400); }
.stat-item div { display: flex; flex-direction: column; line-height: 1.1; }
.stat-num { font-weight: 700; font-size: 1.05rem; color: var(--brand-800); }
.stat-label { font-size: .75rem; color: #737373; }

/* Welcome panel (Wikipedia-style homepage hero) */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.welcome-panel {
  position: relative; overflow: hidden; border: 1px solid var(--brand-100); border-radius: 1rem;
  padding: 1.75rem; margin-bottom: 1.5rem;
  background: linear-gradient(120deg, var(--brand-50) 0%, #eaf1fb 20%, var(--gold-50) 45%, #eef6ff 70%, var(--brand-50) 100%);
  background-size: 300% 300%;
  animation: gradient-shift 14s ease infinite;
}
@media (prefers-reduced-motion: reduce) { .welcome-panel { animation: none; } }
.welcome-blob { position: absolute; border-radius: 999px; pointer-events: none; filter: blur(28px); }
.welcome-blob-1 { top: -4rem; right: -4rem; width: 14rem; height: 14rem; background: rgba(243,230,194,.6); }
.welcome-blob-2 { bottom: -5rem; left: -2.5rem; width: 14rem; height: 14rem; background: rgba(215,227,240,.6); }
.welcome-blob-3 { top: -2.5rem; left: 50%; transform: translateX(-50%); width: 10rem; height: 10rem; background: rgba(219,234,254,.5); }
.welcome-grid { position: relative; display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .welcome-grid { grid-template-columns: 1fr auto; } }
.welcome-lede { font-size: .875rem; color: #525252; margin: 0; }
.welcome-lede a { color: #0645ad; text-decoration: none; }
.welcome-lede a:hover { text-decoration: underline; }
.welcome-title { margin: .25rem 0 0; font-size: 1.6rem; font-weight: 600; color: var(--brand-900); }
@media (min-width: 640px) { .welcome-title { font-size: 1.85rem; } }
.welcome-count { margin: .5rem 0 0; font-size: .875rem; color: #525252; }
.welcome-count strong { color: var(--brand-700); }
.welcome-date { margin: 0; font-size: .875rem; color: #737373; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.welcome-categories {
  position: relative; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .25rem 2rem; align-content: start;
}
@media (min-width: 900px) { .welcome-categories { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.welcome-categories a { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: #0645ad; text-decoration: none; padding: .15rem 0; }
.welcome-categories a:hover { text-decoration: underline; color: var(--brand-900); }
.welcome-categories a i { width: .95rem; height: .95rem; color: var(--brand-500); flex-shrink: 0; }
.welcome-categories-all { grid-column: 1 / -1; margin-top: .25rem; font-weight: 500; }

.ai-btn { width:100%; justify-content:center; margin-bottom:.6rem; color:#6d4bd8; border-color:#d9cffa; background:#f6f2ff; }
.ai-btn:hover:not(:disabled) { background:#ece5ff; }
.ai-btn:disabled { opacity:.7; cursor:wait; }
.ai-error { color:#b3261e; font-size:.85rem; margin:0 0 .6rem; }
.art-help { font-size:.8rem; color:#6b7280; margin:0 0 .6rem; }
.art-item { margin-bottom:.8rem; }
.art-result { margin-top:.5rem; }
.art-result img { width:100%; border:1px solid #e5e7eb; border-radius:.5rem; display:block; margin-bottom:.5rem; }
.art-download { display:flex; justify-content:center; align-items:center; gap:.4rem; text-decoration:none; }
.studio-crumbs { font-size:.85rem; color:#6b7280; margin-bottom:1rem; }
.studio-crumbs a { color:inherit; }
.studio-head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; flex-wrap:wrap; margin-bottom:1.5rem; }
.studio-kicker { display:flex; align-items:center; gap:.4rem; text-transform:uppercase; font-size:.75rem; font-weight:600; letter-spacing:.03em; color:#6d4bd8; margin:0 0 .3rem; }
.studio-head h1 { font-weight:400; margin:0; }
.studio-sub { color:#6b7280; margin:.4rem 0 0; max-width:40rem; }
.studio-actions { display:flex; gap:.6rem; flex-wrap:wrap; }
.studio-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(20rem, 1fr)); gap:1.25rem; align-items:start; }
.studio-card { background:#fff; border:1px solid #e5e7eb; border-radius:1rem; padding:1.25rem; box-shadow:0 6px 18px -12px rgba(15,23,42,.3); }
.studio-card-head { display:flex; gap:.8rem; margin-bottom:1rem; }
.studio-card-head h2 { margin:0 0 .15rem; font-size:1.1rem; }
.studio-card-head p { margin:0; color:#6b7280; font-size:.85rem; }
.studio-ico { flex:0 0 2.6rem; height:2.6rem; border-radius:.8rem; background:#f1ecff; color:#6d4bd8; display:flex; align-items:center; justify-content:center; }
.studio-wide { grid-column:1 / -1; }
.tg-posted { display:flex; align-items:center; gap:.4rem; color:#047857; font-size:.9rem; margin:0 0 .8rem; }
.tg-cols { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); gap:1.25rem; margin-top:1rem; align-items:start; }
.tg-cols img { width:100%; border:1px solid #e5e7eb; border-radius:.6rem; display:block; }
.tg-preview { background:#f7f8fa; border:1px solid #e5e7eb; border-radius:.8rem; padding:.9rem 1rem; font-size:.92rem; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.tg-preview blockquote { margin:.4rem 0; padding:.3rem .7rem; border-left:3px solid #6d4bd8; background:#efeafd; border-radius:.3rem; }
.tg-preview a { color:#2563eb; }
.tg-edit { margin:.7rem 0; }
.tg-edit summary { cursor:pointer; font-size:.85rem; color:#4b5563; }
.tg-edit textarea { width:100%; margin-top:.5rem; font-family:ui-monospace, Consolas, monospace; font-size:.8rem; border:1px solid #d1d5db; border-radius:.5rem; padding:.6rem; }
.tg-buttons { display:flex; gap:.6rem; flex-wrap:wrap; margin-top:.6rem; }
@media (max-width:900px) { .tg-cols { grid-template-columns:1fr; } }
.tg-images { display:grid; grid-template-columns:1fr 1.4fr; gap:.6rem; align-items:start; }
.tg-images img { width:100%; }
