/* =========================================================================
   tools.filipc.cz — "Dílna / Razítkovna"
   Tmavé teplé inkoustové pozadí · papírová typografie · razítková červená
   ========================================================================= */

:root {
  --ink:        #16130d;   /* pozadí — teplá inkoustová čerň */
  --ink-2:      #1d1912;   /* mírně vyvýšené pásy */
  --surface:    #211c14;   /* dlaždice / karty */
  --surface-hi: #2b251a;   /* hover */
  --paper:      #f3ecdd;   /* primární text — off-white papír */
  --paper-dim:  #bcb09a;   /* sekundární text */
  --muted:      #8a7f6c;   /* terciární / popisky */
  --stamp:      #e2492f;   /* akcent — razítková červená */
  --stamp-deep: #b8351f;
  --brass-c:    #cba35c;   /* mosazný doplněk */
  --line:       rgba(243, 236, 221, 0.10);
  --line-soft:  rgba(243, 236, 221, 0.06);

  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;
  --font-body:    'Hanken Grotesk', system-ui, sans-serif;

  --maxw: 1080px;
  --r: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--ink);
  color: var(--paper);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  /* atmosféra: jemné mřížkové tečky + dvě teplá světla */
  background-image:
    radial-gradient(circle at 18% -10%, rgba(226, 73, 47, 0.10), transparent 45%),
    radial-gradient(circle at 95% 8%, rgba(203, 163, 92, 0.08), transparent 40%),
    radial-gradient(var(--line-soft) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px;
  background-attachment: fixed;
}

/* zrnitá filmová textura přes celou stránku */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: 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.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(20px, 5vw, 40px) 64px;
}

/* ---------- typografické pomocníky ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass-c);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--brass-c);
  opacity: 0.7;
}

a { color: inherit; }

/* =========================================================================
   MASTHEAD
   ========================================================================= */
.masthead { margin-bottom: clamp(36px, 6vw, 60px); }

.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: clamp(24px, 5vw, 44px);
}
.masthead__id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--paper);
}
.title .dot { color: var(--stamp); }

.lede {
  margin-top: clamp(16px, 3vw, 22px);
  max-width: 46ch;
  font-size: clamp(1.02rem, 2.4vw, 1.2rem);
  color: var(--paper-dim);
}

.masthead__rule {
  margin-top: clamp(26px, 5vw, 40px);
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* =========================================================================
   MŘÍŽKA DLAŽDIC
   ========================================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(14px, 2vw, 20px);
}

.tile {
  grid-column: span 3;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: clamp(22px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--paper);
  overflow: hidden;
  isolation: isolate;
  transition: transform .35s cubic-bezier(.2,.7,.2,1),
              border-color .35s, background .35s;
}

/* hlavní dlaždice přes celou šířku */
.tile--feature { grid-column: span 6; min-height: 260px; }

/* jemné razítkové světlo v rohu dlaždice */
.tile::after {
  content: "";
  position: absolute;
  right: -40%;
  bottom: -60%;
  width: 80%;
  height: 120%;
  background: radial-gradient(circle, rgba(226,73,47,0.14), transparent 65%);
  opacity: 0;
  transition: opacity .4s;
  z-index: -1;
}

.tile[href]:hover {
  transform: translateY(-6px);
  border-color: rgba(226, 73, 47, 0.55);
  background: var(--surface-hi);
}
.tile[href]:hover::after { opacity: 1; }

.tile__index {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--brass-c);
}

.tile__icon {
  margin: 4px 0 auto;
  width: 46px;
  height: 46px;
  color: var(--stamp);
}
.tile--feature .tile__icon { width: 54px; height: 54px; }
.tile__icon svg { width: 100%; height: 100%; display: block; }

.tile__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin-top: 22px;
}
.tile__desc {
  margin-top: 10px;
  color: var(--paper-dim);
  font-size: 0.97rem;
  max-width: 44ch;
}
.tile__cta {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap .3s;
}
.tile[href]:hover .tile__cta { gap: 14px; }

