/* =====================================================================
   HumanAId – veřejný portál
   Barvy sekcí jsou odvozené ze tří stran trojúhelníku v logu:
   modrá = učitelé, oranžová = žáci, fialová = experimenty.
   ===================================================================== */

:root {
  --paper: #F5F6FA;
  --surface: #FFFFFF;
  --ink: #161A2D;
  --ink-2: #4A5068;
  --ink-3: #737891;
  --line: #DFE2EC;

  --teach: #1661D0;   --teach-2: #14B4D8; --teach-soft: #E7F0FD; --teach-ink: #0F4CA6;
  --pupil: #EE6A1C;   --pupil-2: #F7B320; --pupil-soft: #FEF0E2; --pupil-ink: #A8450A;
  --exp:   #9A2F9E;   --exp-2:   #6A3BD0; --exp-soft:   #F5E9F8; --exp-ink:   #7A1F7E;

  --accent: var(--ink); --accent-2: var(--ink-2); --accent-soft: #ECEEF5; --accent-ink: var(--ink);

  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 8px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --head-h: 68px;
}

.theme-teach { --accent: var(--teach); --accent-2: var(--teach-2); --accent-soft: var(--teach-soft); --accent-ink: var(--teach-ink); }
.theme-pupil { --accent: var(--pupil); --accent-2: var(--pupil-2); --accent-soft: var(--pupil-soft); --accent-ink: var(--pupil-ink); }
.theme-exp   { --accent: var(--exp);   --accent-2: var(--exp-2);   --accent-soft: var(--exp-soft);   --accent-ink: var(--exp-ink); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 .5em; font-weight: 750; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
p { margin: 0 0 1em; }
.lead { font-size: clamp(1.08rem, 1rem + .4vw, 1.3rem); color: var(--ink-2); max-width: 40ch; }
.muted { color: var(--ink-3); font-size: .92rem; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent, var(--teach)); outline-offset: 3px; border-radius: 4px; }

/* ---------- Tlačítka a štítky ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  min-height: 46px; padding: 0 22px; border-radius: 999px;
  font: 700 1rem/1 var(--font-body); text-decoration: none; border: 0; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #2A2F4A; }
.btn-theme { background: var(--accent); color: #fff; }
.btn-theme:hover { background: var(--accent-ink); }
.badge {
  display: inline-block; font: 700 .75rem/1 var(--font-body); padding: 5px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); vertical-align: middle;
}
.badge-soon { background: #ECEEF5; color: var(--ink-2); }

/* ---------- Hlavička ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245, 246, 250, .88);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-row { display: flex; align-items: center; gap: 20px; min-height: var(--head-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 800 1.3rem/1 var(--font-head); letter-spacing: -.02em; margin-right: auto; }
.brand .tri { width: 34px; height: auto; }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  position: relative; padding: 10px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 700;
}
.main-nav a::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; background: var(--ink-3); transform: rotate(45deg); }
.main-nav a.nav-teach::before { background: var(--teach); }
.main-nav a.nav-pupil::before { background: var(--pupil); }
.main-nav a.nav-exp::before   { background: var(--exp); }
.main-nav a:not([class^="nav-"]):not([class*=" nav-"])::before { display: none; }
.main-nav a:hover { background: #fff; color: var(--ink); }
.main-nav a.is-current { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-play {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; font-size: .95rem;
}
.btn-play:hover { background: #2A2F4A; }
.menu-btn { display: none; }

.announce { background: var(--ink); color: #fff; font-size: .95rem; }
.announce .wrap { padding-block: 10px; }

/* ---------- Trojúhelník ---------- */
.tri { display: block; overflow: visible; }
.tri-side polygon { stroke: var(--paper); stroke-width: 3; stroke-linejoin: round; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s; transform-box: fill-box; transform-origin: center; }
.tri-side.is-dim polygon { opacity: .18; }
.tri--hero .tri-side { cursor: pointer; outline: none; }
.tri--hero .tri-teach:hover polygon, .tri--hero .tri-teach:focus-visible polygon { transform: translate(-10px, -4px); }
.tri--hero .tri-pupil:hover polygon, .tri--hero .tri-pupil:focus-visible polygon { transform: translate(10px, -4px); }
.tri--hero .tri-exp:hover polygon,   .tri--hero .tri-exp:focus-visible polygon   { transform: translate(0, 10px); }
.tri--hero:hover .tri-side:not(:hover) polygon { opacity: .35; }
.tri--hero .tri-side:focus-visible polygon { stroke: var(--ink); }

/* ---------- Úvod: hero ---------- */
.hero { padding: clamp(36px, 7vw, 96px) 0 clamp(28px, 5vw, 64px); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 5vw, 72px); align-items: center; }
.hero h1 { max-width: 15ch; font-size: clamp(2.3rem, 1.4rem + 4vw, 4.4rem); font-weight: 800; letter-spacing: -.03em; }
.hero-legend { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 8px; max-width: 30rem; }
.hero-legend a {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700;
}
.hero-legend a::before { content: ""; flex: 0 0 34px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--a1), var(--a2)); }
.hero-legend a::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor; transform: rotate(45deg); opacity: .5; }
.hero-legend a:hover { border-color: var(--a1); }
.lg-teach { --a1: var(--teach); --a2: var(--teach-2); }
.lg-pupil { --a1: var(--pupil-2); --a2: var(--pupil); }
.lg-exp   { --a1: var(--exp-2);   --a2: var(--exp); }

