/*
 * Swiss Experimental Archive theme
 * Adapted from the supplied visual foundation and motion specifications.
 * Loaded after the application so it remains the final presentation layer.
 */

:root {
  --ink: #10110f;
  --paper: #f2f2ed;
  --paper-bright: #fafaf5;
  --muted: #6a6c64;
  --line: #bbbdb4;
  --accent: #b8ff28;
  --danger: #e94b40;
  --warning: #e3a72c;
  --success: #287b49;
  --blue: #2456d8;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-hard: 6px 6px 0 var(--ink);
  --shadow-small: 3px 3px 0 var(--ink);

  /* Map the application's legacy tokens onto the new system. */
  --primary-color: var(--accent) !important;
  --secondary-color: var(--ink) !important;
  --bg-color: var(--paper) !important;
  --bg-secondary: var(--paper-bright) !important;
  --bg-tertiary: #e7e7df !important;
  --text-primary: var(--ink) !important;
  --text-secondary: var(--muted) !important;
  --border-color: var(--ink) !important;
  --border-glow: transparent !important;
  --success-color: var(--success) !important;
  --warning-color: var(--warning) !important;
  --error-color: var(--danger) !important;
  --shadow-glow: none !important;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(16, 17, 15, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(16, 17, 15, 0.035) 1px, transparent 1px);
  background-size: min(8.333vw, 120px) 100%, 100% 48px;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: 8px;
  z-index: 1000;
  pointer-events: none;
  background: var(--accent);
  border-right: 2px solid var(--ink);
}

::selection {
  color: var(--ink);
  background: var(--accent);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--paper);
  border-left: 1px solid var(--ink);
}

::-webkit-scrollbar-thumb {
  background: var(--ink);
  border: 2px solid var(--paper);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

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

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

a:hover {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--blue) !important;
  outline-offset: 3px !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 18px;
  z-index: 2000;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  transform: translateY(-160%);
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Shared controls ---------- */

.btn,
.sort-btn,
.tab-btn,
.page-btn,
.action-card,
.tab-item,
.file-input-label,
.back-btn,
.logout-btn,
.toggle-btn {
  min-height: 44px;
  border-radius: 0 !important;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  box-shadow: none;
  overflow: visible;
}

.btn::before {
  content: "";
  position: absolute;
  inset: -2px auto -2px -2px;
  width: 5px;
  background: var(--accent);
  border: 2px solid var(--ink);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--paper-bright);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.btn:hover:not(:disabled)::before {
  opacity: 1;
  transform: translateX(0);
}

.btn:active:not(:disabled) {
  box-shadow: none;
  transform: translate(1px, 1px);
}

.btn-primary {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  color: #fff;
  background: var(--danger);
  border-color: var(--ink);
}

.btn-success {
  color: var(--success);
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  color: #fff;
  background: var(--success);
  border-color: var(--ink);
}

.btn-warning {
  color: #6a4300;
  border-color: var(--warning);
}

.btn-warning:hover:not(:disabled) {
  color: var(--ink);
  background: #f7d06e;
  border-color: var(--ink);
}

.btn:disabled,
.page-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: #deded6;
  border-color: var(--line);
  box-shadow: none;
  opacity: 0.75;
  transform: none;
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  caret-color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: inset 0 0 0 0 var(--accent);
  transition: box-shadow 180ms ease, background-color 180ms ease;
}

textarea.input {
  min-height: 116px;
  line-height: 1.65;
  resize: vertical;
}

.input:hover {
  background: #fff;
}

.input:focus {
  color: var(--ink);
  background: #fff;
  border-color: var(--ink);
  box-shadow: inset 6px 0 0 var(--accent);
  outline: none;
}

.input::placeholder {
  color: #85877f;
}

.form-group {
  position: relative;
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-label::after {
  content: "FIELD";
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.form-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.form-checkbox {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--line);
}

.form-checkbox:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
}