/* "připravuje se" dlaždice */
.tile--soon {
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}
.tile--soon .tile__icon { color: var(--muted); opacity: 0.6; }
.tile--soon .tile__title { color: var(--paper-dim); }
.tile__badge {
  position: absolute;
  top: 20px;
  right: 20px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

/* =========================================================================
   PATIČKA
   ========================================================================= */
.foot {
  margin-top: clamp(48px, 8vw, 80px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.foot a { color: var(--paper-dim); text-decoration: none; transition: color .25s; }
.foot a:hover { color: var(--stamp); }

/* =========================================================================
   STRÁNKA NÁSTROJE (PLACENO)
   ========================================================================= */
.backlink {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: gap .3s, color .25s;
}
.backlink:hover { color: var(--stamp); gap: 14px; }

.tool-head { margin: clamp(26px, 5vw, 42px) 0 clamp(28px, 5vw, 44px); }
.tool-head .title { font-size: clamp(2.4rem, 8vw, 4.4rem); }

.tool-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(18px, 3vw, 30px);
  align-items: start;
}

/* panel s nahráváním */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(22px, 3.5vw, 34px);
}
.panel__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass-c);
  margin-bottom: 18px;
}

.dropzone {
  border: 1.5px dashed rgba(243,236,221,0.22);
  border-radius: 12px;
  padding: clamp(28px, 5vw, 44px) 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color .25s, background .25s;
  background: rgba(0,0,0,0.12);
}
.dropzone:hover { border-color: rgba(226,73,47,0.6); background: rgba(226,73,47,0.05); }
.dropzone.is-drag { border-color: var(--stamp); background: rgba(226,73,47,0.10); }
.dropzone.has-file { border-style: solid; border-color: rgba(203,163,92,0.55); }
.dropzone input[type=file] { display: none; }

.dropzone__icon { width: 40px; height: 40px; color: var(--paper-dim); margin: 0 auto 14px; }
.dropzone__icon svg { width: 100%; height: 100%; }
.dropzone__title { font-weight: 600; font-size: 1.05rem; color: var(--paper); }
.dropzone__hint { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.dropzone__file {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--brass-c);
  word-break: break-all;
  display: none;
}
.dropzone.has-file .dropzone__file { display: block; }
.dropzone.has-file .dropzone__hint { display: none; }

.btn {
  margin-top: 20px;
  width: 100%;
  border: none;
  border-radius: 11px;
  padding: 15px 22px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: #1a1009;
  background: var(--stamp);
  cursor: pointer;
  transition: transform .2s, background .25s, opacity .25s;
}
.btn:hover { background: #f0573c; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }

.alert {
  margin-top: 18px;
  border: 1px solid rgba(226,73,47,0.5);
  background: rgba(226,73,47,0.10);
  color: #f6c9bd;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  display: none;
}
.alert.is-shown { display: block; }

.note {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}
.note__row {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--paper-dim);
}
.note__num {
  font-family: var(--font-mono);
  color: var(--brass-c);
  font-size: 0.8rem;
  padding-top: 2px;
  min-width: 22px;
}

/* náhledová karta – ukazuje umístění razítka */
.preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(22px, 3.5vw, 34px);
}
.preview__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
/* maketa stránky dokumentu */
.doc {
  position: relative;
  aspect-ratio: 1 / 1.32;
  background: #ece4d3;
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  overflow: hidden;
  padding: 9% 9% 0;
}
.doc__line { height: 7px; border-radius: 3px; background: #cdc1a9; margin-bottom: 11px; }
.doc__line.s { width: 38%; background: #d9cfba; }
.doc__line.m { width: 62%; }
.doc__line.l { width: 84%; }
.doc__block {
  margin-top: 16px;
  height: 24%;
  border-radius: 5px;
  background: repeating-linear-gradient(
    transparent, transparent 8px, #d4c8b0 8px, #d4c8b0 9px);
  opacity: 0.8;
}
/* samotné razítko vlevo dole */
.doc__stamp {
  position: absolute;
  left: 7%;
  bottom: 6%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  letter-spacing: 0.02em;
  color: #000;
  opacity: 0.42;
  transform: rotate(-3deg);
  pointer-events: none;
}
.preview__cap {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* =========================================================================
   RESPONZIVITA
   ========================================================================= */
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .tile { grid-column: span 2; }
  .tile--feature { grid-column: span 2; }
  .tool-layout { grid-template-columns: 1fr; }
  .preview { order: -1; }
}

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

/* nenápadný nástup */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.masthead, .tile, .tool-head, .tool-layout > * {
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.tile:nth-child(2) { animation-delay: .06s; }
.tile:nth-child(3) { animation-delay: .12s; }
.tile:nth-child(4) { animation-delay: .18s; }
.tool-layout > *:nth-child(2) { animation-delay: .08s; }
