/* ====================================================================
   Brand DNA — styly
   ==================================================================== */

:root {
  --color-ink:        #16140f;   /* hlavní text / serif nadpisy */
  --color-text:       #2a2724;
  --color-muted:      #595959;   /* 7:1 na bílé ✓ */
  --color-faint:      #8a857d;
  --color-bg:         #f3f2ef;
  --color-card:       #ffffff;
  --color-border:     #e9e7e2;
  --color-border-2:   #dedbd3;
  --color-black:      #0e0e10;
  --color-accent:     #f5a623;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --radius:     22px;
  --radius-sm:  14px;
  --gap:        22px;
  --max-width:  1180px;
  --shadow:     0 2px 4px rgba(20,18,12,.03), 0 12px 32px rgba(20,18,12,.06);
  --shadow-lg:  0 6px 14px rgba(20,18,12,.06), 0 22px 48px rgba(20,18,12,.10);
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

/* atribut hidden musí vždy vyhrát nad display: flex/grid na .loading apod. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(130% 80% at 50% -20%, #ffffff 0%, rgba(255,255,255,0) 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* mírně ztlumit šum, ať nepřebíjí obsah */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  opacity: .55;
  z-index: -1;
  pointer-events: none;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-black);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px) 80px;
}

/* ───────────────────────────── HERO / vyhledávání ───────────────────────────── */

.hero {
  text-align: center;
  padding: clamp(28px, 8vh, 90px) 0 24px;
  transition: padding var(--transition);
}

.brandmark { margin-bottom: 22px; }
.brandmark svg { filter: drop-shadow(0 6px 14px rgba(20,18,12,.12)); }

.hero-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(40px, 7vw, 74px);
  line-height: 1.02;
  letter-spacing: -.01em;
  color: var(--color-ink);
  margin: 0 0 14px;
}

.hero-sub {
  max-width: 540px;
  margin: 0 auto 30px;
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.55;
  color: var(--color-muted);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  background: var(--color-card);
  border: 1px solid var(--color-border-2);
  border-radius: 999px;
  padding: 7px 7px 7px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.search:focus-within {
  border-color: #bdb9af;
  box-shadow: var(--shadow-lg);
}
.search-icon {
  display: flex;
  color: var(--color-faint);
  flex-shrink: 0;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 17px;
  color: var(--color-ink);
  padding: 10px 4px;
}
.search input::placeholder { color: #b3aea4; }
.search input:focus { outline: none; }

.btn-extract {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  background: var(--color-black);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  transition: transform var(--transition), background var(--transition), opacity var(--transition);
}
.btn-extract:hover { transform: translateY(-1px); background: #26262a; }
.btn-extract:active { transform: translateY(0); }
.btn-extract[disabled] { opacity: .6; cursor: progress; }
.btn-arrow { transition: transform var(--transition); }
.btn-extract:hover .btn-arrow { transform: translateX(3px); }

.examples {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--color-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.examples button {
  border: 1px solid var(--color-border-2);
  background: rgba(255,255,255,.6);
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}
.examples button:hover {
  border-color: #c2bdb2;
  background: #fff;
  color: var(--color-ink);
}

.hero-error {
  margin: 20px auto 0;
  max-width: 520px;
  color: #b4261b;
  background: #fdeceb;
  border: 1px solid #f6c9c5;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14.5px;
}

/* stav po načtení — hero se sbalí do úzké lišty */
body.has-result .hero { padding: 6px 0 26px; }
body.has-result .hero-title,
body.has-result .hero-sub,
body.has-result .examples,
body.has-result .brandmark { display: none; }
body.has-result .search { max-width: 460px; }

/* ───────────────────────────── LOADING ───────────────────────────── */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 90px 0;
}
.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #e3e0d9;
  border-top-color: var(--color-black);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 19px;
  color: var(--color-muted);
  margin: 0;
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* ───────────────────────────── RESULT ───────────────────────────── */

.result { animation: fade-up .5s ease-out both; }
@media (prefers-reduced-motion: reduce) { .result { animation: none; } }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-head { text-align: center; margin: 8px 0 30px; }
.result-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -.01em;
  color: var(--color-ink);
  margin: 0 0 8px;
}
.result-sub {
  font-size: 15px;
  color: var(--color-muted);
  margin: 0;
}

/* ───────────────────────────── BENTO GRID ───────────────────────────── */

.bento {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1.12fr 1fr 1.12fr;
  grid-template-areas:
    "logo  brand  colors"
    "logo  meta   colors"
    "head  prods  imgs";
}
.card-logo     { grid-area: logo; }
.card-brand    { grid-area: brand; }
.meta-row      { grid-area: meta; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.card-colors   { grid-area: colors; }
.card-headline { grid-area: head; }
.card-products { grid-area: prods; }
.card-images   { grid-area: imgs; }

/* ───────────────────────────── KARTA ───────────────────────────── */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #fcfbf9 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  min-height: 124px;
  cursor: pointer;
  animation: fade-up .55s ease-out both;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-2);
}
.card:nth-child(2) { animation-delay: .04s; }
.card:nth-child(3) { animation-delay: .08s; }
.card:nth-child(4) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

.card-body { flex: 1; min-height: 0; }

.card-label {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--color-ink);
  margin-top: 16px;
}
.card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 16px;
}
.card-foot .muted { font-size: 13px; color: var(--color-faint); }