.hero-art { position: relative; max-width: 460px; width: 100%; justify-self: center; padding: 8% 12% 12%; }
.hero-art .tri { width: 100%; height: auto; }
.tri-label { position: absolute; font: 750 clamp(.95rem, .8rem + .5vw, 1.2rem)/1 var(--font-head); pointer-events: none; }
.tl-teach { left: 0; top: 46%; color: var(--teach-ink); transform: translateX(-10%); }
.tl-pupil { right: 0; top: 46%; color: var(--pupil-ink); transform: translateX(14%); }
.tl-exp   { left: 50%; bottom: 0; transform: translateX(-50%); color: var(--exp-ink); }

/* ---------- Úvod: vstupy do sekcí ---------- */
.doors { display: grid; gap: clamp(16px, 2.5vw, 28px); padding-bottom: clamp(40px, 6vw, 80px); }
.door {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface); border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); position: relative;
}
.door::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 8px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); z-index: 1; }
.door-img { display: block; background: var(--accent-soft); min-height: 220px; }
.door-img img { width: 100%; height: 100%; object-fit: cover; }
.door-body { padding: clamp(22px, 3vw, 40px); display: flex; flex-direction: column; align-items: flex-start; }
.door h2 { margin-bottom: .25em; }
.door h2 a { color: var(--ink); text-decoration: none; }
.door h2 a:hover { color: var(--accent-ink); }
.door-sub { color: var(--ink-2); margin-bottom: 18px; }
.door-tools { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.door-tools a {
  display: inline-block; padding: 7px 13px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-ink); text-decoration: none; font-weight: 700; font-size: .95rem;
}
.door-tools a:hover { background: var(--accent); color: #fff; }
.door-tools .is-soon a { background: #F0F1F6; color: var(--ink-3); }
.door-tools .badge { display: none; }
.door .btn { margin-top: auto; }
.door-count { position: absolute; top: 18px; right: 22px; color: var(--ink-3); font-size: .9rem; }

.play-strip { background: var(--ink); color: #fff; }
.play-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: clamp(28px, 4vw, 44px); }
.play-row h2 { margin-bottom: .2em; }
.play-row p { margin: 0; color: #C5C9DB; max-width: 52ch; }
.play-strip .btn-ink { background: #fff; color: var(--ink); flex-shrink: 0; }
.play-strip .btn-ink:hover { background: #E6E8F2; }

/* ---------- Sekce ---------- */
.sec-hero { background: var(--accent-soft); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.sec-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.sec-hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; padding-block: clamp(28px, 5vw, 64px); }
.sec-hero h1 { color: var(--ink); }
.sec-mark .tri { width: clamp(110px, 16vw, 190px); height: auto; }
.sec-mark .tri-side polygon { stroke: var(--accent-soft); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .95rem; color: var(--ink-2); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); }

.tools-wrap { padding-block: clamp(24px, 4vw, 48px); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tool {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); text-decoration: none; color: var(--ink); overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.tool:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-img { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--accent-soft); overflow: hidden; }
.tool-img img { width: 100%; height: 100%; object-fit: cover; }
.tool-img .mono { font: 800 clamp(2.4rem, 2rem + 2vw, 3.4rem)/1 var(--font-head); color: var(--accent); letter-spacing: -.03em; }
.tool-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px 20px; flex: 1; }
.tool-title { font: 750 1.2rem/1.2 var(--font-head); }
.tool-sum { color: var(--ink-2); font-size: .98rem; line-height: 1.45; }
.tool .badge { margin-top: auto; }
.tool.is-soon .tool-img { filter: grayscale(.85); opacity: .7; }
.tool.is-soon:hover { border-color: var(--line); transform: none; }
.empty { padding: 32px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-2); }

.others { padding-bottom: clamp(40px, 6vw, 72px); }
.others h2 { font-size: 1.2rem; color: var(--ink-2); }
.others-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.other {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 18px 26px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); position: relative;
}
.other::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 5px; border-radius: 0 4px 4px 0; background: var(--accent); }
.other strong { font-family: var(--font-head); font-size: 1.1rem; }
.other span { color: var(--ink-2); font-size: .95rem; }
.other:hover { border-color: var(--accent); }

/* ---------- Nástroj v rámu ---------- */
.page-tool { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.page-tool main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tool-bar {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 12px;
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
  background: var(--surface); border-bottom: 3px solid var(--accent); flex-shrink: 0;
}
.tb-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 6px; border-radius: 999px; color: var(--accent-ink); font-weight: 700; text-decoration: none; background: var(--accent-soft); white-space: nowrap; }
.tb-back svg { width: 22px; height: 22px; }
.tb-back:hover { background: var(--accent); color: #fff; }
.tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-title img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.tb-title h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; gap: 6px; }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 .92rem/1 var(--font-body); text-decoration: none; cursor: pointer; }
.tb-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.tb-btn:hover, .tb-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-ink); }
.tb-home { display: grid; place-items: center; width: 44px; height: 44px; }
.tb-home .tri { width: 28px; height: auto; }
.tool-info { background: var(--accent-soft); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tool-info-in { max-width: 72ch; padding: 14px 18px 4px; }
.tool-frame { position: relative; flex: 1; min-height: 0; background: #fff; }
.tool-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.frame-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.frame-loading .tri { width: 56px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.92); } }

