:root {
  color-scheme: light;
  --ink: #151923;
  --paper: #f3f6fc;
  --panel: #ffffff;
  --panel-soft: #e4ecf8;
  --line: #b9c7dc;
  --line-strong: #6f7d92;
  --muted: #46566e;
  --blue: #2457e6;
  --blue-deep: #12348f;
  --mint: #008f7a;
  --coral: #d85b57;
  --amber: #b8760a;
  --focus: #00a88f;
  --radius: 8px;
  --content: 74ch;
  font-family: Aptos, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  background:
    linear-gradient(90deg, rgb(36 87 230 / 4%) 1px, transparent 1px),
    linear-gradient(rgb(21 25 35 / 3%) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 17px;
  line-height: 1.62;
  margin: 0;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

a {
  color: var(--blue-deep);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--coral);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.skip-link,
.visually-hidden {
  position: absolute;
}

.skip-link {
  background: var(--ink);
  color: white;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  top: 1rem;
  transform: translateY(-160%);
  z-index: 30;
}

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

.visually-hidden {
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  width: 1px;
}

.site-header {
  align-items: center;
  background: rgb(245 247 251 / 96%);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  padding: 0.8rem clamp(1rem, 4vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 850;
  gap: 0.55rem;
  min-width: 0;
  text-decoration: none;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  background: white url("/assets/brand-icon.webp") center / cover no-repeat;
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: transparent;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0;
  height: 2rem;
  width: 2rem;
}

.site-nav,
.utility-nav,
.footer-links,
.hero-links,
.admin-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.site-nav {
  justify-content: flex-end;
  min-width: 0;
}

.utility-nav {
  justify-content: flex-end;
}

.utility-nav:empty {
  display: none;
}

.site-nav a,
.utility-nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.92rem;
  line-height: 1.2;
  min-height: 2.1rem;
  padding: 0.34rem 0.68rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: rgb(31 78 216 / 9%);
  border-color: rgb(31 78 216 / 20%);
  color: var(--blue-deep);
}

.utility-nav a,
.button-link {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: white;
  display: inline-flex;
  font-weight: 760;
  gap: 0.35rem;
  justify-content: center;
  line-height: 1.2;
  min-height: 2.45rem;
  padding: 0.48rem 0.86rem;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.utility-nav a:hover,
.button-link:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.button-link-secondary {
  background: transparent;
  color: var(--ink);
}

.button-link-secondary:hover {
  color: white;
}

.page-main {
  flex: 1 0 auto;
  margin: 0 auto;
  max-width: 1240px;
  padding: 1.4rem clamp(1rem, 4vw, 2rem) 3rem;
  width: 100%;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0 0 0.7rem;
  overflow-wrap: anywhere;
}

h1 {
  font-family: "Aptos Display", Aptos, "Segoe UI", system-ui, sans-serif;
  font-size: 4.8rem;
  font-weight: 900;
}

h2 {
  font-size: 2.3rem;
  font-weight: 850;
}

h3 {
  font-size: 1.08rem;
  font-weight: 820;
}

.lead {
  color: var(--muted);
  font-size: 1.18rem;
  margin: 0 0 1.35rem;
  max-width: 58ch;
}

.kicker {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  margin: 0 0 0.55rem;
  text-transform: uppercase;
}

.pictor-hero {
  align-items: start;
  border-bottom: 2px solid var(--ink);
  border-top: 2px solid var(--ink);
  display: grid;
  gap: clamp(1rem, 4vw, 2.4rem);
  grid-template-columns: minmax(0, 1.08fr) minmax(18rem, 0.7fr);
  min-height: 0;
  padding: clamp(1rem, 4vw, 2rem) 0;
}

.pictor-hero > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

.tool-heading {
  border-bottom: 2px solid var(--ink);
  margin-bottom: 1rem;
  max-width: 920px;
  padding: 0 0 1rem;
}

.upload-panel,
.asset-table {
  border-top: 1px solid var(--line-strong);
}

.hero-contact-sheet {
  align-content: center;
  background: transparent;
  border-left: 2px solid var(--ink);
  border-radius: 0;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 0 0 1rem;
  position: relative;
}

.hero-contact-sheet img {
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  grid-column: 1 / -1;
  justify-self: center;
  max-width: min(16rem, 100%);
  object-fit: cover;
  width: 100%;
}

.hero-contact-sheet span {
  background:
    linear-gradient(135deg, rgb(255 255 255 / 30%), transparent 44%),
    var(--swatch, var(--blue));
  border: 1px solid var(--ink);
  border-radius: 0;
  min-height: 5.5rem;
}

.hero-contact-sheet span:nth-child(2) { --swatch: var(--mint); }
.hero-contact-sheet span:nth-child(3) { --swatch: var(--amber); }
.hero-contact-sheet span:nth-child(4) { --swatch: #9bb7e8; }
.hero-contact-sheet span:nth-child(5) { --swatch: #222938; }
.hero-contact-sheet span:nth-child(6) { --swatch: var(--coral); }

.media-toolbar {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-strong);
  margin: 1.5rem 0 0;
  padding-bottom: 0.75rem;
}

.segmented-control {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.25rem;
}

.segmented-control button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  min-height: 2.15rem;
  padding: 0.25rem 0.75rem;
}

.segmented-control button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
  font-weight: 760;
}

.media-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  min-height: 34rem;
  padding-top: 1rem;
}

.media-card {
  background: rgb(255 255 255 / 88%);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 0.85rem 2rem rgb(21 25 35 / 7%);
  min-width: 0;
  overflow: hidden;
  padding: 0;
}

.media-card-preview {
  aspect-ratio: 16 / 11;
  background: var(--panel-soft);
  display: grid;
  place-items: center;
}

.media-card-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.media-card-preview img[src=""] {
  display: none;
}

.media-card-body {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
}

.media-card h3,
.media-card p,
.asset-row h3,
.asset-row p {
  margin: 0;
}

.media-card p,
.asset-meta,
.form-status,
.empty {
  color: var(--muted);
  font-size: 0.93rem;
}

.media-description {
  color: var(--ink) !important;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.copy-row {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0.15rem;
}

.upload-panel {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  padding: 1.15rem 0 0;
}

.upload-panel label {
  color: var(--muted);
  display: grid;
  font-weight: 730;
  gap: 0.4rem;
}

.upload-panel input,
.upload-panel textarea,
.copy-row input,
.admin-token-input {
  background: rgb(255 255 255 / 82%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 2.65rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

.drop-zone {
  background:
    linear-gradient(135deg, rgb(31 78 216 / 12%) 0 1px, transparent 1px 18px),
    white;
  border: 2px dashed rgb(31 78 216 / 48%);
  border-radius: 0;
  color: var(--ink) !important;
  cursor: pointer;
  padding: clamp(1rem, 4vw, 2rem);
}

.drop-zone input {
  border: 0;
  padding: 0;
}

.drop-zone span {
  font-size: 1.22rem;
}

.check-row {
  align-items: center;
  display: flex !important;
  gap: 0.55rem;
}

.check-row input {
  flex: 0 0 auto;
  height: 1.1rem;
  width: 1.1rem;
}

.admin-actions {
  margin: 0 0 1rem;
}

.admin-token-input {
  max-width: 22rem;
}

.asset-table {
  display: grid;
  gap: 0.75rem;
  padding: 0;
}

.asset-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  padding: 0.75rem 0;
}

.asset-row:last-child {
  border-bottom: 0;
}

.asset-thumb {
  aspect-ratio: 1;
  background: var(--panel-soft);
  border-radius: 6px;
  object-fit: cover;
  width: 4.5rem;
}

.asset-row button,
.copy-row button,
.copy-actions button,
.load-more,
.upload-dialog-header button {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.2;
  min-height: 2.3rem;
  padding: 0.35rem 0.72rem;
  white-space: nowrap;
}

.asset-row button:hover,
.copy-row button:hover,
.copy-actions button:hover,
.load-more:hover,
.upload-dialog-header button:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.load-more {
  grid-column: 1 / -1;
  justify-self: center;
  margin: 1rem 0 0;
  min-width: 9rem;
}

.upload-dialog-layer {
  display: grid;
  inset: 0;
  padding: 1rem;
  place-items: center;
  position: fixed;
  z-index: 60;
}

.upload-dialog-layer[hidden] {
  display: none;
}

.upload-dialog-backdrop {
  background:
    radial-gradient(circle at 28% 18%, rgb(36 87 230 / 24%), transparent 30rem),
    rgb(8 13 24 / 72%);
  inset: 0;
  position: absolute;
}

.upload-dialog {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 1.5rem 4rem rgb(21 25 35 / 24%);
  display: grid;
  gap: 0.9rem;
  max-width: min(42rem, 100%);
  padding: clamp(1rem, 4vw, 1.35rem);
  position: relative;
  width: 100%;
}

.upload-dialog-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.upload-dialog-header h2 {
  font-size: 1.45rem;
  margin: 0;
}

.upload-dialog-status {
  color: var(--muted);
  margin: 0;
}

.progress-track {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 0.75rem;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--blue), var(--mint));
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.upload-result-card {
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(8rem, 0.7fr) minmax(0, 1fr);
  padding: 0.8rem;
}

.upload-result-card img {
  aspect-ratio: 4 / 3;
  background: var(--panel-soft);
  border-radius: var(--radius);
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.upload-result-card h3,
.upload-result-card p {
  margin: 0 0 0.55rem;
}

.prose {
  max-width: var(--content);
}

.prose > * + * {
  margin-top: 1rem;
}

.prose code {
  background: var(--panel-soft);
  border-radius: 4px;
  padding: 0.1rem 0.25rem;
}

.site-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  font-size: 0.92rem;
  gap: 0.8rem 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1240px;
  padding: 1.2rem clamp(1rem, 4vw, 2rem) 2rem;
  width: 100%;
}

.footer-brand {
  font-weight: 780;
  margin: 0;
}

.footer-links a,
.footer-link-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  line-height: 1.2;
  min-height: 2.15rem;
  padding: 0.32rem 0.64rem;
  text-decoration: none;
}

.footer-links a:hover,
.footer-link-button:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: minmax(7rem, auto) minmax(0, 1fr);
  }

  h1 {
    font-size: 4.2rem;
  }

  .pictor-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-contact-sheet {
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    grid-template-columns: minmax(0, 1fr);
    padding: 1rem 0 0;
  }

  .upload-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .site-header {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .site-nav,
  .utility-nav {
    grid-column: 1;
    justify-content: flex-start;
  }

  .site-nav a,
  .utility-nav a,
  .button-link {
    white-space: normal;
  }

  .page-main {
    padding-top: 1.25rem;
  }

  h1 {
    font-size: 3.1rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .lead {
    font-size: 1.04rem;
  }

  .media-toolbar {
    align-items: stretch;
    flex-direction: column;
    margin-top: 2rem;
  }

  .media-grid {
    min-height: 28rem;
  }

  .hero-contact-sheet {
    grid-template-columns: minmax(0, 1fr);
  }

  .copy-row,
  .asset-row,
  .upload-result-card {
    grid-template-columns: 1fr;
  }

  .asset-thumb {
    width: 5.5rem;
  }

  .footer-links {
    align-items: flex-start;
    flex-direction: column;
  }
}
