/* === Tokens === */
:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-muted: #f3ece0;
  --ink: #1c1a17;
  --ink-soft: #5a544c;
  --ink-muted: #8a8278;
  --line: #e9e1d2;
  --line-strong: #d8ceba;
  --accent: #7a1d1d;
  --accent-soft: #c4622a;
  --accent-deep: #5a1414;
  --gold: #b88a2c;
  --ok: #4f6b3a;
  --warn: #b07a1a;
  --err: #9a2a22;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-1: 0 1px 2px rgba(28, 26, 23, .06), 0 4px 16px rgba(28, 26, 23, .04);
  --shadow-2: 0 6px 28px rgba(28, 26, 23, .08), 0 1px 2px rgba(28, 26, 23, .05);
  --shadow-hero: 0 30px 60px -30px rgba(90, 20, 20, .55);
  --serif: 'Fraunces', 'Georgia', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --maxw: 1080px;
  --pad: clamp(20px, 4vw, 40px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad);
}

/* === Hero === */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #f6efe0;
  background:
    radial-gradient(ellipse 80% 60% at 80% 0%, rgba(196, 98, 42, .35), transparent 60%),
    radial-gradient(ellipse 60% 80% at 10% 100%, rgba(184, 138, 44, .25), transparent 60%),
    linear-gradient(160deg, #5a1414 0%, #7a1d1d 45%, #4a1010 100%);
  padding: clamp(48px, 7vw, 88px) 0 clamp(44px, 6vw, 72px);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .04) 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 60px 60px, 90px 90px;
  pointer-events: none;
  z-index: -1;
}
.hero__inner {
  display: grid;
  gap: clamp(20px, 3vw, 36px);
}

/* Bottom engagements block (between main and footer) */
.engagements-block {
  padding: clamp(28px, 4vw, 56px) 0 clamp(40px, 5vw, 72px);
}
.hero__glow {
  position: absolute;
  inset: auto -10% -40% auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 200, 120, .25), transparent 60%);
  filter: blur(40px);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  width: max-content;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(140deg, #faf6ef, #e9d8b4);
  color: var(--accent-deep);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.brand__name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .2px;
}
.brand__name em {
  font-style: italic;
  font-weight: 500;
  color: #f1d9a6;
}

.hero__copy h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin: 0;
  max-width: 18ch;
  text-wrap: balance;
}
.hero__copy p {
  margin: 14px 0 0;
  font-size: clamp(15px, 1.4vw, 18px);
  color: #ece1c8;
  max-width: 60ch;
  opacity: .92;
}

.hero__hint {
  margin: 0;
  font-size: 13px;
  color: #ddc89a;
  opacity: .85;
}

/* === Search === */
.search {
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px;
  border-radius: var(--radius-lg);
  max-width: 560px;
  box-shadow: var(--shadow-hero);
}
.search__field {
  flex: 1;
  display: grid;
  gap: 2px;
  padding: 6px 14px 8px;
}
.search__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #d8c79a;
  font-weight: 600;
}
.search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .04em;
  outline: 0;
  padding: 0;
}
.search input::placeholder { color: rgba(255,255,255,.45); font-weight: 500; letter-spacing: .02em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  border-radius: calc(var(--radius-lg) - 8px);
  padding: 12px 22px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(140deg, #f7e5c1, #e7c986);
  color: var(--accent-deep);
  box-shadow: 0 6px 18px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.6);
}
.btn--primary:hover { background: linear-gradient(140deg, #fbeccb, #efd49a); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn--ghost:hover { background: var(--surface-muted); }

/* === Main === */
.main {
  padding-top: clamp(28px, 4vw, 44px);
  padding-bottom: 80px;
  min-height: 50vh;
}

/* === Result states === */
.result { display: grid; gap: 22px; }

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  font-weight: 500;
  animation: fade-up .35s ease both;
}
.status--ok { border-color: rgba(79, 107, 58, .35); background: linear-gradient(180deg, #f4f8ec, #fff); }
.status--warn { border-color: rgba(176, 122, 26, .35); background: linear-gradient(180deg, #fbf3df, #fff); }
.status--err { border-color: rgba(154, 42, 34, .3); background: linear-gradient(180deg, #fbeae8, #fff); }
.status__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status--ok .status__icon { background: rgba(79,107,58,.15); color: var(--ok); }
.status--warn .status__icon { background: rgba(176,122,26,.15); color: var(--warn); }
.status--err .status__icon { background: rgba(154,42,34,.15); color: var(--err); }
.status__title { font-weight: 700; }
.status__text { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }

/* === Lot header === */
.lot-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 32px);
  box-shadow: var(--shadow-2);
  display: grid;
  gap: 18px;
  position: relative;
  overflow: hidden;
  animation: fade-up .45s .05s ease both;
}
.lot-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--gold));
}
.lot-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.lot-code {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(32px, 4.4vw, 44px);
  letter-spacing: .02em;
  margin: 4px 0 0;
  line-height: 1;
}
.lot-code small {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: .02em;
  margin-top: 6px;
}
/* === Stats grid === */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.stat {
  flex: 0 1 240px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 6px;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.stat:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.stat__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--accent);
  margin-bottom: 4px;
}
.stat__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  font-weight: 600;
}
.stat__value {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
  word-break: break-word;
}
.stat__sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* === Cards / sections === */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.5vw, 26px);
  box-shadow: var(--shadow-1);
  animation: fade-up .5s .1s ease both;
}
.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card__title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.01em;
}
.card__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--accent);
}