.loading {
  width: 24px;
  height: 24px;
  background: conic-gradient(var(--ink) 0 25%, var(--accent) 25% 50%, var(--line) 50% 100%);
  border: 2px solid var(--ink);
  border-radius: 50%;
  animation: swiss-spin 900ms linear infinite;
}

.loading-container,
.app-loading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.error-message,
.message.error {
  color: #7e1711;
  background: #fff0ee;
  border: 2px solid var(--danger);
}

.message.success {
  color: #15582f;
  background: #e9f8ed;
  border: 2px solid var(--success);
}

.message,
.error-message {
  padding: 12px 14px;
  border-radius: 0;
}

.tag {
  padding: 5px 9px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.tag-primary { background: var(--accent); border-color: var(--ink); color: var(--ink); }
.tag-success { background: #d8f2df; border-color: var(--success); color: #15582f; }
.tag-warning { background: #fae7b8; border-color: var(--warning); color: #6a4300; }
.tag-danger { background: #ffe1de; border-color: var(--danger); color: #7e1711; }

/* ---------- Public shell ---------- */

.app {
  min-height: 100vh;
}

.app > .main-content {
  width: 100%;
  flex: 1;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  color: var(--ink);
  background: rgba(250, 250, 245, 0.96);
  border-bottom: 2px solid var(--ink);
  backdrop-filter: none;
}

.header::before {
  content: "LIVE ARCHIVE";
  position: absolute;
  top: 0;
  right: 18px;
  padding: 2px 8px 3px;
  color: var(--ink);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  background: var(--accent);
  border: solid var(--ink);
  border-width: 0 1px 1px;
}

.header-inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
  max-width: 1280px;
  height: 76px;
  padding: 0 24px;
  margin: 0 auto;
}

.header-left {
  grid-column: 1 / span 5;
  align-items: center;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.logo {
  min-width: 0;
  color: var(--ink);
}

.logo-img {
  max-height: 44px;
  filter: grayscale(1) contrast(1.2);
}

.logo-text {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-text::before {
  content: "PHOTO VOTING / ARCHIVE 001";
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.header-nav {
  grid-column: 7 / span 3;
  align-items: stretch;
  gap: 0;
  border-left: 1px solid var(--line);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 0 16px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-right: 1px solid var(--line);
}

.nav-link::after {
  display: none;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--accent);
}

.header-right {
  grid-column: 11 / span 2;
  align-items: center;
  justify-content: flex-end;
}

.upload-btn {
  width: 100%;
  max-width: 156px;
}

.mobile-menu-btn {
  width: 48px;
  height: 48px;
  padding: 12px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
}

.mobile-menu-btn span {
  height: 2px;
  background: var(--ink);
}

.announcement-bar {
  color: var(--ink);
  background: var(--accent);
  border-bottom: 2px solid var(--ink);
  animation: notice-in 320ms var(--ease-out) both;
}

.announcement-inner {
  max-width: 1280px;
  min-height: 42px;
  padding: 8px 24px;
  margin: 0 auto;
  justify-content: flex-start;
}

.announcement-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  font-size: 14px;
  filter: grayscale(1);
  background: var(--paper-bright);
  border: 1px solid var(--ink);
}

.announcement-text {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.mobile-menu {
  top: 76px;
  gap: 0;
  padding: 0;
  background: var(--paper-bright);
  border: solid var(--ink);
  border-width: 0 0 2px;
  box-shadow: var(--shadow-hard);
}

.mobile-nav-link {
  min-height: 52px;
  padding: 14px 24px;
  color: var(--ink);
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.mobile-nav-link:hover {
  color: var(--ink);
  background: var(--accent);
}

.container {
  width: min(100% - 48px, 1280px);
  max-width: 1280px;
  padding: 0;
  margin-inline: auto;
}

.home-page,
.detail-page,
.upload-page {
  min-height: calc(100vh - 76px);
  padding: clamp(32px, 5vw, 72px) 0 80px;
  animation: page-in 420ms var(--ease-out) both;
}

.toolbar,
.upload-header {
  position: relative;
  display: grid;
  grid-template-columns: 7fr 5fr;
  align-items: end;
  gap: 32px;
  padding: 28px 0 24px;
  margin-bottom: 40px;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.toolbar::before,
.upload-header::before {
  content: "PUBLIC SIGNAL ARCHIVE / 001";
  position: absolute;
  top: 7px;
  left: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.toolbar-left {
  align-items: flex-end;
  gap: 18px;
}

.page-title {
  color: var(--ink);
  font-size: clamp(34px, 5.5vw, 76px);
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.photo-count {
  margin-bottom: 4px;
  padding: 4px 8px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--accent);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.toolbar-right {
  align-self: end;
}

.sort-buttons,
.status-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  border: 2px solid var(--ink);
}

.sort-btn,
.tab-btn {
  min-width: 88px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.1em;
  background: var(--paper-bright);
  border: 0;
  border-right: 1px solid var(--ink);
}

.sort-btn:last-child,
.tab-btn:last-child {
  border-right: 0;
}

.sort-btn:hover,
.tab-btn:hover,
.sort-btn.active,
.tab-btn.active {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: none;
  transform: none;
}

.masonry-grid {
  column-gap: 24px !important;
  counter-reset: archive-card;
}

.photo-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 24px;
  overflow: visible;
  cursor: pointer;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
  break-inside: avoid;
  counter-increment: archive-card;
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: card-in 420ms var(--ease-out) both;
}

.photo-card:nth-child(3n + 2) {
  transform: translateY(12px);
}

.photo-card::before {
  content: "SAMPLE / " counter(archive-card, decimal-leading-zero);
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  padding: 5px 7px;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  background: var(--ink);
  border: 1px solid var(--paper-bright);
}

.photo-card::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 28px;
  height: 8px;
  background: var(--accent);
  border: 2px solid var(--ink);
}

.photo-card:hover,
.photo-card:focus-visible {
  box-shadow: var(--shadow-hard);
  transform: translate(-3px, -3px);
}

.photo-card:nth-child(3n + 2):hover,
.photo-card:nth-child(3n + 2):focus-visible {
  transform: translate(-3px, 9px);
}

.photo-card:active {
  box-shadow: none;
  transform: translate(1px, 1px);
}

.photo-wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper-bright);
}

.photo-image {
  width: 100%;
  height: auto;
  filter: saturate(0.9) contrast(1.02);
  transform: none;
  transition: filter 240ms ease, transform 240ms var(--ease-out);
}

.photo-card:hover .photo-image {
  filter: saturate(1.08) contrast(1.05);
  transform: scale(1.015);
}

.photo-overlay {
  position: static;
  display: block;
  padding: 14px 16px 15px;
  color: var(--ink);
  background: var(--paper-bright);
  border-top: 1px solid var(--ink);
  opacity: 1;
}

.photo-info {
  position: static;
  padding: 0;
}

.photo-title {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: -0.025em;
  text-shadow: none;
}

.photo-stats {
  justify-content: flex-start;
  gap: 16px;
}

.stat {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.stat-icon {
  filter: grayscale(1);
}

.empty-state,
.no-comments {
  padding: 72px 24px;
  color: var(--muted);
  background: var(--paper-bright);
  border: 2px dashed var(--ink);
  border-radius: 0;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  font-size: 26px;
  filter: grayscale(1);
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.empty-state h3 {
  color: var(--ink);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.load-more,
.no-more {
  margin-top: 36px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Photo detail ---------- */

.back-btn {
  display: inline-flex;
  align-items: center;
  margin-bottom: 24px;
  padding: 9px 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.1em;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
}

.back-btn:hover {
  color: var(--ink);
  background: var(--accent);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.detail-content {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 32px;
  align-items: start;
}

.photo-section,
.info-section {
  width: auto;
  flex: none;
}

.photo-section {
  position: sticky;
  top: 132px;
}

.photo-container {
  padding: 12px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: var(--shadow-hard);
}

.photo-container::before {
  content: "VISUAL EVIDENCE / 01";
  display: block;
  padding: 2px 0 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.detail-photo {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border: 1px solid var(--ink);
  border-radius: 0;
}

.info-section {
  padding: 0;
  background: transparent;
  border: 0;
}

.photo-header {
  padding: 24px;
  margin-bottom: 16px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-top-width: 6px;
}

.info-section .photo-title {
  margin-bottom: 14px;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.photo-description {
  color: #3d3e39;
  font-size: 15px;
  line-height: 1.75;
}

.photo-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin-bottom: 16px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
}

.meta-item {
  min-height: 72px;
  padding: 14px 12px;
  color: var(--muted);
  font-size: 11px;
  border-right: 1px solid var(--ink);
}

.meta-item:last-child {
  border-right: 0;
}

.meta-item::before {
  content: "SIGNAL";
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.action-buttons {
  margin-bottom: 28px;
}

.like-btn {
  width: 100%;
  min-height: 52px;
}

.like-btn.liked {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
}

.comments-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.comments-title,
.section-title {
  position: relative;
  margin: 0 0 16px;
  padding: 12px 0 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.comments-title::after,
.section-title::after {
  content: "RECORD";
  position: absolute;
  top: 14px;
  right: 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.comment-form {
  padding: 20px;
  margin-bottom: 22px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.comments-list {
  gap: 12px;
}

.comment-item,
.comment-card {
  position: relative;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  border-left-width: 5px;
  border-radius: 0;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.comment-item:hover,
.comment-card:hover {
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.comment-header {
  border-bottom: 1px solid var(--line);
}

.comment-nickname,
.comment-user .user-name {
  color: var(--ink);
  font-weight: 850;
}

.comment-time,
.comment-meta,
.comment-ip,
.comment-date {
  color: var(--muted);
  font-size: 11px;
}

.comment-content {
  color: #30312d;
  line-height: 1.7;
}

/* ---------- Upload ---------- */

.upload-header {
  display: block;
}

.upload-header .page-title {
  margin-top: 16px;
}

.page-desc {
  max-width: 640px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.upload-content {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 32px;
  align-items: start;
}

.preview-section,
.form-section {
  width: auto;
  flex: none;
}

.preview-section {
  position: sticky;
  top: 132px;
}

.preview-container {
  min-height: 520px;
  padding: 12px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: var(--shadow-hard);
}

.preview-container::before {
  content: "PREVIEW / SAMPLE INPUT";
  position: absolute;
  top: 17px;
  left: 18px;
  z-index: 2;
  padding: 4px 6px;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
  background: var(--ink);
}

.preview-image {
  width: 100%;
  height: 100%;
  min-height: 490px;
  object-fit: contain;
  background: #e5e5dd;
  border: 1px solid var(--ink);
  border-radius: 0;
}

.preview-placeholder {
  min-height: 490px;
  color: var(--muted);
  background:
    linear-gradient(135deg, transparent 49.7%, var(--line) 50%, transparent 50.3%),
    linear-gradient(45deg, transparent 49.7%, var(--line) 50%, transparent 50.3%);
  border: 1px dashed var(--ink);
}

.placeholder-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 30px;
  filter: grayscale(1);
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.form-section {
  padding: 24px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-top-width: 6px;
  border-radius: 0;
}

.file-input-label {
  min-height: 136px;
  color: var(--ink);
  background: #f0f0e9;
  border: 2px dashed var(--ink);
  border-radius: 0;
}

.file-input-label:hover {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.file-input-icon {
  filter: grayscale(1);
}

.submit-btn,
.login-btn,
.save-btn {
  width: 100%;
  min-height: 52px;
}

/* ---------- Login ---------- */

.login-page {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px 24px;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

.login-page::before {
  content: "ADMINISTRATION\A PRIVATE ARCHIVE";
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  align-items: flex-end;
  width: min(34vw, 480px);
  padding: 48px 40px;
  color: var(--paper-bright);
  font-size: clamp(34px, 5vw, 74px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.06em;
  white-space: pre-line;
  background: var(--ink);
  border-right: 8px solid var(--accent);
  opacity: 1;
  animation: none;
}

.login-container {
  width: min(100%, 500px);
  margin-left: min(34vw, 480px);
}

.login-card {
  padding: clamp(28px, 5vw, 48px);
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-top-width: 8px;
  border-radius: 0;
  box-shadow: var(--shadow-hard);
}

.login-header {
  text-align: left;
}

.login-header::before {
  content: "ACCESS CONTROL / 001";
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.login-title {
  color: var(--ink);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: -0.06em;
  text-shadow: none;
}

.login-subtitle,
.login-footer p {
  color: var(--muted);
}

.login-footer {
  border-top: 1px solid var(--line);
}

/* ---------- Administration shell ---------- */

.admin-layout {
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

.sidebar {
  width: 264px;
  color: var(--ink);
  background: var(--paper-bright);
  border-right: 2px solid var(--ink);
  box-shadow: none;
}

.sidebar.closed {
  width: 76px;
}

.sidebar-header {
  min-height: 82px;
  padding: 18px;
  border-bottom: 2px solid var(--ink);
}

.sidebar-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.035em;
}

.sidebar-title::before {
  content: "CONTROL /";
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.toggle-btn {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--ink);
}

.toggle-btn:hover {
  color: var(--ink);
  background: var(--accent);
}

.sidebar-nav {
  gap: 0;
  padding: 14px 0;
}

.nav-item {
  position: relative;
  min-height: 52px;
  margin: 0 10px 6px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: 0;
}

.nav-item:hover {
  color: var(--ink);
  background: #e8e8e0;
  border-color: var(--ink);
}

.nav-item.active {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
}

.nav-item.active::after {
  content: "●";
  position: absolute;
  right: 12px;
  font-size: 8px;
}

.nav-icon,
.user-avatar,
.stat-icon,
.action-icon,
.tab-icon {
  filter: grayscale(1) contrast(1.15);
}

.sidebar-footer {
  padding: 14px;
  border-top: 2px solid var(--ink);
}

.user-info {
  min-width: 0;
  padding: 9px;
  background: #e8e8e0;
  border: 1px solid var(--line);
}

.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.logout-btn {
  padding: 10px;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
}

.logout-btn:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--ink);
}

.admin-layout > .main-content {
  min-width: 0;
  margin-left: 264px;
  background: transparent;
}

.sidebar.closed + .main-content {
  margin-left: 76px;
}

.content-header {
  min-height: 82px;
  padding: 16px 32px;
  background: rgba(250, 250, 245, 0.96);
  border-bottom: 2px solid var(--ink);
  backdrop-filter: none;
}

.content-header .page-title {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

.content-header .page-title::before {
  content: "ADMIN ARCHIVE / CURRENT VIEW";
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.back-to-site {
  padding: 8px 10px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  border: 1px solid var(--ink);
}

.back-to-site:hover {
  color: var(--ink);
  text-decoration: none;
  background: var(--accent);
}

.content-body {
  max-width: 1440px;
  padding: 32px;
  margin: 0 auto;
  animation: page-in 420ms var(--ease-out) both;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  counter-reset: stat-card;
}

.stat-card {
  position: relative;
  min-height: 150px;
  padding: 22px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-left-width: 2px;
  border-radius: 0;
  box-shadow: none;
  counter-increment: stat-card;
  overflow: hidden;
}

.stat-card::before {
  content: "METRIC / " counter(stat-card, decimal-leading-zero);
  position: absolute;
  top: 13px;
  left: 14px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 86px;
  height: 86px;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.stat-card:hover {
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.stat-card.primary,
.stat-card.success,
.stat-card.warning {
  border-left-color: var(--ink);
}

.stat-card.success::after { background: #d8f2df; }
.stat-card.warning::after { background: #fae7b8; }

.stat-card .stat-icon {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--paper);
  border: 1px solid var(--ink);
}

.stat-info {
  position: relative;
  z-index: 1;
  margin-top: 28px;
}

.stat-value {
  color: var(--ink);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.stat-label {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.actions-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  position: relative;
  min-height: 132px;
  padding: 18px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.action-card:hover {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--paper);
  border: 1px solid var(--ink);
}

.action-label {
  font-size: 13px;
  font-weight: 850;
}

.action-badge {
  color: var(--ink);
  background: var(--accent);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.trend-section {
  padding: 20px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.trend-chart {
  height: 280px;
  padding: 20px 12px 0;
  border-bottom: 2px solid var(--ink);
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
}

.trend-bar {
  min-width: 22px;
  background: var(--ink);
  border-radius: 0;
}

.trend-bar:hover {
  background: var(--accent);
}

.bar-value {
  color: var(--ink);
  background: var(--accent);
  border: 1px solid var(--ink);
}

.bar-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.photos-grid {
  gap: 12px;
}

.photo-item {
  min-height: 116px;
  padding: 12px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.photo-item:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.photo-thumb {
  width: 104px;
  height: 88px;
  border: 1px solid var(--ink);
  border-radius: 0;
}

.photo-status {
  top: 8px;
  left: 8px;
}

.photo-item .photo-title {
  color: var(--ink);
}

.photo-meta,
.photo-date,
.photo-id {
  color: var(--muted);
}

.photo-actions {
  gap: 8px;
}

.btn-sm {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 10px;
}

.pagination {
  gap: 0;
  margin-top: 28px;
}

.page-btn,
.page-info {
  min-height: 44px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.page-btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--ink);
}

.page-info {
  display: inline-flex;
  align-items: center;
  border-inline: 0;
}

.comment-card {
  padding: 18px;
}

.comment-body {
  color: var(--ink);
}

.comment-footer {
  border-top: 1px solid var(--line);
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(190px, 3fr) minmax(0, 9fr);
  gap: 24px;
  align-items: start;
}

.settings-sidebar {
  position: sticky;
  top: 114px;
  width: auto;
  padding: 0;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.tab-item {
  min-height: 50px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  background: var(--paper-bright);
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}

.tab-item:last-child {
  border-bottom: 0;
}

.tab-item:hover,
.tab-item.active {
  color: var(--ink);
  background: var(--accent);
}

.settings-content {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.settings-section {
  padding: 24px;
  margin-bottom: 20px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-top-width: 6px;
  border-radius: 0;
}

.color-input {
  gap: 0;
}

.color-input input[type="color"] {
  width: 54px;
  height: 46px;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-right: 0;
  border-radius: 0;
}

.footer {
  padding: 22px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--paper-bright);
  border-top: 2px solid var(--ink);
}

.footer .container {
  max-width: 1280px;
  padding: 0;
}

/* ---------- Motion ---------- */

@keyframes page-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; }
}

@keyframes notice-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes swiss-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .header-inner {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .header-left { grid-column: 1 / span 4; }
  .header-nav { grid-column: 5 / span 4; }
  .header-right { grid-column: 9 / span 2; }

  .detail-content,
  .upload-content {
    grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body::before {
    width: 5px;
  }

  .container {
    width: min(100% - 32px, 1280px);
  }

  .header-inner {
    display: flex;
    height: 68px;
    padding: 0 16px;
  }

  .header-left {
    flex: 1;
    border-right: 0;
  }

  .header-nav,
  .upload-btn {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }

  .mobile-menu {
    top: 68px;
  }

  .announcement-inner {
    padding-inline: 16px;
  }

  .home-page,
  .detail-page,
  .upload-page {
    padding: 28px 0 56px;
  }

  .toolbar,
  .upload-header {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 26px;
    margin-bottom: 28px;
  }

  .toolbar-left {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .toolbar-right,
  .sort-buttons {
    width: 100%;
  }

  .page-title {
    font-size: clamp(38px, 14vw, 64px);
  }

  .masonry-grid {
    column-count: 2 !important;
    column-gap: 16px !important;
  }

  .photo-card {
    margin-bottom: 16px;
  }

  .photo-card:nth-child(3n + 2) {
    transform: none;
  }

  .photo-card:nth-child(3n + 2):hover,
  .photo-card:nth-child(3n + 2):focus-visible {
    transform: translate(-3px, -3px);
  }

  .detail-content,
  .upload-content {
    grid-template-columns: 1fr;
  }

  .photo-section,
  .preview-section {
    position: static;
  }

  .photo-container,
  .preview-container {
    box-shadow: var(--shadow-small);
  }

  .preview-container,
  .preview-image,
  .preview-placeholder {
    min-height: 360px;
  }

  .login-page {
    align-items: end;
    padding: 120px 18px 28px;
  }

  .login-page::before {
    inset: 0 0 auto;
    width: 100%;
    height: 108px;
    padding: 24px 20px;
    align-items: center;
    font-size: 34px;
    border: 0;
    border-bottom: 6px solid var(--accent);
  }

  .login-container {
    margin-left: 0;
  }

  .sidebar {
    width: min(82vw, 280px);
    border-right: 2px solid var(--ink);
    box-shadow: var(--shadow-hard);
  }

  .sidebar.closed {
    width: min(82vw, 280px);
  }

  .admin-layout > .main-content,
  .sidebar.closed + .main-content {
    margin-left: 0;
  }

  .content-header {
    min-height: 74px;
    padding: 14px 18px;
  }

  .content-header .page-title {
    font-size: 28px;
  }

  .content-body {
    padding: 22px 16px 48px;
  }

  .stats-grid,
  .actions-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .tab-item {
    flex: 0 0 auto;
    border-right: 1px solid var(--ink);
    border-bottom: 0;
  }
}

@media (max-width: 520px) {
  .masonry-grid {
    column-count: 1 !important;
  }

  .sort-btn,
  .tab-btn {
    min-width: 0;
    padding-inline: 8px;
  }

  .photo-meta {
    grid-template-columns: 1fr;
  }

  .meta-item {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .meta-item:last-child {
    border-bottom: 0;
  }

  .stats-grid,
  .actions-grid {
    grid-template-columns: 1fr;
  }

  .photo-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .photo-thumb {
    width: 92px;
    height: 78px;
  }

  .photo-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .back-to-site {
    max-width: 110px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }

  .photo-card,
  .photo-card:nth-child(3n + 2),
  .photo-card:hover,
  .photo-card:focus-visible,
  .btn:hover,
  .action-card:hover,
  .comment-card:hover,
  .comment-item:hover {
    transform: none !important;
  }
}

/* Final alignment refinements */
.upload-header {
  text-align: left;
}

.upload-header .page-desc {
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 768px) {
  .admin-layout {
    display: block;
  }

  .sidebar,
  .sidebar.closed {
    position: sticky;
    top: 0;
    z-index: 120;
    width: 100%;
    height: auto;
    transform: none;
    background: var(--paper-bright);
    border: 0;
    border-bottom: 2px solid var(--ink);
    box-shadow: none;
  }

  .sidebar-header {
    min-height: 62px;
    padding: 10px 16px;
  }

  .sidebar.closed .sidebar-title {
    display: block;
  }

  .toggle-btn {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 8px;
    overflow-x: auto;
    border-bottom: 0;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 126px;
    min-height: 46px;
    margin: 0 6px 0 0;
  }

  .sidebar-footer {
    display: none;
  }

  .admin-layout > .main-content,
  .sidebar.closed + .main-content {
    margin-left: 0;
  }
}

.login-page::after {
  content: "SECURE ENTRY  /  SIGNAL CONTROL  /  001";
  position: fixed;
  left: 42px;
  bottom: 42px;
  z-index: 1;
  max-width: min(26vw, 360px);
  color: var(--paper-bright);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.6;
  letter-spacing: 0.18em;
}

@media (max-width: 768px) {
  .login-page::after {
    top: 77px;
    left: 20px;
    bottom: auto;
    max-width: calc(100% - 40px);
    font-size: 8px;
  }
}
