:root {
  color-scheme: light;
  --ink: #191919;
  --muted: #706f6b;
  --paper: #f3f1eb;
  --card: #fffef9;
  --line: #d8d4ca;
  --orange: #ff5c35;
  --blue: #205cff;
  --green: #18a66a;
  --shadow: 0 16px 50px rgba(28, 24, 16, 0.08);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(25, 25, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 25, 25, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  padding: 72px 0 80px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: end;
  gap: 40px;
  margin-bottom: 48px;
}

.hero .eyebrow {
  grid-column: 1 / -1;
}

.hero h1 {
  margin: -4px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 9vw, 8.25rem);
  font-weight: 400;
  line-height: 0.76;
  letter-spacing: -0.07em;
}

.hero h1 em {
  color: var(--orange);
  font-weight: 400;
}

.hero > p {
  max-width: 420px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 166, 106, 0.13);
}

.search-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-panel > label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 11px;
  background: white;
}

.at-mark {
  padding-left: 17px;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 1.5rem;
}

.search-row input {
  min-width: 0;
  padding: 17px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1rem;
}

.search-row:focus-within {
  box-shadow: 0 0 0 3px rgba(32, 92, 255, 0.17);
}

.search-row > button {
  display: flex;
  gap: 28px;
  align-items: center;
  align-self: stretch;
  padding: 0 20px;
  border: 0;
  color: white;
  background: var(--ink);
  cursor: pointer;
  transition: background 150ms ease;
}

.search-row > button:hover {
  background: var(--blue);
}

.search-row > button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.search-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.76rem;
}

.search-meta button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.refresh-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}

.message {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid #e9a99a;
  border-radius: 10px;
  color: #8a2715;
  background: #fff2ed;
}

#result {
  margin-top: 50px;
}

.result-toolbar,
.section-heading,
.json-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-toolbar {
  margin-bottom: 18px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.45);
}

.tab {
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
}

.tab.active {
  color: white;
  background: var(--ink);
}

.request-meta {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.profile-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.file-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.1fr;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.file-cover {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  background: #dfdcd3;
}

.file-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 36px;
}

.file-copy h2 {
  margin: 10px 0 14px;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.file-copy p {
  display: -webkit-box;
  max-width: 620px;
  margin: 0 0 20px;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.tag {
  padding: 5px 8px;
  border-radius: 100px;
  color: #495046;
  background: #e7eadf;
  font-size: 0.66rem;
  font-weight: 700;
}

.avatar,
.avatar-placeholder {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfdcd3;
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 2.2rem;
}

.profile-copy h2 {
  margin: 0 0 5px;
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.handle {
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 650;
}

.profile-copy p {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.profile-links a,
.open-link {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  background: white;
  font-size: 0.73rem;
  font-weight: 650;
}

.open-link:hover,
.profile-links a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 18px 0 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.total {
  padding: 18px 20px;
  background: var(--card);
}

.total strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
}

.total span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-family: Georgia, serif;
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.count-pill {
  padding: 7px 11px;
  border-radius: 100px;
  color: white;
  background: var(--orange);
  font-size: 0.72rem;
  font-weight: 700;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.resource-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.gallery-card {
  overflow: hidden;
  aspect-ratio: 5 / 3;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #dfdcd3;
  box-shadow: var(--shadow);
}

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

.resource-image {
  position: relative;
  aspect-ratio: 5 / 3;
  overflow: hidden;
  background: #dfdcd3;
}

.resource-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resource-type,
.pinned {
  position: absolute;
  top: 10px;
  padding: 5px 8px;
  border-radius: 5px;
  color: white;
  background: rgba(25, 25, 25, 0.88);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.resource-type {
  left: 10px;
}

.pinned {
  right: 10px;
  background: var(--orange);
}

.resource-body {
  padding: 16px;
}

.resource-body h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: 400;
}

.resource-body > p {
  min-height: 38px;
  margin: 8px 0 16px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.resource-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metrics {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.json-view {
  overflow: hidden;
  border: 1px solid #343434;
  border-radius: 14px;
  background: #171717;
  box-shadow: var(--shadow);
}

.json-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid #343434;
  color: #aaa;
  font-size: 0.75rem;
}

.json-toolbar button {
  margin-left: 6px;
  padding: 6px 9px;
  border: 1px solid #4b4b4b;
  border-radius: 5px;
  color: #ddd;
  background: #272727;
  cursor: pointer;
  font-size: 0.7rem;
}

#json-output {
  max-height: 70vh;
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #c9e7ff;
  font: 0.76rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  tab-size: 2;
}

footer {
  display: flex;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

footer a {
  color: inherit;
}

@media (max-width: 800px) {
  .shell {
    padding-top: 44px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero .eyebrow {
    grid-column: auto;
  }

  .hero h1 {
    font-size: clamp(3.8rem, 19vw, 6rem);
  }

  .search-row {
    grid-template-columns: auto 1fr;
  }

  .search-row > button {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 15px 18px;
  }

  .profile-card {
    grid-template-columns: auto 1fr;
  }

  .file-card {
    grid-template-columns: 1fr;
  }

  .file-cover {
    min-height: auto;
    aspect-ratio: 5 / 3;
  }

  .file-copy {
    padding: 26px;
  }

  .profile-card > .open-link {
    grid-column: 1 / -1;
    text-align: center;
  }

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

  .resource-grid {
    grid-template-columns: 1fr;
  }

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