/* ---------- Stránky s oznámením, o projektu ---------- */
.notice-page { padding-block: clamp(32px, 6vw, 72px); }
.soon-card { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 32px); margin-top: 12px; }
.soon-card .tool-img { border-radius: var(--r-md); aspect-ratio: 1; }
.soon-card h1 { margin-top: 10px; }
.about { padding-block: clamp(28px, 5vw, 56px) clamp(40px, 6vw, 80px); }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; font-size: 1.45rem; }
.prose dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.prose dt { font-weight: 700; }
.prose dd { margin: 0; color: var(--ink-2); }
.prose ul.cols { columns: 2 16rem; padding-left: 1.1em; }

/* ---------- Patička ---------- */
.site-foot { background: var(--surface); border-top: 1px solid var(--line); padding-top: 36px; color: var(--ink-2); font-size: .95rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; }
.foot-brand { display: flex; align-items: center; gap: 10px; font: 800 1.15rem/1 var(--font-head); color: var(--ink); }
.foot-brand .tri { width: 26px; }
.foot-text { max-width: 52ch; }
.foot-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; align-content: start; }
.foot-nav a { color: var(--ink-2); padding: 6px 0; }
.foot-logos { padding-block: 24px 32px; }
.foot-logos img { max-width: 640px; width: 100%; height: auto; }

/* =====================================================================
   Mobil a tablet
   ===================================================================== */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; max-width: 300px; padding: 4% 16% 10%; }
  .hero h1 { max-width: 18ch; }
  .door { grid-template-columns: 1fr; }
  .door-img { min-height: 0; aspect-ratio: 16 / 7; }
  .door::before { inset: 0 0 auto 0; width: auto; height: 6px; }
}

@media (max-width: 820px) {
  :root { --head-h: 60px; }
  .menu-btn {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 0;
  }
  .menu-ico, .menu-ico::before, .menu-ico::after { display: block; width: 20px; height: 2.5px; border-radius: 2px; background: var(--ink); position: relative; transition: transform .2s, background-color .2s; }
  .menu-ico::before, .menu-ico::after { content: ""; position: absolute; left: 0; }
  .menu-ico::before { top: -6px; } .menu-ico::after { top: 6px; }
  .menu-btn[aria-expanded="true"] .menu-ico { background: transparent; }
  .menu-btn[aria-expanded="true"] .menu-ico::before { transform: translateY(6px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] .menu-ico::after { transform: translateY(-6px) rotate(-45deg); }
  .head-row { gap: 10px; }
  .main-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 2px; padding: 10px var(--gutter) 18px;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 18px 30px -18px rgba(22,26,45,.35);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 14px 12px; font-size: 1.1rem; border-radius: var(--r-md); }
  .sec-hero-grid { grid-template-columns: 1fr; }
  .sec-mark { display: none; }
  .play-row { flex-direction: column; align-items: flex-start; }
  .foot-grid { grid-template-columns: 1fr; }
  .soon-card { grid-template-columns: 1fr; }
  .soon-card .tool-img { max-width: 160px; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .brand span { font-size: 1.15rem; }
  .btn-play { padding: 0 12px; font-size: .9rem; }
  .hero { padding-top: 20px; }
  .hero-legend { margin-top: 20px; }
  .door-count { position: static; order: -1; margin-bottom: 6px; }
  .door-body { padding: 20px 18px 22px; }
  .door .btn { width: 100%; justify-content: center; }
  /* Dlaždice nástrojů jako řádky: obrázek vlevo, text vpravo */
  .tools { grid-template-columns: 1fr; gap: 10px; }
  .tool { flex-direction: row; align-items: stretch; border-radius: var(--r-md); }
  .tool:hover { transform: none; }
  .tool-img { flex: 0 0 96px; aspect-ratio: auto; min-height: 96px; }
  .tool-img .mono { font-size: 1.8rem; }
  .tool-body { padding: 12px 14px; gap: 4px; justify-content: center; }
  .tool-title { font-size: 1.08rem; }
  .tool-sum { font-size: .93rem; }
  .tool .badge { margin-top: 4px; }
  /* Lišta nástroje */
  .tool-bar { gap: 6px; padding-inline: 8px; }
  .tb-back { padding-right: 6px; }
  .tb-back-txt, .tb-lbl { display: none; }
  .tb-btn { padding: 0; }
  .tb-title img { width: 28px; height: 28px; }
  .tb-title h1 { font-size: 1rem; }
  .tb-home { display: none; }
  .prose dl { grid-template-columns: 1fr; gap: 2px; }
  .prose dd { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
