/* ToolsForModels — UX Sprint 2 — global navigation + visual cohesion
   Layered over Sprint 1. Intentionally avoids SEO/content architecture rules. */
:root{
  --tfm-s2-paper:#fff;
  --tfm-s2-surface:#fff;
  --tfm-s2-ink:#171717;
  --tfm-s2-muted:#666;
  --tfm-s2-line:rgba(23,23,23,.14);
  --tfm-s2-line-strong:rgba(23,23,23,.24);
  --tfm-s2-accent:#111;
  --tfm-s2-radius:16px;
  --tfm-s2-radius-sm:12px;
  --tfm-s2-shadow:0 16px 40px rgba(23,23,23,.09);
}

/* Shared focus / touch behaviour. */
body[data-tfm-module] a,
body[data-tfm-module] button,
body[data-tfm-module] summary,
body[data-tfm-module] select,
body[data-tfm-module] input,
body[data-tfm-module] textarea{ -webkit-tap-highlight-color:transparent; }
body[data-tfm-module] :is(a,button,summary,select,input,textarea):focus-visible{
  outline:2px solid var(--tfm-s2-ink)!important;
  outline-offset:3px;
}
body[data-tfm-module] :is(input[type="text"],input[type="email"],input[type="search"],input[type="tel"],input[type="url"],input[type="number"],input[type="password"],select,textarea){
  border-radius:var(--tfm-s2-radius-sm);
}
body[data-tfm-module] :is(.btn,.button,.hub-btn,.ck-btn,.ial-btn){
  min-height:44px;
}