/* Key-value list inside cards */
.kv {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  gap: 10px 18px;
  font-size: 14.5px;
}
.kv > dt {
  color: var(--ink-muted);
  font-weight: 500;
  text-transform: capitalize;
}
.kv > dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}
.kv > dd .muted { color: var(--ink-muted); font-style: italic; }
.kv > dt, .kv > dd {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }

/* Sub-table (arrays of objects) */
.subtable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  margin-top: 6px;
}
.subtable th, .subtable td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.subtable th {
  background: var(--surface-muted);
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
}
.subtable tr:last-child td { border-bottom: 0; }
.subtable tr:hover td { background: rgba(0,0,0,.015); }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--ink-soft);
  text-transform: capitalize;
}
.pill--ok { background: rgba(79,107,58,.13); color: var(--ok); }
.pill--err { background: rgba(154,42,34,.13); color: var(--err); }
.pill--muted { background: transparent; color: var(--ink-muted); }
.pill--fresh {
  background: rgba(79,107,58,.16);
  color: var(--ok);
  padding: 5px 12px;
  font-size: 13px;
  margin-top: 12px;
}
.pill--warn {
  background: rgba(176,122,26,.18);
  color: var(--warn);
  padding: 5px 12px;
  font-size: 13px;
  margin-top: 12px;
}
.pill--old {
  background: rgba(154,42,34,.15);
  color: var(--err);
  padding: 5px 12px;
  font-size: 13px;
  margin-top: 12px;
}

/* Contact form (pro page) */
.contact-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 18px;
}
.field {
  display: grid;
  gap: 6px;
}
.field--full { grid-column: 1 / -1; }
.field__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  font-weight: 600;
}
.field input,
.field textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 29, 29, .12);
}
@media (max-width: 540px) {
  .contact-form { grid-template-columns: 1fr; }
}
.contact-status {
  grid-column: 1 / -1;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  min-height: 1px;
}
.contact-status--loading { color: var(--ink-muted); padding: 8px 0; }
.contact-status--ok {
  color: var(--ok);
  background: rgba(79,107,58,.10);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(79,107,58,.25);
}
.contact-status--err {
  color: var(--err);
  background: rgba(154,42,34,.08);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(154,42,34,.25);
}

/* Engagements section */
.card--engagements {
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-muted) 100%);
  border-color: rgba(196, 98, 42, .22);
  position: relative;
  overflow: hidden;
  padding-top: clamp(26px, 3vw, 32px);
  padding-bottom: clamp(26px, 3vw, 32px);
}
.card--engagements::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--gold));
}
.card__head--centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 22px;
}
.card__head--centered .card__title {
  font-size: clamp(22px, 2.4vw, 26px);
}
.card__subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.engagements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(20px, 2.4vw, 28px);
  padding-top: 4px;
}
.engagement {
  text-align: center;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  transition: transform .25s ease, background .25s ease;
}
.engagement:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, .55);
}
.engagement__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(140deg, #f7e5c1 0%, #e3c47a 100%);
  border-radius: 50%;
  color: var(--accent-deep);
  box-shadow:
    0 8px 18px rgba(122, 29, 29, .15),
    inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .25s ease, box-shadow .25s ease;
}
.engagement:hover .engagement__icon {
  transform: scale(1.06) rotate(-2deg);
  box-shadow:
    0 10px 22px rgba(122, 29, 29, .22),
    inset 0 1px 0 rgba(255, 255, 255, .85);
}
.engagement__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 6px;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -.005em;
}
.engagement__text {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  max-width: 28ch;
  margin: 0 auto;
}

/* Image card */
.card--image { padding: 0; overflow: hidden; }
.card--image .card__head {
  padding: 22px 24px 0;
  margin-bottom: 14px;
}
.image-wrap {
  background: linear-gradient(180deg, var(--surface-muted), #ece1c8);
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line);
  position: relative;
}
.image-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  background: #fff;
  animation: fade-up .4s ease both;
}

/* Raw JSON viewer */
details.raw {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  animation: fade-up .55s .15s ease both;
}
details.raw[open] { padding-bottom: 16px; }
details.raw summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
}
details.raw[open] summary::before { transform: rotate(45deg); }
details.raw pre {
  margin: 0 18px;
  padding: 14px 16px;
  background: #1c1a17;
  color: #e8dcc4;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.55;
  overflow: auto;
  max-height: 60vh;
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-muted) 0%, #ede1cc 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skel-row { height: 14px; margin-bottom: 8px; }

/* Empty state illustration */
.empty {
  text-align: center;
  padding: clamp(40px, 6vw, 64px) 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  animation: fade-up .35s ease both;
}
.empty__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--accent);
}
.empty h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 6px;
  font-weight: 700;
}
.empty p {
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 40ch;
  font-size: 15px;
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 0;
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 13px;
}
.footer__link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color .15s ease, border-color .15s ease;
}
.footer__link:hover {
  color: var(--ink);
  border-bottom-color: currentColor;
}

/* === Animations === */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Responsive === */
@media (max-width: 540px) {
  .search { flex-direction: column; }
  .search__field { padding: 8px 12px 10px; }
  .btn--primary { width: 100%; }
  .lot-header__top { flex-direction: column; align-items: flex-start; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv > dt { padding-top: 12px; padding-bottom: 0; border: 0; }
  .kv > dd { padding-top: 2px; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}
