/* Ulka Origin home page. Black, white and greys only. Spacing is in steps of 8px. */

:root {
  --black: #000;
  --white: #fff;
  --grey-50: #f6f6f6;
  --grey-100: #eeeeee;
  --grey-200: #e2e2e2;
  --grey-500: #757575;
  --grey-600: #545454;
  --ok: #05944f;
  --radius: 8px;
  --fast: 150ms ease;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Top bar ---------- */

.topbar { background: var(--black); color: var(--white); }

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }

.topbar-link {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--white);
  opacity: 0.8;
  transition: opacity var(--fast);
}
.topbar-link:hover { opacity: 1; text-decoration: underline; }
.topbar-link:focus-visible { outline-color: var(--white); }

/* ---------- Hero ---------- */

.hero { padding-top: 64px; padding-bottom: 40px; }

h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lead {
  margin: 16px 0 0;
  max-width: 640px;
  font-size: 20px;
  line-height: 1.4;
  color: var(--grey-600);
}

.stats {
  margin: 24px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--black);
}
.stats .sep { color: var(--grey-500); padding: 0 8px; }

.cdn { margin-top: 40px; max-width: 560px; }

.cdn-label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }

.cdn-row { display: flex; gap: 8px; }

.cdn-help { margin: 8px 0 0; font-size: 13px; color: var(--grey-500); }
.cdn-help.active { color: var(--black); }
.cdn-help.bad { color: var(--black); font-weight: 500; }
.cdn-help code { font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* ---------- Inputs and buttons ---------- */

.field {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  color: var(--black);
  background: var(--grey-100);
  border: 0;
  border-radius: var(--radius);
  outline: 2px solid transparent;
  outline-offset: 0;
  transition: outline-color var(--fast), background var(--fast);
}
.field::placeholder { color: var(--grey-500); }
.field:focus, .field:focus-visible { outline: 2px solid var(--black); outline-offset: 0; background: var(--white); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--fast), color var(--fast);
}
.cdn-row .pill { height: 48px; padding: 0 20px; }

.pill-black { background: var(--black); color: var(--white); }
.pill-black:hover { background: #333; }

.pill-grey { background: var(--grey-100); color: var(--black); }
.pill-grey:hover { background: var(--grey-200); }

.pill-white { background: var(--white); color: var(--black); }
.pill-white:hover { background: var(--grey-200); }

/* ---------- Toolbar: search and format chips (sticks to the top) ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
}

.toolbar-in {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.search { flex: 0 0 280px; height: 40px; font-size: 15px; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px; /* room for the focus ring */
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  height: 36px;
  padding: 0 14px;
  background: var(--grey-100);
  color: var(--black);
}
.chip:hover { background: var(--grey-200); }
.chip .n { color: var(--grey-500); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--black); color: var(--white); }
.chip[aria-pressed="true"] .n { color: var(--grey-200); }

/* ---------- Sections ---------- */

main.wrap { padding-bottom: 64px; }

.section { padding-top: 48px; scroll-margin-top: 80px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 24px;
}

.section-head h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head .count {
  font-size: 14px;
  font-weight: 500;
  color: var(--grey-500);
  font-variant-numeric: tabular-nums;
}

.section-head p {
  flex-basis: 100%;
  margin: 0;
  font-size: 15px;
  color: var(--grey-600);
}

.message {
  margin-top: 48px;
  padding: 32px;
  background: var(--grey-50);
  border-radius: var(--radius);
  font-size: 18px;
}
.message strong { display: block; font-size: 24px; letter-spacing: -0.02em; margin-bottom: 8px; }
.message code { white-space: nowrap; font-family: var(--mono); font-size: 15px; background: var(--grey-200); padding: 2px 6px; border-radius: 4px; }

/* ---------- Grid and tiles ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px 16px;
}

.tile {
  margin: 0;
  min-width: 0;
  border-radius: var(--radius);
  outline: none;
  cursor: default;
}
.tile:focus-visible .thumb { outline: 2px solid var(--black); outline-offset: 2px; }

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
}

.thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Drawings (SVG) and icons: show the whole picture on the plain page background. */
.thumb.contain img { object-fit: contain; }
/* Icons are tiny: show them at their real size, not blown up and blurry. */
.thumb.small img { object-fit: scale-down; }

/* The browser could not draw the file and there is no JPG copy: hide the broken-image sign. */
.thumb.broken img { visibility: hidden; }

/* The hover panel with the URL and the Copy button. */
.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  color: var(--white);
  background: rgba(0, 0, 0, 0.85);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform var(--fast), visibility 0s linear 150ms;
}

.tile:hover .overlay,
.tile:focus-within .overlay,
.tile.active .overlay {
  transform: translateY(0);
  visibility: visible;
  transition: transform var(--fast), visibility 0s;
}

.url {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
}

.actions { display: flex; align-items: center; gap: 12px; }

.copy { height: 32px; padding: 0 16px; font-size: 13px; min-width: 76px; }
.copy:focus-visible { outline-color: var(--white); }
.copy.ok { background: var(--ok); color: var(--white); }

.open {
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  border-radius: 4px;
}
.open:hover { text-decoration: underline; }
.open:focus-visible { outline-color: var(--white); }

figcaption {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  min-width: 0;
}

.name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 8px;
  font-size: 13px;
  color: var(--grey-500);
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--black);
  border-radius: 999px;
}
.tag-light { color: var(--black); background: var(--grey-200); }

/* ---------- Footer ---------- */

.foot {
  padding-top: 32px;
  padding-bottom: 48px;
  border-top: 1px solid var(--grey-200);
  font-size: 13px;
  color: var(--grey-500);
}
.foot p { margin: 0; }

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 40px; padding-bottom: 24px; }
  .lead { font-size: 17px; }
  .cdn { margin-top: 32px; }
  .toolbar-in { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .search { flex: none; width: 100%; }
  .chips { margin: 0 -16px; padding: 2px 16px; }
  .section { padding-top: 40px; }
  .section-head h2 { font-size: 26px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .overlay { padding: 8px; gap: 6px; }
  .url { -webkit-line-clamp: 2; font-size: 10px; }
  .copy { height: 28px; padding: 0 12px; min-width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