/* tužka pro editaci */
.pencil {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  z-index: 2;
}
.card:hover .pencil { opacity: 1; }
.pencil:hover { color: var(--color-ink); }

/* ── Logo ── */
.card-logo .logo-body {
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #eef1f6 0%, #e3e7ef 100%);
  min-height: 180px;
  padding: 24px;
}
.card-logo img {
  max-width: 78%;
  max-height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(20,18,12,.12));
}

/* ── Brand ── */
.card-brand { justify-content: center; gap: 14px; }
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 40px);
  letter-spacing: .01em;
  color: var(--color-ink);
  line-height: 1.05;
  outline: none;
  border-radius: 6px;
}
.brand-name[contenteditable]:focus { box-shadow: 0 0 0 2px var(--color-accent); }
.brand-url {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 15px;
  width: fit-content;
}
.brand-url:hover { color: var(--color-ink); }
.brand-url svg { flex-shrink: 0; opacity: .7; }
.brand-url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Typography ── */
.type-samples { display: flex; align-items: baseline; gap: 14px; }
.aa { font-size: clamp(40px, 5vw, 58px); line-height: 1; }
.aa-display { font-weight: 700; color: var(--color-ink); }
.aa-body { font-weight: 400; color: #c0bcb3; }
.type-names {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}
.type-names span {
  font-size: 12.5px;
  color: var(--color-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.type-names span:first-child { width: clamp(40px, 5vw, 58px); }

/* ── Language ── */
.lang-body { display: flex; align-items: center; gap: 14px; padding-top: 6px; }
.flag {
  font-size: 30px;
  line-height: 1;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f4f2ee;
  box-shadow: inset 0 0 0 1px var(--color-border);
}
.lang-name { font-size: 19px; font-weight: 500; color: var(--color-ink); }

/* ── Colors ── */
.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  height: 100%;
  min-height: 190px;
}
.swatch {
  position: relative;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06), 0 4px 10px rgba(20,18,12,.06);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition);
}
.swatch:hover { transform: scale(1.015); }
.swatch .hex {
  position: absolute;
  left: 10px;
  bottom: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255,255,255,.82);
  color: #1c1a17;
  opacity: 0;
  transition: opacity var(--transition);
}
.swatch:hover .hex { opacity: 1; }
.swatch input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ── Headline ── */
.card-headline .headline-text {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.9vw, 21px);
  line-height: 1.42;
  color: var(--color-ink);
  margin: 0;
  outline: none;
  border-radius: 6px;
}
.headline-text[contenteditable]:focus { box-shadow: 0 0 0 2px var(--color-accent); }

/* ── Produkty / obrázky ── */
.thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f2ee;
  box-shadow: inset 0 0 0 1px var(--color-border);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.more {
  display: grid;
  place-items: center;
  background: #1c1a17;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.thumb.more::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
}
.thumb.more span { position: relative; z-index: 1; }
.thumb.empty { background: repeating-linear-gradient(45deg, #f0eee9, #f0eee9 6px, #ebe9e3 6px, #ebe9e3 12px); }

/* ───────────────────────────── CONTINUE ───────────────────────────── */

.actions { display: flex; justify-content: center; margin-top: 38px; }
.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  background: var(--color-black);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  padding: 15px 34px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(14,14,16,.22);
  transition: transform var(--transition), background var(--transition);
}
.btn-continue:hover { transform: translateY(-2px); background: #26262a; }
.btn-continue svg { transition: transform var(--transition); }
.btn-continue:hover svg { transform: translateX(3px); }

/* ───────────────────────────── FOOTER ───────────────────────────── */

.site-footer { margin-top: 30px; }
.footer-credit {
  text-align: right;
  font-size: 0.8rem;
  color: var(--color-muted);
  padding: 0.5rem 1.2rem;
}
.footer-credit a { color: var(--color-muted); text-underline-offset: 3px; transition: color .2s; }
.footer-credit a:hover { color: #222; }

/* ───────────────────────────── RESPONSIVE ───────────────────────────── */

@media (max-width: 980px) {
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "logo"
      "colors"
      "meta"
      "head"
      "prods"
      "imgs";
  }
  .card-logo .logo-body { min-height: 150px; }
  .swatches { min-height: 200px; }
}

@media (max-width: 560px) {
  .meta-row { grid-template-columns: 1fr; }
  .search { flex-wrap: nowrap; }
  .btn-extract { padding: 12px 16px; }
  .btn-extract .btn-label { display: none; }
  .examples { display: none; }
}