/* One ecosystem header. Existing crawlable destinations stay normal anchors. */
.tfm-unit-header{
  position:relative;
  z-index:90;
  border-bottom:1px solid var(--tfm-s2-line)!important;
  background:rgba(255,255,255,.98)!important;
  color:var(--tfm-s2-ink)!important;
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}
.tfm-unit-header .tfm-unit-shell{width:min(1220px,calc(100% - 36px))}
.tfm-unit-header .tfm-unit-headrow{min-height:62px;display:flex;align-items:center;gap:15px}
.tfm-unit-identity{display:flex;align-items:center;gap:10px;min-width:max-content}
.tfm-unit-header .tfm-unit-brand{font-family:Georgia,'Times New Roman',serif;font-size:1.13rem;font-weight:700;letter-spacing:-.018em}
.tfm-unit-module{display:inline-flex;align-items:center;min-height:26px;padding:0 9px;border-left:1px solid var(--tfm-s2-line);color:var(--tfm-s2-muted);font:700 .68rem/1.1 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;letter-spacing:.055em;text-transform:uppercase;white-space:nowrap}
.tfm-unit-header .tfm-unit-nav{display:flex;align-items:center;gap:4px;margin-left:auto;overflow:visible;padding:0}
.tfm-unit-header .tfm-unit-nav>a,
.tfm-unit-navgroup>summary{display:inline-flex;align-items:center;min-height:38px;padding:0 10px;border-radius:999px;color:inherit;text-decoration:none;font:700 .75rem/1 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;letter-spacing:.015em;white-space:nowrap;cursor:pointer}
.tfm-unit-header .tfm-unit-nav>a:hover,
.tfm-unit-navgroup>summary:hover{background:rgba(23,23,23,.055)}
.tfm-unit-header .tfm-unit-nav>a[aria-current="page"],
.tfm-unit-navgroup.is-current>summary{background:#f2f2f2;color:#111;text-decoration:none}
.tfm-unit-navgroup{position:relative;margin:0}
.tfm-unit-navgroup>summary{list-style:none;gap:6px}
.tfm-unit-navgroup>summary::-webkit-details-marker{display:none}
.tfm-unit-navgroup>summary::after{content:"⌄";font-size:.72rem;line-height:1;opacity:.68;transform:translateY(-1px)}
.tfm-unit-navgroup[open]>summary::after{transform:rotate(180deg) translateY(1px)}
.tfm-unit-navgroup-menu{position:absolute;top:calc(100% + 7px);left:0;z-index:140;min-width:210px;padding:7px;border:1px solid var(--tfm-s2-line);border-radius:14px;background:rgba(255,255,255,.99);box-shadow:var(--tfm-s2-shadow)}
.tfm-unit-navgroup-menu a{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:42px;padding:8px 10px;border-radius:9px;color:var(--tfm-s2-ink);text-decoration:none;font:680 .79rem/1.2 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;white-space:nowrap}
.tfm-unit-navgroup-menu a:hover{background:#f5f5f5}
.tfm-unit-navgroup-menu a[aria-current="page"]{background:#f2f2f2;color:#111;font-weight:800}
.tfm-unit-navgroup-menu a::after{content:"↗";font-size:.72rem;opacity:.38}
.tfm-unit-header .tfm-unit-secondary{color:#555}
.tfm-unit-header .tfm-unit-account{border:1px solid var(--tfm-s2-line);background:rgba(255,255,255,.54);padding-inline:12px!important}
.tfm-unit-header .tfm-unit-account::before{content:"○";font-size:.82rem;line-height:1}
.tfm-unit-header .tfm-unit-lang{flex:0 0 auto;max-width:108px;min-height:36px;padding:4px 22px 4px 7px;border:1px solid transparent;border-radius:999px;background-color:transparent;color:inherit;font:700 .7rem/1 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}
.tfm-unit-header .tfm-unit-lang:hover,.tfm-unit-header .tfm-unit-lang:focus{border-color:var(--tfm-s2-line);background-color:rgba(255,255,255,.55)}

/* Footer gets the same restrained shell without forcing module content to match. */
.tfm-unit-footer{background:var(--tfm-s2-paper)!important;border-top:1px solid var(--tfm-s2-line)!important}
.tfm-unit-footer .tfm-unit-shell{min-height:68px}

/* Portal audience switch: immediate role clarity without another large section. */
.hub-audience-switch{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 16px}
.hub-audience-switch :is(a,span){display:inline-flex;align-items:center;min-height:30px;padding:0 10px;border:1px solid rgba(23,23,23,.12);border-radius:999px;background:rgba(255,255,255,.52);color:#4d4d4d;text-decoration:none;font:800 .64rem/1 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;letter-spacing:.04em}
.hub-audience-switch span[aria-current="page"]{background:#17151d;color:#fff;border-color:#17151d}
.hub-audience-switch a:hover{border-color:rgba(23,23,23,.32);background:#fff}

/* Shared card / message polish: geometry only, no content removal. */
body[data-tfm-module] :is(.intent-card,.more-card,.module-card,.directory-card,.discover-card,.city-index-card,.city-rail-card,.city-dna-card,.learning-action-card,.learning-stage-card,.learning-resource-card,.timeline-card,.ck-guide-card,.ck-upload-card,.panel,.auth-card){
  text-rendering:optimizeLegibility;
}
body[data-tfm-module] :is(.empty-state,.empty,.loading,.form-message){line-height:1.5}
body[data-tfm-module] [aria-busy="true"]{cursor:progress}

/* Density: targeted, intentionally modest. */
body[data-tfm-module="portal"] .hub-hero{padding-bottom:36px}
body[data-tfm-module="portal"] .intent-section{padding-bottom:48px}
body[data-tfm-module="portal"] .more-section{padding-top:44px;padding-bottom:52px}

body[data-tfm-module="directory"] .directory-hero{padding-top:26px}
body[data-tfm-module="directory"] .directory-hero-grid{min-height:350px}
body[data-tfm-module="directory"] .hero-visual{min-height:350px}
body[data-tfm-module="directory"] .directory-body{padding-bottom:68px}

body[data-tfm-module="cities"] .cities-home-hero{padding-top:40px;padding-bottom:34px}
body[data-tfm-module="cities"] .cities-featured{padding-top:58px;padding-bottom:58px}
body[data-tfm-module="cities"] .cities-method-strip{padding-top:44px;padding-bottom:44px}
body[data-tfm-module="cities"] .cities-all{padding-top:54px;padding-bottom:70px}
body[data-tfm-module="cities"] .city-guide-hero{padding-bottom:44px}
body[data-tfm-module="cities"] .city-guide-content{padding-top:56px;padding-bottom:66px}

body[data-tfm-module="digitals"] .ck{padding-top:20px;padding-bottom:68px}
body[data-tfm-module="digitals"] .ck-intro{min-height:auto;gap:34px;padding:28px 0 18px}
body[data-tfm-module="digitals"] .ck-intro-art{min-height:440px;border-radius:16px}
body[data-tfm-module="digitals"] .ck-guide-card,
body[data-tfm-module="digitals"] .ck-upload-card{border-radius:14px}

body[data-tfm-module="card"] .public-entry-hero--v9{padding-top:48px;padding-bottom:38px}
body[data-tfm-module="card"] .public-entry-output--v9{padding-top:48px;padding-bottom:48px}
body[data-tfm-module="card"] .tfm-learning-context{margin-bottom:34px}

body[data-tfm-module="learning"] .learning-home-premium{padding-top:30px!important}
body[data-tfm-module="learning"] .learning-paths-premium{padding-top:40px!important;padding-bottom:50px!important}
body[data-tfm-module="learning"] .learning-resources:not(.creator-home-editorial){padding-top:38px!important;padding-bottom:46px!important}

/* Mobile: one-hand header, stable Sprint 1 menu, compact nested groups. */
@media(max-width:960px){
  .tfm-mobile-menu-header{position:sticky!important;top:0;z-index:110}
  .tfm-mobile-menu-header .tfm-unit-shell{width:calc(100% - 24px)!important}
  .tfm-mobile-menu-header .tfm-unit-headrow{min-height:56px!important;padding:0!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto auto;gap:6px!important;align-items:center}
  .tfm-mobile-menu-header .tfm-unit-identity{grid-column:1;grid-row:1;min-width:0;gap:7px;overflow:hidden}
  .tfm-mobile-menu-header .tfm-unit-brand{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:1.05rem!important}
  .tfm-mobile-menu-header .tfm-unit-module{min-width:0;max-width:112px;overflow:hidden;text-overflow:ellipsis;padding-left:7px;padding-right:0;font-size:.61rem}
  .tfm-mobile-menu-header .tfm-unit-lang{grid-column:2;grid-row:1;max-width:82px!important;min-height:44px;font-size:.67rem!important;padding-left:4px!important}
  .tfm-mobile-menu-header .tfm-unit-menu-toggle{grid-column:3;grid-row:1;display:inline-flex!important;min-width:44px!important;min-height:44px!important;border-radius:999px}
  .tfm-mobile-menu-header .tfm-mobile-menu-nav{position:absolute!important;top:calc(100% + 1px)!important;right:0!important;left:auto!important;width:min(410px,100%)!important;max-height:calc(100dvh - 64px)!important;margin:0!important;padding:8px 10px 12px!important;display:none;flex-direction:column!important;align-items:stretch!important;gap:2px!important;overflow-y:auto!important;overscroll-behavior:contain;border:1px solid var(--tfm-s2-line)!important;border-top:0!important;border-radius:0 0 16px 16px!important;background:rgba(255,255,255,.995)!important;box-shadow:0 18px 38px rgba(23,23,23,.15)!important}
  .tfm-mobile-menu-header.tfm-mobile-menu-open .tfm-mobile-menu-nav{display:flex!important}
  .tfm-mobile-menu-header .tfm-mobile-menu-nav[hidden]{display:none!important}
  .tfm-mobile-menu-header .tfm-unit-nav>a,
  .tfm-mobile-menu-header .tfm-unit-navgroup>summary{display:flex;min-height:45px!important;width:100%;padding:7px 9px!important;border-radius:10px!important;font-size:.84rem!important;white-space:normal!important}
  .tfm-mobile-menu-header .tfm-unit-nav>a{border-bottom:0!important}
  .tfm-mobile-menu-header .tfm-unit-navgroup>summary{justify-content:space-between}
  .tfm-mobile-menu-header .tfm-unit-navgroup-menu{position:static;min-width:0;margin:0 0 5px;padding:2px 0 4px 11px;border:0;border-left:1px solid var(--tfm-s2-line);border-radius:0;background:transparent;box-shadow:none}
  .tfm-mobile-menu-header .tfm-unit-navgroup-menu a{min-height:42px;padding:7px 10px;font-size:.79rem;white-space:normal}
  .tfm-mobile-menu-header .tfm-unit-navgroup-menu a::after{content:"→"}
  .tfm-mobile-menu-header .tfm-unit-creators{margin-top:6px!important;padding-top:7px!important;border-top:1px solid var(--tfm-s2-line)!important}
  .tfm-mobile-menu-header .tfm-unit-pro{margin:0!important}
  .tfm-mobile-menu-header .tfm-unit-account{margin-top:4px;border-color:var(--tfm-s2-line)!important;background:#fff!important}
}

@media(max-width:760px){
  body[data-tfm-module="portal"] .hub-hero{padding-bottom:24px}
  body[data-tfm-module="portal"] .intent-section{padding-bottom:34px}
  body[data-tfm-module="portal"] .more-section{padding-top:34px;padding-bottom:42px}

  body[data-tfm-module="directory"] .directory-hero{padding:16px 0 10px}
  body[data-tfm-module="directory"] .directory-hero-grid{min-height:0;border-radius:20px}
  body[data-tfm-module="directory"] .hero-copy{padding:24px 20px 30px}
  body[data-tfm-module="directory"] .hero-visual{min-height:220px}
  body[data-tfm-module="directory"] .search-stage{margin-top:-26px}
  body[data-tfm-module="directory"] .directory-body{padding-top:16px;padding-bottom:54px}

  body[data-tfm-module="cities"] .cities-home-hero{padding:24px 0 23px}
  body[data-tfm-module="cities"] .cities-featured{padding:38px 0}
  body[data-tfm-module="cities"] .cities-method-strip{padding:32px 0}
  body[data-tfm-module="cities"] .cities-all{padding:38px 0 52px}
  body[data-tfm-module="cities"] .city-guide-hero{padding:18px 0 30px}
  body[data-tfm-module="cities"] .city-guide-hero .cities-editorial-photo{height:260px!important;min-height:0!important}
  body[data-tfm-module="cities"] .city-guide-content{padding:36px 0 48px}
  body[data-tfm-module="cities"] .city-index-region{padding-top:26px}

  body[data-tfm-module="digitals"] .ck{padding:10px 0 52px}
  body[data-tfm-module="digitals"] .ck-intro{padding-top:20px;gap:20px}
  body[data-tfm-module="digitals"] .ck-intro-art{min-height:250px;border-radius:14px}
  body[data-tfm-module="digitals"] .ck-heading{margin:24px 0 22px}
  body[data-tfm-module="digitals"] .ck-nav{margin-top:28px}

  body[data-tfm-module="card"] .public-entry-hero--v9{padding-top:28px!important;padding-bottom:26px!important}
  body[data-tfm-module="card"] .public-entry-output--v9{padding-top:36px!important;padding-bottom:36px!important}
  body[data-tfm-module="card"] .tfm-learning-context{margin-bottom:26px}

  body[data-tfm-module="learning"] .learning-home-premium{padding-top:20px!important}
  body[data-tfm-module="learning"] .learning-paths-premium{padding-top:28px!important;padding-bottom:34px!important}
  body[data-tfm-module="learning"] .learning-resources:not(.creator-home-editorial){padding-top:28px!important;padding-bottom:32px!important}

  .hub-audience-switch{margin-bottom:12px;gap:5px}
  .hub-audience-switch :is(a,span){min-height:28px;padding:0 8px;font-size:.6rem}
}

@media(max-width:430px){
  .tfm-mobile-menu-header .tfm-unit-shell{width:calc(100% - 18px)!important}
  .tfm-mobile-menu-header .tfm-unit-module{max-width:84px}
  .tfm-mobile-menu-header .tfm-unit-lang{max-width:72px!important}
  .tfm-mobile-menu-header .tfm-unit-menu-label{font-size:.67rem!important}
  .tfm-mobile-menu-header .tfm-mobile-menu-nav{width:100%!important;padding-inline:8px!important}
  body[data-tfm-module="directory"] .hero-visual{min-height:190px}
  body[data-tfm-module="cities"] .city-guide-hero .cities-editorial-photo{height:230px!important}
  body[data-tfm-module="digitals"] .ck-intro-art{min-height:220px}
}

@media(prefers-reduced-motion:reduce){
  body[data-tfm-module] *,body[data-tfm-module] *::before,body[data-tfm-module] *::after{scroll-behavior:auto!important;transition-duration:.001ms!important;animation-duration:.001ms!important;animation-iteration-count:1!important}
}
